@@ -125,6 +125,7 @@ class DataHarmonizer {
125
125
) ;
126
126
this . columnHelpEntries = options . columnHelpEntries || [
127
127
'column' ,
128
+ 'slot_uri' ,
128
129
'description' ,
129
130
'guidance' ,
130
131
'examples' ,
@@ -176,7 +177,7 @@ class DataHarmonizer {
176
177
( field ) => field . title === field_reference
177
178
) ;
178
179
$ ( '#field-description-text' ) . html (
179
- urlToClickableAnchor ( this . getComment ( field ) )
180
+ this . getComment ( field )
180
181
) ;
181
182
$ ( '#field-description-modal' ) . modal ( 'show' ) ;
182
183
} ) ;
@@ -1037,6 +1038,30 @@ class DataHarmonizer {
1037
1038
hotInstance . render ( ) ; // Render the table to apply changes
1038
1039
}
1039
1040
1041
+ renderSemanticID ( curieOrURI , as_markup = false ) {
1042
+ if ( curieOrURI ) {
1043
+ if ( curieOrURI . toLowerCase ( ) . startsWith ( 'http' ) ) {
1044
+ if ( as_markup )
1045
+ return `[${ curieOrURI } ](${ curieOrURI } )` ;
1046
+
1047
+ return `<a href="${ curieOrURI } " target="_blank">${ curieOrURI } </a>` ;
1048
+ }
1049
+ else if ( curieOrURI . includes ( ':' ) ) {
1050
+ const [ prefix , reference ] = curieOrURI . split ( ':' , 2 ) ;
1051
+ if ( prefix && reference && ( prefix in this . schema . prefixes ) ) {
1052
+ // Lookup curie
1053
+ let url = this . schema . prefixes [ prefix ] [ 'prefix_reference' ] + reference ;
1054
+ if ( as_markup )
1055
+ return `[${ curieOrURI } ](${ url } )` ;
1056
+ return `<a href="${ url } " target="_blank">${ curieOrURI } </a>` ;
1057
+ }
1058
+ else
1059
+ return `${ curieOrURI } ` ;
1060
+ }
1061
+ }
1062
+ return '' ;
1063
+ }
1064
+
1040
1065
/**
1041
1066
* Presents reference guide in a popup.
1042
1067
* @param {String } mystyle simple css stylesheet commands to override default.
@@ -1088,9 +1113,11 @@ class DataHarmonizer {
1088
1113
for ( const slot of section . children ) {
1089
1114
const slot_dict = this . getCommentDict ( slot ) ;
1090
1115
1116
+ const slot_uri = this . renderSemanticID ( slot_dict . slot_uri ) ;
1117
+
1091
1118
row_html += '<tr>' ;
1092
1119
if ( this . columnHelpEntries . includes ( 'column' ) ) {
1093
- row_html += `<td class="label">${ slot_dict . title } </td>` ;
1120
+ row_html += `<td class="label">${ slot_dict . title } <br/> ${ slot_uri } < /td>` ;
1094
1121
}
1095
1122
if ( this . columnHelpEntries . includes ( 'description' ) ) {
1096
1123
row_html += `<td>${ slot_dict . description } </td>` ;
@@ -1868,6 +1895,15 @@ class DataHarmonizer {
1868
1895
) } </strong>: ${ field . title || field . name } </p>`;
1869
1896
}
1870
1897
1898
+ // Requires markup treatment of URLS. Issue: this is getting rendered
1899
+ // wrong.
1900
+ const slot_uri = this . renderSemanticID ( field . slot_uri , true ) ;
1901
+ if ( field . slot_uri && this . columnHelpEntries . includes ( 'slot_uri' ) ) {
1902
+ ret += `<p><strong data-i18n="help-sidebar__column">${ i18next . t (
1903
+ 'help-sidebar__slot_uri'
1904
+ ) } </strong>: ${ slot_uri } </p>`;
1905
+ }
1906
+
1871
1907
if ( field . description && this . columnHelpEntries . includes ( 'description' ) ) {
1872
1908
ret += `<p><strong data-i18n="help-sidebar__description">${ i18next . t (
1873
1909
'help-sidebar__description'
@@ -1907,7 +1943,8 @@ class DataHarmonizer {
1907
1943
let guide = {
1908
1944
title : field . title ,
1909
1945
name : field . name ,
1910
- description : field . description || '' ,
1946
+ slot_uri : field . slot_uri ,
1947
+ description : urlToClickableAnchor ( field . description ) || '' ,
1911
1948
guidance : '' ,
1912
1949
examples : '' ,
1913
1950
sources : '' ,
@@ -1979,6 +2016,10 @@ class DataHarmonizer {
1979
2016
} )
1980
2017
. join ( '\n' ) ;
1981
2018
2019
+ // Makes full URIs that aren't in markup into <a href>
2020
+ if ( guide . guidance )
2021
+ guide . guidance = urlToClickableAnchor ( guide . guidance ) ;
2022
+
1982
2023
if ( field . examples && field . examples . length ) {
1983
2024
let examples = [ ] ;
1984
2025
let first_item = true ;
0 commit comments