twl-generator 1.4.10 → 1.4.11
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "twl-generator",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.11",
|
|
4
4
|
"description": "Generate term-to-article lists from unfoldingWord en_tw archive for Bible books. Works in both Node.js (CLI) and React.js (browser) environments.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
"csv-stringify": "^6.5.0",
|
|
52
52
|
"en-inflectors": "^1.0.12",
|
|
53
53
|
"jszip": "^3.10.1",
|
|
54
|
-
"tsv-quote-converters": "^1.1.14"
|
|
54
|
+
"tsv-quote-converters": "^1.1.14",
|
|
55
|
+
"usfm-alignment-remover": "^0.1.6"
|
|
55
56
|
},
|
|
56
57
|
"peerDependencies": {
|
|
57
58
|
"react": ">=16.8.0"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-async-promise-executor, no-throw-literal */
|
|
2
2
|
|
|
3
3
|
import { BibleBookData } from '../common/books.js';
|
|
4
|
+
import { removeAlignments } from 'usfm-alignment-remover';
|
|
4
5
|
|
|
5
6
|
// Environment detection
|
|
6
7
|
const isNode = typeof window === 'undefined' && typeof process !== 'undefined' && process.versions?.node;
|
|
@@ -26,16 +27,7 @@ function decodeBase64(base64String) {
|
|
|
26
27
|
export const removeAllTagsExceptChapterVerse = (usfmContent) => {
|
|
27
28
|
if (!usfmContent) return '';
|
|
28
29
|
|
|
29
|
-
let cleanContent = usfmContent;
|
|
30
|
-
|
|
31
|
-
// Remove word-level alignment markers like \w word|lemma="lemma" strong="H1234"\w*
|
|
32
|
-
cleanContent = cleanContent.replace(/\\w\s+([^|\\]+)\|[^\\]*\\w\*/g, '$1');
|
|
33
|
-
|
|
34
|
-
// Remove milestone markers like \zaln-s | \zaln-e\*
|
|
35
|
-
cleanContent = cleanContent.replace(/\\zaln-[se][^\\]*\\?\*?/g, '');
|
|
36
|
-
|
|
37
|
-
// Remove other alignment-related markers
|
|
38
|
-
cleanContent = cleanContent.replace(/\\k-[se][^\\]*\\?\*?/g, '');
|
|
30
|
+
let cleanContent = removeAlignments(usfmContent);
|
|
39
31
|
|
|
40
32
|
// Remove empty lines that might result from marker removal
|
|
41
33
|
cleanContent = cleanContent.replace(/\n\s*\n\s*\n/g, '\n\n');
|