usfm2html 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +6 -11
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -27,6 +27,7 @@ const renderFlags = {
|
|
|
27
27
|
showCharacterMarkup: true,
|
|
28
28
|
showParaStyles: true,
|
|
29
29
|
selectedBcvNotes: [],
|
|
30
|
+
showFirstVerseLabel: true,
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
const extraCss = `
|
|
@@ -447,6 +448,10 @@ p.paras_usfm_q:has(> .marks_chapter_label) {
|
|
|
447
448
|
.implied-word-end {
|
|
448
449
|
display: none;
|
|
449
450
|
}
|
|
451
|
+
|
|
452
|
+
section.chapters {
|
|
453
|
+
margin-left: 20px;
|
|
454
|
+
}
|
|
450
455
|
`;
|
|
451
456
|
|
|
452
457
|
const buildCss = () => {
|
|
@@ -469,16 +474,6 @@ const parseHtml = (html, book, titleText, showChapters = true) => {
|
|
|
469
474
|
const safeTitle = escapeAttribute(rawTitle);
|
|
470
475
|
let updated = html.replace(/<p /, `<p id="nav-${book}" `);
|
|
471
476
|
|
|
472
|
-
updated = updated.replaceAll(
|
|
473
|
-
/<span id="chapter-(\d+)-verse-(\d+)"([^>]*)>(\d+)<\/span>/g,
|
|
474
|
-
`<span id="nav-${book}-$1-$2"$3><a href="#nav-${book}-$1-$2" class="header-link">$4</a></span>`
|
|
475
|
-
);
|
|
476
|
-
|
|
477
|
-
updated = updated.replaceAll(
|
|
478
|
-
/<span id="chapter-(\d+)"([^>]+)>([\d]+)<\/span>/gi,
|
|
479
|
-
`<span id="nav-${book}-$1"${showChapters && safeTitle ? ` data-toc-title="${safeTitle} $1"` : ''}$2><a href="#nav-${book}-$1-1" class="header-link">$3</a></span>`
|
|
480
|
-
);
|
|
481
|
-
|
|
482
477
|
updated = updated.replace(/<span([^>]+style="[^">]+#CCC[^">]+")/gi, '<span$1 class="footnote"');
|
|
483
478
|
updated = updated.replace(/[\u00A0\u202F\u2009 ]+/g, ' ');
|
|
484
479
|
updated = updated.replace(/(\d{1,3})(?:\s*,\s*\d{3})+\b/g, (m) => m.replace(/\s*,\s*/g, ','));
|
|
@@ -492,7 +487,7 @@ const parseHtml = (html, book, titleText, showChapters = true) => {
|
|
|
492
487
|
});
|
|
493
488
|
}
|
|
494
489
|
|
|
495
|
-
return
|
|
490
|
+
return updated;
|
|
496
491
|
};
|
|
497
492
|
|
|
498
493
|
const normalizeUsfm = (usfm) => {
|