@@ -284,8 +284,7 @@ LOGGING:
284
284
spanV .addEventListener (' click' , onClick , false );
285
285
workspace .tableCellElement .appendChild (spanV );
286
286
if (i < references .length - 1 ) {
287
- const textNode = document .createTextNode (' ; ' );
288
- workspace .tableCellElement .appendChild (textNode );
287
+ appendTextToElement (workspace .tableCellElement , ' ; ' );
289
288
}
290
289
}
291
290
} else {
@@ -358,6 +357,9 @@ LOGGING:
358
357
359
358
return callerSymbol ;
360
359
};
360
+ const appendTextToElement = (element : HTMLElement , text : string ) => {
361
+ element .innerHTML = element .innerHTML + text ;
362
+ };
361
363
const addGraftText = (workspace , text , textType , usfmType ) => {
362
364
if (workspace .textType .includes (textType )) {
363
365
if (isDefined (workspace .footnoteDiv )) {
@@ -452,15 +454,13 @@ LOGGING:
452
454
}
453
455
aElement .setAttribute (' match' , matchWord .trim ());
454
456
aElement .setAttribute (' href' , ' ' );
455
- const refText = document .createTextNode (phrase );
456
457
aElement .classList .add (' glossary' );
457
- aElement . appendChild ( refText );
458
+ appendTextToElement ( aElement , phrase );
458
459
spanElement .appendChild (aElement );
459
460
break ;
460
461
}
461
462
default : {
462
- child = document .createTextNode (phrase );
463
- spanElement .appendChild (child );
463
+ appendTextToElement (spanElement , phrase );
464
464
break ;
465
465
}
466
466
}
@@ -475,8 +475,7 @@ LOGGING:
475
475
if (workspace .showWordsOfJesus ) {
476
476
div = usfmSpan (div , usfmWrapperType , phrase );
477
477
} else {
478
- const textNode = document .createTextNode (phrase );
479
- div .appendChild (textNode );
478
+ appendTextToElement (div , phrase );
480
479
}
481
480
break ;
482
481
}
@@ -495,8 +494,7 @@ LOGGING:
495
494
}
496
495
}
497
496
} else {
498
- const textNode = document .createTextNode (phrase );
499
- div .appendChild (textNode );
497
+ appendTextToElement (div , phrase );
500
498
}
501
499
return div ;
502
500
};
@@ -641,8 +639,7 @@ LOGGING:
641
639
glossarySpan .append (block .key );
642
640
glossaryDiv .append (glossarySpan );
643
641
const blockText = block .text .slice (glossaryLink .length );
644
- const glossaryText = document .createTextNode (blockText );
645
- glossaryDiv .append (glossaryText );
642
+ appendTextToElement (glossaryDiv , blockText );
646
643
const glossaryHTML = glossaryDiv .outerHTML ;
647
644
footnotes .push (glossaryHTML );
648
645
}
@@ -924,8 +921,7 @@ LOGGING:
924
921
textDiv .onclick = (event ) => planClicked ();
925
922
}
926
923
textDiv .classList .add (divClass );
927
- const textNode = document .createTextNode (stringId );
928
- textDiv .append (textNode );
924
+ appendTextToElement (textDiv , stringId );
929
925
progressDiv .append (textDiv );
930
926
}
931
927
function getPlanReferenceString(ref ) {
@@ -1164,8 +1160,7 @@ LOGGING:
1164
1160
divFigureText .classList .add (' caption' );
1165
1161
const spanFigureText = document .createElement (' span' );
1166
1162
spanFigureText .classList .add (' caption' );
1167
- const spanFigureTextNode = document .createTextNode (caption );
1168
- spanFigureText .append (spanFigureTextNode );
1163
+ appendTextToElement (spanFigureText , caption );
1169
1164
divFigureText .append (spanFigureText );
1170
1165
return divFigureText ;
1171
1166
}
@@ -1735,11 +1730,10 @@ LOGGING:
1735
1730
workspace .titleGraft
1736
1731
)
1737
1732
) {
1738
- const text = context .sequences [0 ].element .text ;
1733
+ const text = convertJmp ( context .sequences [0 ].element .text ) ;
1739
1734
switch (currentTextType (workspace )) {
1740
1735
case ' title' : {
1741
- const child = document .createTextNode (text );
1742
- workspace .titleSpan .append (child );
1736
+ appendTextToElement (workspace .titleSpan , text );
1743
1737
break ;
1744
1738
}
1745
1739
case ' heading' : {
@@ -1750,8 +1744,7 @@ LOGGING:
1750
1744
// which contain references inline
1751
1745
workspace .headerInnerDiv .innerHTML = refText ;
1752
1746
} else {
1753
- const child = document .createTextNode (text );
1754
- workspace .headerInnerDiv .appendChild (child );
1747
+ appendTextToElement (workspace .headerInnerDiv , text );
1755
1748
}
1756
1749
break ;
1757
1750
}
@@ -1766,10 +1759,7 @@ LOGGING:
1766
1759
break ;
1767
1760
}
1768
1761
case ' audioc' :
1769
- case ' reflink' :
1770
- case ' tellink' :
1771
- case ' elink' :
1772
- case ' weblink' : {
1762
+ case ' reflink' : {
1773
1763
workspace .milestoneText = text ;
1774
1764
break ;
1775
1765
}
@@ -2297,27 +2287,6 @@ LOGGING:
2297
2287
);
2298
2288
break ;
2299
2289
}
2300
- case ' usfm:zweblink' : {
2301
- workspace .textType .push (' weblink' );
2302
- workspace .milestoneLink = decodeURIComponent (
2303
- element .atts [' link' ][0 ]
2304
- );
2305
- break ;
2306
- }
2307
- case ' usfm:ztellink' : {
2308
- workspace .textType .push (' tellink' );
2309
- workspace .milestoneLink = decodeURIComponent (
2310
- element .atts [' link' ][0 ]
2311
- );
2312
- break ;
2313
- }
2314
- case ' usfm:zelink' : {
2315
- workspace .textType .push (' elink' );
2316
- workspace .milestoneLink = decodeURIComponent (
2317
- element .atts [' link' ][0 ]
2318
- );
2319
- break ;
2320
- }
2321
2290
default : {
2322
2291
break ;
2323
2292
}
@@ -2425,6 +2394,24 @@ LOGGING:
2425
2394
}
2426
2395
};
2427
2396
2397
+ function convertJmp(text : string ): string {
2398
+ return text .replace (
2399
+ / \/ jmp ([^ |] + )\| href="([^ "] + )"\/ jmp\* / g ,
2400
+ (_match , url , encodedHref ) => {
2401
+ const decodedHref = decodeURIComponent (encodedHref );
2402
+
2403
+ const className = decodedHref .startsWith (' mailto' )
2404
+ ? ' email-link'
2405
+ : decodedHref .startsWith (' tel' )
2406
+ ? ' tel-link'
2407
+ : ' web-link' ;
2408
+ const attributes =
2409
+ className === ' web-link' ? ' target="_blank" rel="noreferrer"' : ' ' ;
2410
+ return ` <a ${attributes } class="${className }" href="${decodedHref }">${url }</a> ` ;
2411
+ }
2412
+ );
2413
+ }
2414
+
2428
2415
function videosForChapter(docSet : string , bookCode : string , chapter : string ) {
2429
2416
let collection = docSet .split (' _' )[1 ];
2430
2417
let videos = config .videos ?.filter (
0 commit comments