proskomma-core 0.9.7 → 0.9.12
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/.eslintrc.json +79 -0
- package/.gitattributes +2 -0
- package/babel.config.js +18 -0
- package/docs/_config.yml +1 -0
- package/docs/index.md +3 -0
- package/docs/pk_edit_0_9.odt +0 -0
- package/docs/pk_edit_0_9.pdf +0 -0
- package/docs/proskomma_101_slideshow.odp +0 -0
- package/docs/proskomma_101_slideshow.pdf +0 -0
- package/docs/proskomma_edit_html.png +0 -0
- package/docs/proskomma_edit_html.svg +451 -0
- package/docs/proskomma_edit_reference.png +0 -0
- package/docs/proskomma_edit_reference.svg +349 -0
- package/docs/repo_logo.png +0 -0
- package/esm/package.json +3 -0
- package/esm/wrapper.mjs +5 -0
- package/index.js +6 -0
- package/package.json +19 -17
- package/src/graph/index.cjs +201 -0
- package/src/graph/lib/do_cv.cjs +249 -0
- package/src/graph/lib/dump.cjs +40 -0
- package/src/graph/lib/remake_blocks.cjs +57 -0
- package/src/graph/lib/sequence_chars.cjs +84 -0
- package/src/graph/lib/sort.cjs +39 -0
- package/src/graph/lib/tribos.cjs +97 -0
- package/src/graph/lib/tribos_expression.cjs +556 -0
- package/src/graph/lib/tribos_ohm_UNUSED.cjs +37 -0
- package/src/graph/lib/tribos_step.cjs +434 -0
- package/src/graph/mutations/add.cjs +91 -0
- package/src/graph/mutations/delete.cjs +61 -0
- package/src/graph/mutations/index.cjs +54 -0
- package/src/graph/mutations/rehash.cjs +17 -0
- package/src/graph/mutations/tags.cjs +120 -0
- package/src/graph/mutations/update.cjs +210 -0
- package/src/graph/mutations/versification.cjs +96 -0
- package/src/graph/queries/block.cjs +228 -0
- package/src/graph/queries/cIndex.cjs +87 -0
- package/src/graph/queries/cell.cjs +42 -0
- package/src/graph/queries/cv.cjs +19 -0
- package/src/graph/queries/cvBook.cjs +16 -0
- package/src/graph/queries/cvChapter.cjs +16 -0
- package/src/graph/queries/cvIndex.cjs +47 -0
- package/src/graph/queries/cvNavigation.cjs +116 -0
- package/src/graph/queries/cvVerseElement.cjs +84 -0
- package/src/graph/queries/cvVerses.cjs +14 -0
- package/src/graph/queries/doc_set.cjs +220 -0
- package/src/graph/queries/document.cjs +555 -0
- package/src/graph/queries/idParts.cjs +30 -0
- package/src/graph/queries/index.cjs +151 -0
- package/src/graph/queries/inputBlockSpec.cjs +17 -0
- package/src/graph/queries/inputItemObject.cjs +12 -0
- package/src/graph/queries/input_att_spec.cjs +14 -0
- package/src/graph/queries/input_key_matches.cjs +11 -0
- package/src/graph/queries/input_key_value.cjs +11 -0
- package/src/graph/queries/input_key_values.cjs +11 -0
- package/src/graph/queries/input_selector_spec.cjs +19 -0
- package/src/graph/queries/item.cjs +71 -0
- package/src/graph/queries/itemGroup.cjs +75 -0
- package/src/graph/queries/key_value.cjs +18 -0
- package/src/graph/queries/kv_entry.cjs +21 -0
- package/src/graph/queries/kv_sequence.cjs +151 -0
- package/src/graph/queries/node.cjs +44 -0
- package/src/graph/queries/orig.cjs +11 -0
- package/src/graph/queries/regex_index.cjs +18 -0
- package/src/graph/queries/row_equals_spec.cjs +11 -0
- package/src/graph/queries/row_match_spec.cjs +11 -0
- package/src/graph/queries/selector_spec.cjs +29 -0
- package/src/graph/queries/sequence.cjs +314 -0
- package/src/graph/queries/table_sequence.cjs +192 -0
- package/src/graph/queries/tree_sequence.cjs +58 -0
- package/src/graph/queries/verseNumber.cjs +44 -0
- package/src/graph/queries/verseRange.cjs +11 -0
- package/src/graph/queries/versification.cjs +25 -0
- package/src/index.cjs +583 -0
- package/src/model/doc_set.cjs +389 -0
- package/src/model/doc_set_helpers/block.cjs +232 -0
- package/src/model/doc_set_helpers/enum.cjs +87 -0
- package/src/model/doc_set_helpers/item.cjs +198 -0
- package/src/model/doc_set_helpers/rehash.cjs +53 -0
- package/src/model/doc_set_helpers/selectors.cjs +58 -0
- package/src/model/doc_set_helpers/serialize.cjs +22 -0
- package/src/model/doc_set_helpers/unsuccinctify.cjs +288 -0
- package/src/model/doc_set_helpers/update.cjs +290 -0
- package/src/model/document.cjs +369 -0
- package/src/model/document_helpers/blocks.cjs +135 -0
- package/src/model/document_helpers/chapter_verse.cjs +291 -0
- package/src/model/document_helpers/pre_enums.cjs +67 -0
- package/src/model/document_helpers/sequences.cjs +205 -0
- package/src/model/document_helpers/serialize_succinct.cjs +55 -0
- package/src/model/document_helpers/succinct_filter.cjs +102 -0
- package/src/model/versifications/eng_vrs.cjs +455 -0
- package/src/model/versifications/index.cjs +38 -0
- package/src/model/versifications/lxx_vrs.cjs +950 -0
- package/src/model/versifications/org_vrs.cjs +155 -0
- package/src/model/versifications/rsc_vrs.cjs +342 -0
- package/src/model/versifications/rso_vrs.cjs +541 -0
- package/src/model/versifications/vul_vrs.cjs +835 -0
- package/src/parser/index.cjs +506 -0
- package/src/parser/lexers/index.cjs +11 -0
- package/src/parser/lexers/lexingRegexes.cjs +45 -0
- package/src/parser/lexers/nodes.cjs +123 -0
- package/src/parser/lexers/object_for_fragment.cjs +123 -0
- package/src/parser/lexers/tsv.cjs +45 -0
- package/src/parser/lexers/usfm.cjs +17 -0
- package/src/parser/lexers/usx/index.cjs +7 -0
- package/src/parser/lexers/usx/usx_lexer.cjs +321 -0
- package/src/parser/lib/tokenize.cjs +37 -0
- package/src/parser/model/index.cjs +637 -0
- package/src/parser/parser_specs.cjs +781 -0
- package/src/pipelines/perf2x/index.cjs +7 -0
- package/src/pipelines/perf2x/perf2PkJsonPipeline.json +41 -0
- package/src/pipelines/perf2x/perf2usfmPipeline.json +65 -0
- package/src/transforms/calculateUsfmChapterPositions.cjs +106 -0
- package/src/transforms/index.cjs +9 -0
- package/src/transforms/perf2PkJson.cjs +534 -0
- package/src/transforms/perf2usfm.cjs +294 -0
- package/src/util/byteArray.cjs +251 -0
- package/src/util/canons.cjs +117 -0
- package/src/util/enums.cjs +41 -0
- package/src/util/generateId.cjs +6 -0
- package/src/util/graftDefs.cjs +15 -0
- package/src/util/index.cjs +29 -0
- package/src/util/inspectSuccinct.cjs +59 -0
- package/src/util/itemDefs.cjs +33 -0
- package/src/util/parserConstantDefs.cjs +30 -0
- package/src/util/scopeDefs.cjs +173 -0
- package/src/util/scriptlike/blocksSpec.cjs +192 -0
- package/src/util/scriptlike/dodson_lexicon.xsl +19 -0
- package/src/util/scriptlike/dodson_lexicon_to_entries.cjs +85 -0
- package/src/util/scriptlike/open_scriptures_hebrew_lexicon.xsl +28 -0
- package/src/util/scriptlike/open_scriptures_hebrew_lexicon_to_entries.cjs +85 -0
- package/src/util/succinct.cjs +159 -0
- package/src/util/tags.cjs +28 -0
- package/src/util/tokenDefs.cjs +27 -0
- package/src/util/versification.cjs +364 -0
- package/test/code/main/bad.cjs +79 -0
- package/test/code/main/basics.cjs +534 -0
- package/test/code/main/block.cjs +586 -0
- package/test/code/main/block_scope_numbers.cjs +31 -0
- package/test/code/main/blocks_with_atts.cjs +150 -0
- package/test/code/main/blocks_with_cv.cjs +250 -0
- package/test/code/main/break.cjs +73 -0
- package/test/code/main/checksum.cjs +36 -0
- package/test/code/main/cl_global.cjs +35 -0
- package/test/code/main/class_for_fragment.cjs +18 -0
- package/test/code/main/clean_usfm.cjs +46 -0
- package/test/code/main/cp_vp.cjs +158 -0
- package/test/code/main/custom.cjs +124 -0
- package/test/code/main/cv.cjs +249 -0
- package/test/code/main/cvMatching.cjs +155 -0
- package/test/code/main/cv_indexes.cjs +189 -0
- package/test/code/main/cv_navigation.cjs +124 -0
- package/test/code/main/document.cjs +382 -0
- package/test/code/main/empty_blocks.cjs +71 -0
- package/test/code/main/entries.cjs +402 -0
- package/test/code/main/export_lexing_regexes.cjs +19 -0
- package/test/code/main/fig.cjs +67 -0
- package/test/code/main/filter.cjs +222 -0
- package/test/code/main/glossary.cjs +36 -0
- package/test/code/main/graft_headings.cjs +36 -0
- package/test/code/main/graft_introduction.cjs +96 -0
- package/test/code/main/graft_note.cjs +104 -0
- package/test/code/main/graft_rems.cjs +34 -0
- package/test/code/main/graft_sidebars.cjs +62 -0
- package/test/code/main/graft_title.cjs +36 -0
- package/test/code/main/hello.cjs +105 -0
- package/test/code/main/import_document.cjs +22 -0
- package/test/code/main/import_usfm_int.cjs +48 -0
- package/test/code/main/item_groups.cjs +133 -0
- package/test/code/main/items_with_cv.cjs +311 -0
- package/test/code/main/milestone_attributes.cjs +163 -0
- package/test/code/main/mixed_sequence_documents.cjs +137 -0
- package/test/code/main/mixed_sequences.cjs +217 -0
- package/test/code/main/modify_sequence.cjs +29 -0
- package/test/code/main/multiple_chapters.cjs +58 -0
- package/test/code/main/multiple_content.cjs +105 -0
- package/test/code/main/mutate_add.cjs +180 -0
- package/test/code/main/mutate_delete.cjs +236 -0
- package/test/code/main/mutate_rehash.cjs +68 -0
- package/test/code/main/mutate_tags.cjs +90 -0
- package/test/code/main/mutate_update.cjs +538 -0
- package/test/code/main/selectors.cjs +289 -0
- package/test/code/main/sequence.cjs +361 -0
- package/test/code/main/serialize.cjs +104 -0
- package/test/code/main/spans.cjs +51 -0
- package/test/code/main/split_long_tokens.cjs +30 -0
- package/test/code/main/standard_vrs.cjs +76 -0
- package/test/code/main/subclass.cjs +25 -0
- package/test/code/main/table.cjs +119 -0
- package/test/code/main/tags.cjs +248 -0
- package/test/code/main/token_alignment.cjs +84 -0
- package/test/code/main/trees.cjs +211 -0
- package/test/code/main/tribos.cjs +865 -0
- package/test/code/main/tsv.cjs +385 -0
- package/test/code/main/usx_ref.cjs +65 -0
- package/test/code/main/verse_mapping.cjs +252 -0
- package/test/code/main/verse_range.cjs +31 -0
- package/test/code/main/word_likes.cjs +41 -0
- package/test/code/utils/byte_array.cjs +271 -0
- package/test/code/utils/canons.cjs +20 -0
- package/test/code/utils/generate_id.cjs +17 -0
- package/test/code/utils/graft_defs.cjs +16 -0
- package/test/code/utils/inspect.cjs +130 -0
- package/test/code/utils/items.cjs +56 -0
- package/test/code/utils/push_succinct.cjs +69 -0
- package/test/code/utils/scope_defs.cjs +79 -0
- package/test/code/utils/serialize.cjs +28 -0
- package/test/code/utils/splice.cjs +67 -0
- package/test/code/utils/tags.cjs +69 -0
- package/test/code/utils/versification.cjs +249 -0
- package/test/lib/load.js +110 -0
- package/test/skipped_code/diff.js +53 -0
- package/test/test_data/inputBlockSpec/dodson.json +1654 -0
- package/test/test_data/inputBlockSpec/kv.json +326 -0
- package/test/test_data/inputBlockSpec/mk1.json +1019 -0
- package/test/test_data/inputBlockSpec/table.json +170 -0
- package/test/test_data/tree/genealogy.json +55 -0
- package/test/test_data/tree/jude.json +15965 -0
- package/test/test_data/tsv/en_tn_66-JUD.tsv +75 -0
- package/test/test_data/tsv/twl_JUD.tsv +144 -0
- package/test/test_data/usfm/1pe_webbe.usfm +13 -0
- package/test/test_data/usfm/66-JUD-ust.usfm +1089 -0
- package/test/test_data/usfm/78-GALspavbl.usfm +10 -0
- package/test/test_data/usfm/add_test.usfm +15 -0
- package/test/test_data/usfm/backslash.usfm +4 -0
- package/test/test_data/usfm/cl.usfm +14 -0
- package/test/test_data/usfm/cp_vp.usfm +8 -0
- package/test/test_data/usfm/custom.usfm +13 -0
- package/test/test_data/usfm/en_ust_oba.usfm +875 -0
- package/test/test_data/usfm/en_ust_psa_1.usfm +20 -0
- package/test/test_data/usfm/fig.usfm +3 -0
- package/test/test_data/usfm/filter.usfm +7 -0
- package/test/test_data/usfm/footnote.usfm +11 -0
- package/test/test_data/usfm/frt.usfm +4 -0
- package/test/test_data/usfm/headings.usfm +7 -0
- package/test/test_data/usfm/hello.usfm +8 -0
- package/test/test_data/usfm/int.usfm +7 -0
- package/test/test_data/usfm/milestone_attributes.usfm +7 -0
- package/test/test_data/usfm/milestone_attributes_default.usfm +7 -0
- package/test/test_data/usfm/no_break_space.usfm +4 -0
- package/test/test_data/usfm/no_mt.usfm +6 -0
- package/test/test_data/usfm/rems.usfm +6 -0
- package/test/test_data/usfm/section_intros.usfm +26 -0
- package/test/test_data/usfm/sidebars.usfm +25 -0
- package/test/test_data/usfm/slash_in_att.usfm +6 -0
- package/test/test_data/usfm/soft_line_break.usfm +4 -0
- package/test/test_data/usfm/spans.usfm +5 -0
- package/test/test_data/usfm/split_long_tokens.usfm +6 -0
- package/test/test_data/usfm/table.usfm +18 -0
- package/test/test_data/usfm/table_at_end.usfm +11 -0
- package/test/test_data/usfm/table_in_intro.usfm +22 -0
- package/test/test_data/usfm/table_no_end_cells.usfm +18 -0
- package/test/test_data/usfm/tit_kitchen_sink.usfm +73 -0
- package/test/test_data/usfm/titus_template.usfm +58 -0
- package/test/test_data/usfm/ugnt_3jn.usfm +265 -0
- package/test/test_data/usfm/ult_3jn.usfm +335 -0
- package/test/test_data/usfm/unknown.usfm +5 -0
- package/test/test_data/usfm/ust_psa.usfm +29 -0
- package/test/test_data/usfm/ust_psa_verse_ranges.usfm +24 -0
- package/test/test_data/usfm/ust_psa_with_ts.usfm +29 -0
- package/test/test_data/usfm/verse_breaks_in_blocks.usfm +20 -0
- package/test/test_data/usfm/verse_range.usfm +7 -0
- package/test/test_data/usfm/web_ecc.usfm +391 -0
- package/test/test_data/usfm/web_psa51.usfm +71 -0
- package/test/test_data/usfm/whitespace.usfm +12 -0
- package/test/test_data/usfm/xref.usfm +11 -0
- package/test/test_data/usx/bad_element.usx +2 -0
- package/test/test_data/usx/cp_vp.usx +12 -0
- package/test/test_data/usx/diff1.usx +59 -0
- package/test/test_data/usx/diff2.usx +74 -0
- package/test/test_data/usx/douay_rheims_ecc.usx +58 -0
- package/test/test_data/usx/douay_rheims_psa.usx +5366 -0
- package/test/test_data/usx/douay_rheims_psa_40_60.usx +666 -0
- package/test/test_data/usx/douay_rheims_rut.usx +26 -0
- package/test/test_data/usx/esg3.usx +47 -0
- package/test/test_data/usx/fig.usx +6 -0
- package/test/test_data/usx/milestone_attributes.usx +11 -0
- package/test/test_data/usx/not_nfc18_glo.usx +9 -0
- package/test/test_data/usx/not_nfc18_phm.usx +24 -0
- package/test/test_data/usx/opt_break.usx +10 -0
- package/test/test_data/usx/sidebars.usx +29 -0
- package/test/test_data/usx/table.usx +23 -0
- package/test/test_data/usx/web_psa.usx +8489 -0
- package/test/test_data/usx/web_psa150.usx +33 -0
- package/test/test_data/usx/web_psa_40_60.usx +1079 -0
- package/test/test_data/usx/web_rut.usx +95 -0
- package/test/test_data/usx/web_rut_1.usx +17 -0
- package/test/test_data/utils/douay_rheims.vrs +520 -0
- package/test/test_data/utils/douay_rheims_PSA.usx +5366 -0
- package/test/test_data/utils/serialize_example.json +91 -0
- package/test/test_data/utils/truncated_versification.vrs +29 -0
- package/test/test_data/utils/web_rut_items.json +2977 -0
- package/test/test_data/utils/webbe.vrs +395 -0
- package/test/test_data/utils/webbe_PSA.usx +8489 -0
- package/test/test_data/vrs/douay_rheims.vrs +520 -0
- package/test/test_data/vrs/truncated_versification.vrs +27 -0
- package/test/test_data/vrs/webbe.vrs +397 -0
- package/webpack.prod.js +50 -0
- package/dist/index.js +0 -8
- package/dist/index.js.LICENSE.txt +0 -23
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
const test = require('tape');
|
|
2
|
+
|
|
3
|
+
const { pkWithDoc } = require('../../lib/load.js');
|
|
4
|
+
|
|
5
|
+
const testGroup = 'Blocks with Atts';
|
|
6
|
+
|
|
7
|
+
const pk = pkWithDoc('../test_data/usfm/1pe_webbe.usfm', {
|
|
8
|
+
lang: 'eng',
|
|
9
|
+
abbr: 'hello',
|
|
10
|
+
})[0];
|
|
11
|
+
|
|
12
|
+
test(
|
|
13
|
+
`attSpecs + !attValues (${testGroup})`,
|
|
14
|
+
async function (t) {
|
|
15
|
+
try {
|
|
16
|
+
t.plan(2);
|
|
17
|
+
const query =
|
|
18
|
+
'{ docSets { document(bookCode:"1PE") {' +
|
|
19
|
+
' mainSequence {' +
|
|
20
|
+
' blocks(' +
|
|
21
|
+
' attSpecs: [[{attType:"spanWithAtts", tagName:"w", attKey:"strongs", valueN:0}]]' +
|
|
22
|
+
' ) {' +
|
|
23
|
+
' cBL' +
|
|
24
|
+
' }' +
|
|
25
|
+
' }' +
|
|
26
|
+
' }' +
|
|
27
|
+
' }' +
|
|
28
|
+
'}';
|
|
29
|
+
const result = await pk.gqlQuery(query);
|
|
30
|
+
t.equal(result.errors.length, 1);
|
|
31
|
+
t.ok(result.errors[0].message.includes('Cannot specify attSpecs without attValues'));
|
|
32
|
+
} catch (err) {
|
|
33
|
+
console.log(err);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
test(
|
|
39
|
+
`!attSpecs + attValues (${testGroup})`,
|
|
40
|
+
async function (t) {
|
|
41
|
+
try {
|
|
42
|
+
t.plan(2);
|
|
43
|
+
const query =
|
|
44
|
+
'{ docSets { document(bookCode:"1PE") {' +
|
|
45
|
+
' mainSequence {' +
|
|
46
|
+
' blocks(' +
|
|
47
|
+
' attValues:[["H5662"]]' +
|
|
48
|
+
' ) {' +
|
|
49
|
+
' cBL' +
|
|
50
|
+
' }' +
|
|
51
|
+
' }' +
|
|
52
|
+
' }' +
|
|
53
|
+
' }' +
|
|
54
|
+
'}';
|
|
55
|
+
const result = await pk.gqlQuery(query);
|
|
56
|
+
t.equal(result.errors.length, 1);
|
|
57
|
+
t.ok(result.errors[0].message.includes('Cannot specify attValues without attSpecs'));
|
|
58
|
+
} catch (err) {
|
|
59
|
+
console.log(err);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
test(
|
|
65
|
+
`Filter by att (${testGroup})`,
|
|
66
|
+
async function (t) {
|
|
67
|
+
try {
|
|
68
|
+
t.plan(2);
|
|
69
|
+
const query =
|
|
70
|
+
'{ docSets { document(bookCode:"1PE") {' +
|
|
71
|
+
' mainSequence {' +
|
|
72
|
+
' blocks(' +
|
|
73
|
+
' attSpecs: [[{attType:"spanWithAtts", tagName:"w", attKey:"strong", valueN:0}]]' +
|
|
74
|
+
' attValues:[["G2587"]]' +
|
|
75
|
+
' ) {' +
|
|
76
|
+
' cBL' +
|
|
77
|
+
' }' +
|
|
78
|
+
' }' +
|
|
79
|
+
' }' +
|
|
80
|
+
' }' +
|
|
81
|
+
'}';
|
|
82
|
+
const result = await pk.gqlQuery(query);
|
|
83
|
+
t.equal(result.errors, undefined);
|
|
84
|
+
t.equal(result.data.docSets[0].document.mainSequence.blocks.length, 1);
|
|
85
|
+
} catch (err) {
|
|
86
|
+
console.log(err);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
test(
|
|
92
|
+
`Any matching att (${testGroup})`,
|
|
93
|
+
async function (t) {
|
|
94
|
+
try {
|
|
95
|
+
t.plan(2);
|
|
96
|
+
const query =
|
|
97
|
+
'{ docSets { document(bookCode:"1PE") {' +
|
|
98
|
+
' mainSequence {' +
|
|
99
|
+
' blocks(' +
|
|
100
|
+
' attSpecs: [' +
|
|
101
|
+
' [{attType:"spanWithAtts", tagName:"w", attKey:"strong", valueN:0}],' +
|
|
102
|
+
' [{attType:"spanWithAtts", tagName:"w", attKey:"strong", valueN:0}]' +
|
|
103
|
+
' ]' +
|
|
104
|
+
' attValues:[["G2587"], ["G2962"]]' +
|
|
105
|
+
' ) {' +
|
|
106
|
+
' cBL' +
|
|
107
|
+
' }' +
|
|
108
|
+
' }' +
|
|
109
|
+
' }' +
|
|
110
|
+
' }' +
|
|
111
|
+
'}';
|
|
112
|
+
const result = await pk.gqlQuery(query);
|
|
113
|
+
t.equal(result.errors, undefined);
|
|
114
|
+
t.equal(result.data.docSets[0].document.mainSequence.blocks.length, 2);
|
|
115
|
+
} catch (err) {
|
|
116
|
+
console.log(err);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
test(
|
|
122
|
+
`All matching atts (${testGroup})`,
|
|
123
|
+
async function (t) {
|
|
124
|
+
try {
|
|
125
|
+
t.plan(2);
|
|
126
|
+
const query =
|
|
127
|
+
'{ docSets { document(bookCode:"1PE") {' +
|
|
128
|
+
' mainSequence {' +
|
|
129
|
+
' blocks(' +
|
|
130
|
+
' attSpecs: [' +
|
|
131
|
+
' [{attType:"spanWithAtts", tagName:"w", attKey:"strong", valueN:0}],' +
|
|
132
|
+
' [{attType:"spanWithAtts", tagName:"w", attKey:"strong", valueN:0}]' +
|
|
133
|
+
' ]' +
|
|
134
|
+
' attValues:[["G2532", "G9999"], ["G1519", "G0000"]]' +
|
|
135
|
+
' allAtts:true' +
|
|
136
|
+
' ) {' +
|
|
137
|
+
' cBL' +
|
|
138
|
+
' }' +
|
|
139
|
+
' }' +
|
|
140
|
+
' }' +
|
|
141
|
+
' }' +
|
|
142
|
+
'}';
|
|
143
|
+
const result = await pk.gqlQuery(query);
|
|
144
|
+
t.equal(result.errors, undefined);
|
|
145
|
+
t.equal(result.data.docSets[0].document.mainSequence.blocks.length, 1);
|
|
146
|
+
} catch (err) {
|
|
147
|
+
console.log(err);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
);
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
const test = require('tape');
|
|
2
|
+
|
|
3
|
+
const { pkWithDoc } = require('../../lib/load.js');
|
|
4
|
+
|
|
5
|
+
const testGroup = 'Blocks with CV';
|
|
6
|
+
|
|
7
|
+
const pk = pkWithDoc('../test_data/usx/web_rut.usx', {
|
|
8
|
+
lang: 'fra',
|
|
9
|
+
abbr: 'hello',
|
|
10
|
+
})[0];
|
|
11
|
+
|
|
12
|
+
const pk2 = pkWithDoc('../test_data/usx/web_psa_40_60.usx', {
|
|
13
|
+
lang: 'eng',
|
|
14
|
+
abbr: 'web',
|
|
15
|
+
})[0];
|
|
16
|
+
|
|
17
|
+
test(
|
|
18
|
+
`Bad bookScope (${testGroup})`,
|
|
19
|
+
async function (t) {
|
|
20
|
+
try {
|
|
21
|
+
t.plan(2);
|
|
22
|
+
const query =
|
|
23
|
+
'{ docSets { document(bookCode:"RUT") {' +
|
|
24
|
+
' mainSequence { blocks(withScriptureCV:2) { cBL } } } }' +
|
|
25
|
+
'}';
|
|
26
|
+
const result = await pk.gqlQuery(query);
|
|
27
|
+
t.equal(result.errors.length, 1);
|
|
28
|
+
t.equal(result.errors.filter(e => e.message.includes('cannot represent a non string value: 2')).length, 1);
|
|
29
|
+
} catch (err) {
|
|
30
|
+
console.log(err);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
test(
|
|
36
|
+
`bookScope + withScopes (${testGroup})`,
|
|
37
|
+
async function (t) {
|
|
38
|
+
try {
|
|
39
|
+
t.plan(2);
|
|
40
|
+
const query =
|
|
41
|
+
'{ docSets { document(bookCode:"RUT") {' +
|
|
42
|
+
' mainSequence { blocks(withScriptureCV:"2" withScopes:[]) { cBL } } } }' +
|
|
43
|
+
'}';
|
|
44
|
+
const result = await pk.gqlQuery(query);
|
|
45
|
+
t.equal(result.errors.length, 1);
|
|
46
|
+
t.ok(result.errors[0].message.includes('Cannot specify both withScopes and withScriptureCV'));
|
|
47
|
+
} catch (err) {
|
|
48
|
+
console.log(err);
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
test(
|
|
54
|
+
`One chapter (${testGroup})`,
|
|
55
|
+
async function (t) {
|
|
56
|
+
try {
|
|
57
|
+
t.plan(3);
|
|
58
|
+
const query =
|
|
59
|
+
'{ docSets { document(bookCode:"RUT") {' +
|
|
60
|
+
' mainSequence { blocks(withScriptureCV:"2") { text } } } }' +
|
|
61
|
+
'}';
|
|
62
|
+
const result = await pk.gqlQuery(query);
|
|
63
|
+
t.equal(result.errors, undefined);
|
|
64
|
+
const blocks = result.data.docSets[0].document.mainSequence.blocks;
|
|
65
|
+
t.ok(blocks[0].text.startsWith('Naomi had a relative of her husband'));
|
|
66
|
+
t.ok(blocks[blocks.length - 1].text.endsWith('lived with her mother-in-law.'));
|
|
67
|
+
} catch (err) {
|
|
68
|
+
console.log(err);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
test(
|
|
74
|
+
`Chapter range (${testGroup})`,
|
|
75
|
+
async function (t) {
|
|
76
|
+
try {
|
|
77
|
+
t.plan(3);
|
|
78
|
+
const query =
|
|
79
|
+
'{ docSets { document(bookCode:"RUT") {' +
|
|
80
|
+
' mainSequence { blocks(withScriptureCV:"1-3") { text } } } }' +
|
|
81
|
+
'}';
|
|
82
|
+
const result = await pk.gqlQuery(query);
|
|
83
|
+
t.equal(result.errors, undefined);
|
|
84
|
+
const blocks = result.data.docSets[0].document.mainSequence.blocks;
|
|
85
|
+
t.ok(blocks[0].text.startsWith('In the days when the judges judged'));
|
|
86
|
+
t.ok(blocks[blocks.length - 1].text.endsWith('until he has settled this today.”'));
|
|
87
|
+
} catch (err) {
|
|
88
|
+
console.log(err);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
test(
|
|
94
|
+
`Reverse chapter range (${testGroup})`,
|
|
95
|
+
async function (t) {
|
|
96
|
+
try {
|
|
97
|
+
t.plan(2);
|
|
98
|
+
const query =
|
|
99
|
+
'{ docSets { document(bookCode:"RUT") {' +
|
|
100
|
+
' mainSequence { blocks(withScriptureCV:"3-1") { text } } } }' +
|
|
101
|
+
'}';
|
|
102
|
+
const result = await pk.gqlQuery(query);
|
|
103
|
+
t.equal(result.errors.length, 1);
|
|
104
|
+
t.ok(result.errors[0].message.includes('Chapter range must be from min to max'));
|
|
105
|
+
} catch (err) {
|
|
106
|
+
console.log(err);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
test(
|
|
112
|
+
`One verse (${testGroup})`,
|
|
113
|
+
async function (t) {
|
|
114
|
+
try {
|
|
115
|
+
t.plan(3);
|
|
116
|
+
const query =
|
|
117
|
+
'{ docSets { document(bookCode:"RUT") {' +
|
|
118
|
+
' mainSequence { blocks(withScriptureCV:"1:14") { text } } } }' +
|
|
119
|
+
'}';
|
|
120
|
+
const result = await pk.gqlQuery(query);
|
|
121
|
+
t.equal(result.errors, undefined);
|
|
122
|
+
const blocks = result.data.docSets[0].document.mainSequence.blocks;
|
|
123
|
+
t.ok(blocks[0].text.startsWith('They lifted up their voices'));
|
|
124
|
+
t.ok(blocks[blocks.length - 1].text.endsWith('Follow your sister-in-law.”'));
|
|
125
|
+
} catch (err) {
|
|
126
|
+
console.log(err);
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
test(
|
|
132
|
+
`Verse zero (${testGroup})`,
|
|
133
|
+
async function (t) {
|
|
134
|
+
try {
|
|
135
|
+
t.plan(3);
|
|
136
|
+
const query =
|
|
137
|
+
'{ docSets { document(bookCode:"PSA") {' +
|
|
138
|
+
' mainSequence { blocks(withScriptureCV:"51:0") { text } } } }' +
|
|
139
|
+
'}';
|
|
140
|
+
const result = await pk2.gqlQuery(query);
|
|
141
|
+
t.equal(result.errors, undefined);
|
|
142
|
+
const blocks = result.data.docSets[0].document.mainSequence.blocks;
|
|
143
|
+
t.ok(blocks[0].text.startsWith('For the Chief'));
|
|
144
|
+
t.ok(blocks[blocks.length - 1].text.endsWith('Bathsheba.'));
|
|
145
|
+
} catch (err) {
|
|
146
|
+
console.log(err);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
test(
|
|
152
|
+
`Verse range (${testGroup})`,
|
|
153
|
+
async function (t) {
|
|
154
|
+
try {
|
|
155
|
+
t.plan(3);
|
|
156
|
+
const query =
|
|
157
|
+
'{ docSets { document(bookCode:"RUT") {' +
|
|
158
|
+
' mainSequence { blocks(withScriptureCV:"1:10-13") { text } } } }' +
|
|
159
|
+
'}';
|
|
160
|
+
const result = await pk.gqlQuery(query);
|
|
161
|
+
t.equal(result.errors, undefined);
|
|
162
|
+
const blocks = result.data.docSets[0].document.mainSequence.blocks;
|
|
163
|
+
t.ok(blocks[0].text.startsWith('Then she kissed them'));
|
|
164
|
+
t.ok(blocks[blocks.length - 1].text.endsWith('hand has gone out against me.”'));
|
|
165
|
+
} catch (err) {
|
|
166
|
+
console.log(err);
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
test(
|
|
172
|
+
`Verse range from zero (${testGroup})`,
|
|
173
|
+
async function (t) {
|
|
174
|
+
try {
|
|
175
|
+
t.plan(3);
|
|
176
|
+
const query =
|
|
177
|
+
'{ docSets { document(bookCode:"PSA") {' +
|
|
178
|
+
' mainSequence { blocks(withScriptureCV:"51:0-1") { text } } } }' +
|
|
179
|
+
'}';
|
|
180
|
+
const result = await pk2.gqlQuery(query);
|
|
181
|
+
t.equal(result.errors, undefined);
|
|
182
|
+
const blocks = result.data.docSets[0].document.mainSequence.blocks;
|
|
183
|
+
t.ok(blocks[0].text.startsWith('For the Chief'));
|
|
184
|
+
t.ok(blocks[blocks.length - 1].text.endsWith('transgressions.'));
|
|
185
|
+
} catch (err) {
|
|
186
|
+
console.log(err);
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
test(
|
|
192
|
+
`Chapter/verse range (${testGroup})`,
|
|
193
|
+
async function (t) {
|
|
194
|
+
try {
|
|
195
|
+
t.plan(3);
|
|
196
|
+
const query =
|
|
197
|
+
'{ docSets { document(bookCode:"RUT") {' +
|
|
198
|
+
' mainSequence { blocks(withScriptureCV:"1:22-3:4") { text } } } }' +
|
|
199
|
+
'}';
|
|
200
|
+
const result = await pk.gqlQuery(query);
|
|
201
|
+
t.equal(result.errors, undefined);
|
|
202
|
+
const blocks = result.data.docSets[0].document.mainSequence.blocks;
|
|
203
|
+
t.ok(blocks[0].text.startsWith('She said to them,'));
|
|
204
|
+
t.ok(blocks[blocks.length - 1].text.endsWith('Then he will tell you what to do.”'));
|
|
205
|
+
} catch (err) {
|
|
206
|
+
console.log(err);
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
test(
|
|
212
|
+
`Chapter/verse range to verse 0 (${testGroup})`,
|
|
213
|
+
async function (t) {
|
|
214
|
+
try {
|
|
215
|
+
t.plan(3);
|
|
216
|
+
const query =
|
|
217
|
+
'{ docSets { document(bookCode:"PSA") {' +
|
|
218
|
+
' mainSequence { blocks(withScriptureCV:"50:23-51:0") { text } } } }' +
|
|
219
|
+
'}';
|
|
220
|
+
const result = await pk2.gqlQuery(query);
|
|
221
|
+
t.equal(result.errors, undefined);
|
|
222
|
+
const blocks = result.data.docSets[0].document.mainSequence.blocks;
|
|
223
|
+
t.ok(blocks[0].text.startsWith('Whoever offers'));
|
|
224
|
+
t.ok(blocks[blocks.length - 1].text.endsWith('Bathsheba.'));
|
|
225
|
+
} catch (err) {
|
|
226
|
+
console.log(err);
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
test(
|
|
232
|
+
`Chapter/verse range from verse 0 (${testGroup})`,
|
|
233
|
+
async function (t) {
|
|
234
|
+
try {
|
|
235
|
+
t.plan(3);
|
|
236
|
+
const query =
|
|
237
|
+
'{ docSets { document(bookCode:"PSA") {' +
|
|
238
|
+
' mainSequence { blocks(withScriptureCV:"51:0-52:1") { text } } } }' +
|
|
239
|
+
'}';
|
|
240
|
+
const result = await pk2.gqlQuery(query);
|
|
241
|
+
t.equal(result.errors, undefined);
|
|
242
|
+
const blocks = result.data.docSets[0].document.mainSequence.blocks;
|
|
243
|
+
t.ok(blocks[0].text.startsWith('For the Chief'));
|
|
244
|
+
t.ok(blocks[blocks.length - 1].text.endsWith('continually.'));
|
|
245
|
+
} catch (err) {
|
|
246
|
+
console.log(err);
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
);
|
|
250
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const test = require('tape');
|
|
2
|
+
|
|
3
|
+
const { pkWithDoc } = require('../../lib/load.js');
|
|
4
|
+
|
|
5
|
+
const testGroup = 'Lexing Breaks';
|
|
6
|
+
|
|
7
|
+
const pk = pkWithDoc('../test_data/usfm/no_break_space.usfm', {
|
|
8
|
+
lang: 'fra',
|
|
9
|
+
abbr: 'hello',
|
|
10
|
+
})[0];
|
|
11
|
+
const pk2 = pkWithDoc('../test_data/usfm/soft_line_break.usfm', {
|
|
12
|
+
lang: 'fra',
|
|
13
|
+
abbr: 'hello',
|
|
14
|
+
})[0];
|
|
15
|
+
const pk3 = pkWithDoc('../test_data/usx/opt_break.usx', {
|
|
16
|
+
lang: 'fra',
|
|
17
|
+
abbr: 'hello',
|
|
18
|
+
})[0];
|
|
19
|
+
|
|
20
|
+
test(
|
|
21
|
+
`NBSP (${testGroup})`,
|
|
22
|
+
async function (t) {
|
|
23
|
+
try {
|
|
24
|
+
t.plan(3);
|
|
25
|
+
const query = `{ documents { mainSequence { blocks { items {type subType payload} } } } }`;
|
|
26
|
+
const result = await pk.gqlQuery(query);
|
|
27
|
+
t.equal(result.errors, undefined);
|
|
28
|
+
const secondItem = result.data.documents[0].mainSequence.blocks[0].items[1];
|
|
29
|
+
t.equal(secondItem.subType, 'lineSpace');
|
|
30
|
+
t.equal(secondItem.payload, '\xa0');
|
|
31
|
+
} catch (err) {
|
|
32
|
+
console.log(err);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
test(
|
|
38
|
+
`Soft line break with USFM (${testGroup})`,
|
|
39
|
+
async function (t) {
|
|
40
|
+
try {
|
|
41
|
+
t.plan(3);
|
|
42
|
+
const query = `{ documents { mainSequence { blocks { items {type subType payload} } } } }`;
|
|
43
|
+
const result = await pk2.gqlQuery(query);
|
|
44
|
+
t.equal(result.errors, undefined);
|
|
45
|
+
const secondItem = result.data.documents[0].mainSequence.blocks[0].items[1];
|
|
46
|
+
t.equal(secondItem.subType, 'softLineBreak');
|
|
47
|
+
t.equal(secondItem.payload, '//');
|
|
48
|
+
} catch (err) {
|
|
49
|
+
console.log(err);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
test(
|
|
55
|
+
`Soft line break with USX (${testGroup})`,
|
|
56
|
+
async function (t) {
|
|
57
|
+
try {
|
|
58
|
+
t.plan(5);
|
|
59
|
+
const query = `{ documents { sequences { type blocks { items {type subType payload} } } } }`;
|
|
60
|
+
const result = await pk3.gqlQuery(query);
|
|
61
|
+
t.equal(result.errors, undefined);
|
|
62
|
+
const sequences = result.data.documents[0].sequences;
|
|
63
|
+
const headingSequence = sequences.filter(s => s.type === 'heading')[0];
|
|
64
|
+
t.equal(headingSequence.blocks[0].items[3].subType, 'softLineBreak');
|
|
65
|
+
t.equal(headingSequence.blocks[0].items[3].payload, '//');
|
|
66
|
+
const titleSequence = sequences.filter(s => s.type === 'title')[0];
|
|
67
|
+
t.equal(titleSequence.blocks[0].items[3].subType, 'softLineBreak');
|
|
68
|
+
t.equal(titleSequence.blocks[0].items[3].payload, '//');
|
|
69
|
+
} catch (err) {
|
|
70
|
+
console.log(err);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const test = require('tape');
|
|
2
|
+
|
|
3
|
+
const { pkWithDocs } = require('../../lib/load.js');
|
|
4
|
+
|
|
5
|
+
const testGroup = 'Checksum';
|
|
6
|
+
|
|
7
|
+
test(
|
|
8
|
+
`4 docs in 3 docSets (${testGroup})`,
|
|
9
|
+
function (t) {
|
|
10
|
+
try {
|
|
11
|
+
t.plan(1);
|
|
12
|
+
const pk = pkWithDocs([
|
|
13
|
+
['../test_data/usx/web_psa150.usx', {
|
|
14
|
+
lang: 'eng',
|
|
15
|
+
abbr: 'webbe',
|
|
16
|
+
}],
|
|
17
|
+
['../test_data/usx/web_rut.usx', {
|
|
18
|
+
lang: 'eng',
|
|
19
|
+
abbr: 'webbe',
|
|
20
|
+
}],
|
|
21
|
+
['../test_data/usfm/ust_psa.usfm', {
|
|
22
|
+
lang: 'eng',
|
|
23
|
+
abbr: 'ust',
|
|
24
|
+
}],
|
|
25
|
+
['../test_data/usx/not_nfc18_phm.usx', {
|
|
26
|
+
lang: 'eng',
|
|
27
|
+
abbr: 'nnfc18',
|
|
28
|
+
}],
|
|
29
|
+
]);
|
|
30
|
+
const cs = pk.checksum();
|
|
31
|
+
t.ok(cs);
|
|
32
|
+
} catch (err) {
|
|
33
|
+
console.log(err);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const test = require('tape');
|
|
2
|
+
|
|
3
|
+
const { pkWithDoc } = require('../../lib/load.js');
|
|
4
|
+
|
|
5
|
+
const testGroup = 'Global CL';
|
|
6
|
+
|
|
7
|
+
const [pk] = pkWithDoc('../test_data/usfm/cl.usfm', {
|
|
8
|
+
lang: 'eng',
|
|
9
|
+
abbr: 'ult',
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test(
|
|
13
|
+
`Global CL (${testGroup})`,
|
|
14
|
+
async function (t) {
|
|
15
|
+
try {
|
|
16
|
+
t.plan(5);
|
|
17
|
+
const query = '{ documents { headers { key value } sequences { type blocks { text } } } }';
|
|
18
|
+
const result = await pk.gqlQuery(query);
|
|
19
|
+
t.equal(result.errors, undefined);
|
|
20
|
+
const titleSequence = result.data.documents[0].sequences.filter(s => s.type === 'title')[0];
|
|
21
|
+
t.equal(titleSequence.blocks.length, 1);
|
|
22
|
+
t.equal(titleSequence.blocks[0].text, 'Psalms');
|
|
23
|
+
const headersArray = result.data.documents[0].headers;
|
|
24
|
+
const headers = {};
|
|
25
|
+
|
|
26
|
+
for (const header of headersArray) {
|
|
27
|
+
headers[header.key] = header.value;
|
|
28
|
+
}
|
|
29
|
+
t.ok('cl' in headers);
|
|
30
|
+
t.equal(headers.cl, 'Psalm');
|
|
31
|
+
} catch (err) {
|
|
32
|
+
console.log(err);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-disable require-await */
|
|
2
|
+
const test = require('tape');
|
|
3
|
+
const { preTokenClassForFragment } = require('../../../src/parser/lexers/object_for_fragment.cjs');
|
|
4
|
+
const { lexingRegexes } = require('../../../src/parser/lexers/lexingRegexes.cjs');
|
|
5
|
+
|
|
6
|
+
const testGroup = 'Class for Fragment';
|
|
7
|
+
|
|
8
|
+
test(
|
|
9
|
+
`Exception (${testGroup})`,
|
|
10
|
+
async function (t) {
|
|
11
|
+
try {
|
|
12
|
+
t.plan(1);
|
|
13
|
+
t.throws(() => preTokenClassForFragment('', lexingRegexes));
|
|
14
|
+
} catch (err) {
|
|
15
|
+
console.log(err);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* eslint-disable require-await */
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const test = require('tape');
|
|
4
|
+
const fse = require('fs-extra');
|
|
5
|
+
const { Proskomma } = require('../../../src/index.cjs');
|
|
6
|
+
|
|
7
|
+
const testGroup = 'cleanUSFM';
|
|
8
|
+
|
|
9
|
+
test(
|
|
10
|
+
`Remove chapters (${testGroup})`,
|
|
11
|
+
async function (t) {
|
|
12
|
+
try {
|
|
13
|
+
t.plan(2);
|
|
14
|
+
const pk = new Proskomma();
|
|
15
|
+
let fp = '../../test_data/usfm/frt.usfm';
|
|
16
|
+
let content = fse.readFileSync(path.resolve(__dirname, fp));
|
|
17
|
+
let cleanedLines = pk.cleanUsfm(content, { remove: ['\\c'] })
|
|
18
|
+
.split('\n')
|
|
19
|
+
.filter(l => l.length > 0);
|
|
20
|
+
t.equal(cleanedLines.length, 4);
|
|
21
|
+
t.equal(cleanedLines[1], '\\mt1 USFM');
|
|
22
|
+
} catch (err) {
|
|
23
|
+
console.log(err);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
test(
|
|
29
|
+
`Keep chapters (${testGroup})`,
|
|
30
|
+
async function (t) {
|
|
31
|
+
try {
|
|
32
|
+
t.plan(3);
|
|
33
|
+
const pk = new Proskomma();
|
|
34
|
+
let fp = '../../test_data/usfm/frt.usfm';
|
|
35
|
+
let content = fse.readFileSync(path.resolve(__dirname, fp));
|
|
36
|
+
let cleanedLines = pk.cleanUsfm(content)
|
|
37
|
+
.split('\n')
|
|
38
|
+
.filter(l => l.length > 0);
|
|
39
|
+
t.equal(cleanedLines.length, 5);
|
|
40
|
+
t.equal(cleanedLines[1], '\\mt1 USFM');
|
|
41
|
+
t.equal(cleanedLines[3], '\\c 1');
|
|
42
|
+
} catch (err) {
|
|
43
|
+
console.log(err);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
);
|