@helloao/tools 0.0.4 → 0.0.5

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.
@@ -9,21 +9,21 @@ describe('iterators', () => {
9
9
  });
10
10
  describe('iterateAll()', () => {
11
11
  it('should iterate through all nodes', () => {
12
- const html = `
13
- <div id="0">
14
- <div id="1">
15
- <div id="2">abc</div>
16
- <div id="3">def</div>
17
- </div>
18
- <div id="4">
19
- <div id="5">ghi</div>
20
- <div id="6">jfk</div>
21
- </div>
22
- <div id="7">
23
- <div id="8">lmn</div>
24
- <div id="9">opq</div>
25
- </div>
26
- </div>
12
+ const html = `
13
+ <div id="0">
14
+ <div id="1">
15
+ <div id="2">abc</div>
16
+ <div id="3">def</div>
17
+ </div>
18
+ <div id="4">
19
+ <div id="5">ghi</div>
20
+ <div id="6">jfk</div>
21
+ </div>
22
+ <div id="7">
23
+ <div id="8">lmn</div>
24
+ <div id="9">opq</div>
25
+ </div>
26
+ </div>
27
27
  `;
28
28
  const tree = dom.parseFromString(html, 'text/html');
29
29
  const node = tree.getElementById('0');
@@ -66,21 +66,21 @@ describe('iterators', () => {
66
66
  });
67
67
  describe('children()', () => {
68
68
  it('should iterate through all children', () => {
69
- const html = `
70
- <div id="0">
71
- <div id="1">
72
- <div id="2">abc</div>
73
- <div id="3">def</div>
74
- </div>
75
- <div id="4">
76
- <div id="5">ghi</div>
77
- <div id="6">jfk</div>
78
- </div>
79
- <div id="7">
80
- <div id="8">lmn</div>
81
- <div id="9">opq</div>
82
- </div>
83
- </div>
69
+ const html = `
70
+ <div id="0">
71
+ <div id="1">
72
+ <div id="2">abc</div>
73
+ <div id="3">def</div>
74
+ </div>
75
+ <div id="4">
76
+ <div id="5">ghi</div>
77
+ <div id="6">jfk</div>
78
+ </div>
79
+ <div id="7">
80
+ <div id="8">lmn</div>
81
+ <div id="9">opq</div>
82
+ </div>
83
+ </div>
84
84
  `;
85
85
  const tree = dom.parseFromString(html, 'text/html');
86
86
  const root = tree.getElementById('0');
@@ -97,21 +97,21 @@ describe('iterators', () => {
97
97
  expect(mapNodes(nodes)).toEqual(['#space', '2', 'abc', '#space', '3', 'def', '#space']);
98
98
  });
99
99
  it('should not exhaust the iterator', () => {
100
- const html = `
101
- <div id="0">
102
- <div id="1">
103
- <div id="2">abc</div>
104
- <div id="3">def</div>
105
- </div>
106
- <div id="4">
107
- <div id="5">ghi</div>
108
- <div id="6">jfk</div>
109
- </div>
110
- <div id="7">
111
- <div id="8">lmn</div>
112
- <div id="9">opq</div>
113
- </div>
114
- </div>
100
+ const html = `
101
+ <div id="0">
102
+ <div id="1">
103
+ <div id="2">abc</div>
104
+ <div id="3">def</div>
105
+ </div>
106
+ <div id="4">
107
+ <div id="5">ghi</div>
108
+ <div id="6">jfk</div>
109
+ </div>
110
+ <div id="7">
111
+ <div id="8">lmn</div>
112
+ <div id="9">opq</div>
113
+ </div>
114
+ </div>
115
115
  `;
116
116
  const tree = dom.parseFromString(html, 'text/html');
117
117
  const root = tree.getElementById('0');
@@ -233,11 +233,11 @@ describe('UsfmParser', () => {
233
233
  });
234
234
  describe('parse()', () => {
235
235
  it('should produce a list of chapters', () => {
236
- const tree = parser.parse(`\\c 1
237
- \\v 1 In the beginning God created the heavens and the earth.
238
- \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
239
- \\c 2
240
- \\v 1 Thus the heavens and the earth were completed in all their vast array.
236
+ const tree = parser.parse(`\\c 1
237
+ \\v 1 In the beginning God created the heavens and the earth.
238
+ \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
239
+ \\c 2
240
+ \\v 1 Thus the heavens and the earth were completed in all their vast array.
241
241
  `);
242
242
  expect(tree).toEqual({
243
243
  type: 'root',
@@ -281,20 +281,20 @@ describe('UsfmParser', () => {
281
281
  });
282
282
  });
283
283
  it('should infer the first verse of a chapter', () => {
284
- const tree = parser.parse(`\\c 1
285
- \\s1 The Two Paths
286
- \\q1 Blessed is the man
287
- \\q2 who does not walk in the counsel of the wicked,
288
- \\q1 or set foot on the path of sinners,
289
- \\q2 or sit in the seat of mockers.
290
- \\q1
291
- \\v 2 But his delight is in the Law of the LORD,
292
- \\q2 and on His law he meditates day and night.
293
- \\q1
294
- \\c 2
295
- \\q1 Why do the nations rage
296
- \\q2 and the peoples plot in vain?
297
- \\q1
284
+ const tree = parser.parse(`\\c 1
285
+ \\s1 The Two Paths
286
+ \\q1 Blessed is the man
287
+ \\q2 who does not walk in the counsel of the wicked,
288
+ \\q1 or set foot on the path of sinners,
289
+ \\q2 or sit in the seat of mockers.
290
+ \\q1
291
+ \\v 2 But his delight is in the Law of the LORD,
292
+ \\q2 and on His law he meditates day and night.
293
+ \\q1
294
+ \\c 2
295
+ \\q1 Why do the nations rage
296
+ \\q2 and the peoples plot in vain?
297
+ \\q1
298
298
  `);
299
299
  expect(tree).toEqual({
300
300
  type: 'root',
@@ -349,16 +349,16 @@ describe('UsfmParser', () => {
349
349
  });
350
350
  });
351
351
  it('should parse the intro to a book correctly', () => {
352
- const tree = parser.parse(`\\id GEN - Berean Study Bible
353
- \\h Genesis
354
- \\toc1 Genesis
355
- \\mt1 Genesis
356
- \\c 1
357
- \\s1 The Creation
358
- \\r (John 1:1–5; Hebrews 11:1–3)
359
- \\b
360
- \\m
361
- \\v 1 In the beginning God created the heavens and the earth.
352
+ const tree = parser.parse(`\\id GEN - Berean Study Bible
353
+ \\h Genesis
354
+ \\toc1 Genesis
355
+ \\mt1 Genesis
356
+ \\c 1
357
+ \\s1 The Creation
358
+ \\r (John 1:1–5; Hebrews 11:1–3)
359
+ \\b
360
+ \\m
361
+ \\v 1 In the beginning God created the heavens and the earth.
362
362
  `);
363
363
  expect(tree).toEqual({
364
364
  type: 'root',
@@ -391,16 +391,16 @@ describe('UsfmParser', () => {
391
391
  });
392
392
  });
393
393
  it('should be able to parse titles that are formatted with a +', () => {
394
- const tree = parser.parse(`\\id GEN - Berean Study Bible
395
- \\h Genesis
396
- \\+toc1 Genesis
397
- \\+mt1 Genesis
398
- \\c 1
399
- \\s1 The Creation
400
- \\r (John 1:1–5; Hebrews 11:1–3)
401
- \\b
402
- \\m
403
- \\v 1 In the beginning God created the heavens and the earth.
394
+ const tree = parser.parse(`\\id GEN - Berean Study Bible
395
+ \\h Genesis
396
+ \\+toc1 Genesis
397
+ \\+mt1 Genesis
398
+ \\c 1
399
+ \\s1 The Creation
400
+ \\r (John 1:1–5; Hebrews 11:1–3)
401
+ \\b
402
+ \\m
403
+ \\v 1 In the beginning God created the heavens and the earth.
404
404
  `);
405
405
  expect(tree).toEqual({
406
406
  type: 'root',
@@ -433,13 +433,13 @@ describe('UsfmParser', () => {
433
433
  });
434
434
  });
435
435
  it('should support line breaks', () => {
436
- const tree = parser.parse(`\\c 1
437
- \\v 1 In the beginning God created the heavens and the earth.
438
- \\b
439
- \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
440
- \\b
441
- \\c 2
442
- \\v 1 Thus the heavens and the earth were completed in all their vast array.
436
+ const tree = parser.parse(`\\c 1
437
+ \\v 1 In the beginning God created the heavens and the earth.
438
+ \\b
439
+ \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
440
+ \\b
441
+ \\c 2
442
+ \\v 1 Thus the heavens and the earth were completed in all their vast array.
443
443
  `);
444
444
  expect(tree).toEqual({
445
445
  type: 'root',
@@ -489,11 +489,11 @@ describe('UsfmParser', () => {
489
489
  });
490
490
  });
491
491
  it('should support verses that are on the same line as another verse', () => {
492
- const tree = parser.parse(`\\c 24
493
- \\v 18 وَالثَّالِثَةُ وَالْعِشْرُونَ لِدَلايَا، وَالرَّابِعَةُ وَالْعِشْرُونَ لِمَعَزْيَا.
494
- \\v 19 هَذَا كَانَ تَرْتِيبَ خَدَمَاتِهِمِ الَّتِي كُلِّفُوا بِها عِنْدَ دُخُولِهِمْ إِلَى بَيْتِ الرَّبِّ بِمُقْتَضَى الْمَرَاسِيمِ الَّتِي حَدَّدَهَا لَهُمْ جَدُّهُمُ الأَكْبَرُ هرُونُ، تَمَاماً كَمَا أَمَرَهُ الرَّبُّ إِلَهُ إِسْرَائِيلَ. \\s1 بقية اللاويين \\p \\v 20 أَمَّا بَقِيَّةُ أَبْنَاءِ لاوِي فَهُمْ: مِنْ ذُرِّيَّةِ عَمْرَامَ: شُوبَائِيلُ، وَمِنْ أَبْنَاءِ شُوبَائِيلَ يَحَدْيَا.
495
- \\b
496
- \\v 21 وَمِنْ ذُرِّيَّةِ رَحَبْيَا: الْبِكْرُ يَشِّيَّا.
492
+ const tree = parser.parse(`\\c 24
493
+ \\v 18 وَالثَّالِثَةُ وَالْعِشْرُونَ لِدَلايَا، وَالرَّابِعَةُ وَالْعِشْرُونَ لِمَعَزْيَا.
494
+ \\v 19 هَذَا كَانَ تَرْتِيبَ خَدَمَاتِهِمِ الَّتِي كُلِّفُوا بِها عِنْدَ دُخُولِهِمْ إِلَى بَيْتِ الرَّبِّ بِمُقْتَضَى الْمَرَاسِيمِ الَّتِي حَدَّدَهَا لَهُمْ جَدُّهُمُ الأَكْبَرُ هرُونُ، تَمَاماً كَمَا أَمَرَهُ الرَّبُّ إِلَهُ إِسْرَائِيلَ. \\s1 بقية اللاويين \\p \\v 20 أَمَّا بَقِيَّةُ أَبْنَاءِ لاوِي فَهُمْ: مِنْ ذُرِّيَّةِ عَمْرَامَ: شُوبَائِيلُ، وَمِنْ أَبْنَاءِ شُوبَائِيلَ يَحَدْيَا.
495
+ \\b
496
+ \\v 21 وَمِنْ ذُرِّيَّةِ رَحَبْيَا: الْبِكْرُ يَشِّيَّا.
497
497
  `);
498
498
  expect(tree).toEqual({
499
499
  type: 'root',
@@ -549,10 +549,10 @@ describe('UsfmParser', () => {
549
549
  });
550
550
  });
551
551
  it('should ignore verses that have no number indicator', () => {
552
- const tree = parser.parse(`\\c 1
553
- \\v 1 In the beginning God created the heavens and the earth.
554
- \\v
555
- \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
552
+ const tree = parser.parse(`\\c 1
553
+ \\v 1 In the beginning God created the heavens and the earth.
554
+ \\v
555
+ \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
556
556
  `);
557
557
  expect(tree).toEqual({
558
558
  type: 'root',
@@ -582,13 +582,13 @@ describe('UsfmParser', () => {
582
582
  });
583
583
  });
584
584
  it('should treat paragraphs like line breaks', () => {
585
- const tree = parser.parse(`\\c 1
586
- \\v 1 In the beginning God created the heavens and the earth.
587
- \\p
588
- \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
589
- \\p
590
- \\c 2
591
- \\v 1 Thus the heavens and the earth were completed in all their vast array.
585
+ const tree = parser.parse(`\\c 1
586
+ \\v 1 In the beginning God created the heavens and the earth.
587
+ \\p
588
+ \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
589
+ \\p
590
+ \\c 2
591
+ \\v 1 Thus the heavens and the earth were completed in all their vast array.
592
592
  `);
593
593
  expect(tree).toEqual({
594
594
  type: 'root',
@@ -638,13 +638,13 @@ describe('UsfmParser', () => {
638
638
  });
639
639
  });
640
640
  it('should support ID tags', () => {
641
- const tree = parser.parse(`
642
- \\id GEN - Berean Study Bible
643
- \\c 1
644
- \\v 1 In the beginning God created the heavens and the earth.
645
- \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
646
- \\c 2
647
- \\v 1 Thus the heavens and the earth were completed in all their vast array.
641
+ const tree = parser.parse(`
642
+ \\id GEN - Berean Study Bible
643
+ \\c 1
644
+ \\v 1 In the beginning God created the heavens and the earth.
645
+ \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
646
+ \\c 2
647
+ \\v 1 Thus the heavens and the earth were completed in all their vast array.
648
648
  `);
649
649
  expect(tree).toEqual({
650
650
  type: 'root',
@@ -689,15 +689,15 @@ describe('UsfmParser', () => {
689
689
  });
690
690
  });
691
691
  it('should support major title headings', () => {
692
- const tree = parser.parse(`
693
- \\mt1 The
694
- \\mt2 Title
695
- \\mt3 of the Book
696
- \\c 1
697
- \\v 1 In the beginning God created the heavens and the earth.
698
- \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
699
- \\c 2
700
- \\v 1 Thus the heavens and the earth were completed in all their vast array.
692
+ const tree = parser.parse(`
693
+ \\mt1 The
694
+ \\mt2 Title
695
+ \\mt3 of the Book
696
+ \\c 1
697
+ \\v 1 In the beginning God created the heavens and the earth.
698
+ \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
699
+ \\c 2
700
+ \\v 1 Thus the heavens and the earth were completed in all their vast array.
701
701
  `);
702
702
  expect(tree).toEqual({
703
703
  type: 'root',
@@ -742,13 +742,13 @@ describe('UsfmParser', () => {
742
742
  });
743
743
  });
744
744
  it('should support header text', () => {
745
- const tree = parser.parse(`
746
- \\h Genesis
747
- \\c 1
748
- \\v 1 In the beginning God created the heavens and the earth.
749
- \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
750
- \\c 2
751
- \\v 1 Thus the heavens and the earth were completed in all their vast array.
745
+ const tree = parser.parse(`
746
+ \\h Genesis
747
+ \\c 1
748
+ \\v 1 In the beginning God created the heavens and the earth.
749
+ \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
750
+ \\c 2
751
+ \\v 1 Thus the heavens and the earth were completed in all their vast array.
752
752
  `);
753
753
  expect(tree).toEqual({
754
754
  type: 'root',
@@ -793,12 +793,12 @@ describe('UsfmParser', () => {
793
793
  });
794
794
  });
795
795
  it('should support section headings in chapters', () => {
796
- const tree = parser.parse(`\\c 1
797
- \\s1 The Creation
798
- \\v 1 In the beginning God created the heavens and the earth.
799
- \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
800
- \\c 2
801
- \\v 1 Thus the heavens and the earth were completed in all their vast array.
796
+ const tree = parser.parse(`\\c 1
797
+ \\s1 The Creation
798
+ \\v 1 In the beginning God created the heavens and the earth.
799
+ \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
800
+ \\c 2
801
+ \\v 1 Thus the heavens and the earth were completed in all their vast array.
802
802
  `);
803
803
  expect(tree).toEqual({
804
804
  type: 'root',
@@ -848,7 +848,7 @@ describe('UsfmParser', () => {
848
848
  });
849
849
  });
850
850
  it('should support section headings outside of chapters', () => {
851
- const tree = parser.parse(`\\s1 The Creation
851
+ const tree = parser.parse(`\\s1 The Creation
852
852
  `);
853
853
  expect(tree).toEqual({
854
854
  type: 'root',
@@ -863,12 +863,12 @@ describe('UsfmParser', () => {
863
863
  });
864
864
  });
865
865
  it('should support footnotes', () => {
866
- const tree = parser.parse(`\\c 1
867
- \\v 1 In the beginning God created the heavens and the earth.
868
- \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
869
- \\v 3 And God said, “Let there be light,” \\f + \\fr 1:3 \\ft Cited in 2 Corinthians 4:6\\f* and there was light.
870
- \\c 2
871
- \\v 1 Thus the heavens and the earth were completed in all their vast array.
866
+ const tree = parser.parse(`\\c 1
867
+ \\v 1 In the beginning God created the heavens and the earth.
868
+ \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
869
+ \\v 3 And God said, “Let there be light,” \\f + \\fr 1:3 \\ft Cited in 2 Corinthians 4:6\\f* and there was light.
870
+ \\c 2
871
+ \\v 1 Thus the heavens and the earth were completed in all their vast array.
872
872
  `);
873
873
  expect(tree).toEqual({
874
874
  type: 'root',
@@ -933,12 +933,12 @@ describe('UsfmParser', () => {
933
933
  });
934
934
  });
935
935
  it('should support custom footnote callers', () => {
936
- const tree = parser.parse(`\\c 1
937
- \\v 1 In the beginning God created the heavens and the earth.
938
- \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
939
- \\v 3 And God said, “Let there be light,” \\f a \\fr 1:3 \\ft Cited in 2 Corinthians 4:6\\f* and there was light.
940
- \\c 2
941
- \\v 1 Thus the heavens and the earth were completed in all their vast array.
936
+ const tree = parser.parse(`\\c 1
937
+ \\v 1 In the beginning God created the heavens and the earth.
938
+ \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
939
+ \\v 3 And God said, “Let there be light,” \\f a \\fr 1:3 \\ft Cited in 2 Corinthians 4:6\\f* and there was light.
940
+ \\c 2
941
+ \\v 1 Thus the heavens and the earth were completed in all their vast array.
942
942
  `);
943
943
  expect(tree).toEqual({
944
944
  type: 'root',
@@ -1003,8 +1003,8 @@ describe('UsfmParser', () => {
1003
1003
  });
1004
1004
  });
1005
1005
  it('should ignore introduction paragraphs', () => {
1006
- const tree = parser.parse(`
1007
- \\ip The Holy Bible is translated into many languages, and being translated into many more, so that everyone may have an opportunity to hear the Good News about Jesus Christ.\\f + \\fr 1:0 \\ft “Christ” means “Anointed One”.\\f*
1006
+ const tree = parser.parse(`
1007
+ \\ip The Holy Bible is translated into many languages, and being translated into many more, so that everyone may have an opportunity to hear the Good News about Jesus Christ.\\f + \\fr 1:0 \\ft “Christ” means “Anointed One”.\\f*
1008
1008
  `);
1009
1009
  expect(tree).toEqual({
1010
1010
  type: 'root',
@@ -1019,12 +1019,12 @@ describe('UsfmParser', () => {
1019
1019
  });
1020
1020
  });
1021
1021
  it('should support references', () => {
1022
- const tree = parser.parse(`\\c 1
1023
- \\r (John 1:1–5; Hebrews 11:1–3)
1024
- \\v 1 In the beginning God created the heavens and the earth.
1025
- \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
1026
- \\c 2
1027
- \\v 1 Thus the heavens and the earth were completed in all their vast array.
1022
+ const tree = parser.parse(`\\c 1
1023
+ \\r (John 1:1–5; Hebrews 11:1–3)
1024
+ \\v 1 In the beginning God created the heavens and the earth.
1025
+ \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
1026
+ \\c 2
1027
+ \\v 1 Thus the heavens and the earth were completed in all their vast array.
1028
1028
  `);
1029
1029
  expect(tree).toEqual({
1030
1030
  type: 'root',
@@ -1068,16 +1068,16 @@ describe('UsfmParser', () => {
1068
1068
  });
1069
1069
  });
1070
1070
  it('should support parsing descriptive titles', () => {
1071
- const tree = parser.parse(`\\c 6
1072
- \\s1 Do Not Rebuke Me in Your Anger
1073
- \\r (Psalm 38:1–22)
1074
- \\b
1075
- \\d For the choirmaster. With stringed instruments, according to Sheminith.\\f + \\fr 6:1 \\ft Sheminith is probably a musical term; here and in 1 Chronicles 15:21 and Psalm 12:1.\\f* A Psalm of David.
1076
- \\b
1077
- \\q1
1078
- \\v 1 O LORD, do not rebuke me in Your anger
1079
- \\q2 or discipline me in Your wrath.
1080
- \\q1
1071
+ const tree = parser.parse(`\\c 6
1072
+ \\s1 Do Not Rebuke Me in Your Anger
1073
+ \\r (Psalm 38:1–22)
1074
+ \\b
1075
+ \\d For the choirmaster. With stringed instruments, according to Sheminith.\\f + \\fr 6:1 \\ft Sheminith is probably a musical term; here and in 1 Chronicles 15:21 and Psalm 12:1.\\f* A Psalm of David.
1076
+ \\b
1077
+ \\q1
1078
+ \\v 1 O LORD, do not rebuke me in Your anger
1079
+ \\q2 or discipline me in Your wrath.
1080
+ \\q1
1081
1081
  `);
1082
1082
  expect(tree).toEqual({
1083
1083
  type: 'root',
@@ -1131,8 +1131,8 @@ describe('UsfmParser', () => {
1131
1131
  });
1132
1132
  });
1133
1133
  it('should ignore word level attributes', () => {
1134
- const tree = parser.parse(`\\c 1
1135
- \\v 1 \\w In|strong="H0430"\\w* \\w the|strong="H0853"\\w* \\w beginning|strong="H7225"\\w*, \\w God|strong="H0430"\\w* \\w created|strong="H1254"\\w* \\w the|strong="H0853"\\w* \\w heavens|strong="H8064"\\w* \\w and|strong="H0430"\\w* \\w the|strong="H0853"\\w* \\w earth|strong="H0776"\\w*.
1134
+ const tree = parser.parse(`\\c 1
1135
+ \\v 1 \\w In|strong="H0430"\\w* \\w the|strong="H0853"\\w* \\w beginning|strong="H7225"\\w*, \\w God|strong="H0430"\\w* \\w created|strong="H1254"\\w* \\w the|strong="H0853"\\w* \\w heavens|strong="H8064"\\w* \\w and|strong="H0430"\\w* \\w the|strong="H0853"\\w* \\w earth|strong="H0776"\\w*.
1136
1136
  `);
1137
1137
  expect(tree).toEqual({
1138
1138
  type: 'root',
@@ -1155,13 +1155,13 @@ describe('UsfmParser', () => {
1155
1155
  });
1156
1156
  });
1157
1157
  it('should ignore cross references', () => {
1158
- const tree = parser.parse(`\\c 5
1159
- \\p
1160
- \\v 1 \\w Seeing|strong="G3708"\\w* \\w the|strong="G3588"\\w* \\w multitudes|strong="G3793"\\w*, \\w he|strong="G2532"\\w* \\w went|strong="G0305"\\w* \\w up|strong="G0305"\\w* \\w onto|strong="G1519"\\w* \\w the|strong="G3588"\\w* \\w mountain|strong="G3735"\\w*. \\w When|strong="G2532"\\w* \\w he|strong="G2532"\\w* \\w had|strong="G3588"\\w* \\w sat|strong="G2523"\\w* \\w down|strong="G2523"\\w*, \\w his|strong="G0846"\\w* \\w disciples|strong="G3101"\\w* \\w came|strong="G4334"\\w* \\w to|strong="G1519"\\w* \\w him|strong="G0846"\\w*.
1161
- \\v 2 \\w He|strong="G2532"\\w* \\w opened|strong="G0455"\\w* \\w his|strong="G0846"\\w* \\w mouth|strong="G4750"\\w* \\w and|strong="G2532"\\w* \\w taught|strong="G1321"\\w* \\w them|strong="G0846"\\w*, \\w saying|strong="G3004"\\w*,
1162
- \\q1
1163
- \\v 3 \\wj “\\+w Blessed|strong="G3107"\\+w* \\+w are|strong="G1510"\\+w* \\+w the|strong="G3588"\\+w* \\+w poor|strong="G4434"\\+w* \\+w in|strong="G4434"\\+w* \\+w spirit|strong="G4151"\\+w*,\\wj*
1164
- \\q2 \\wj \\+w for|strong="G3754"\\+w* \\+w theirs|strong="G0846"\\+w* \\+w is|strong="G1510"\\+w* \\+w the|strong="G3588"\\+w* \\+w Kingdom|strong="G0932"\\+w* \\+w of|strong="G0932"\\+w* \\+w Heaven|strong="G3772"\\+w*.\\wj*\\x + \\xo 5:3 \\xt Isaiah 57:15; 66:2\\x*
1158
+ const tree = parser.parse(`\\c 5
1159
+ \\p
1160
+ \\v 1 \\w Seeing|strong="G3708"\\w* \\w the|strong="G3588"\\w* \\w multitudes|strong="G3793"\\w*, \\w he|strong="G2532"\\w* \\w went|strong="G0305"\\w* \\w up|strong="G0305"\\w* \\w onto|strong="G1519"\\w* \\w the|strong="G3588"\\w* \\w mountain|strong="G3735"\\w*. \\w When|strong="G2532"\\w* \\w he|strong="G2532"\\w* \\w had|strong="G3588"\\w* \\w sat|strong="G2523"\\w* \\w down|strong="G2523"\\w*, \\w his|strong="G0846"\\w* \\w disciples|strong="G3101"\\w* \\w came|strong="G4334"\\w* \\w to|strong="G1519"\\w* \\w him|strong="G0846"\\w*.
1161
+ \\v 2 \\w He|strong="G2532"\\w* \\w opened|strong="G0455"\\w* \\w his|strong="G0846"\\w* \\w mouth|strong="G4750"\\w* \\w and|strong="G2532"\\w* \\w taught|strong="G1321"\\w* \\w them|strong="G0846"\\w*, \\w saying|strong="G3004"\\w*,
1162
+ \\q1
1163
+ \\v 3 \\wj “\\+w Blessed|strong="G3107"\\+w* \\+w are|strong="G1510"\\+w* \\+w the|strong="G3588"\\+w* \\+w poor|strong="G4434"\\+w* \\+w in|strong="G4434"\\+w* \\+w spirit|strong="G4151"\\+w*,\\wj*
1164
+ \\q2 \\wj \\+w for|strong="G3754"\\+w* \\+w theirs|strong="G0846"\\+w* \\+w is|strong="G1510"\\+w* \\+w the|strong="G3588"\\+w* \\+w Kingdom|strong="G0932"\\+w* \\+w of|strong="G0932"\\+w* \\+w Heaven|strong="G3772"\\+w*.\\wj*\\x + \\xo 5:3 \\xt Isaiah 57:15; 66:2\\x*
1165
1165
  `);
1166
1166
  expect(tree).toEqual({
1167
1167
  type: 'root',
@@ -1210,11 +1210,11 @@ describe('UsfmParser', () => {
1210
1210
  });
1211
1211
  });
1212
1212
  it('should support the Words of Jesus', () => {
1213
- const tree = parser.parse(`\\c 8
1214
- \\v 10 \\w When|strong="G2532"\\w* \\w Jesus|strong="G2424"\\w* \\w heard|strong="G0191"\\w* \\w it|strong="G0191"\\w*, \\w he|strong="G2532"\\w* \\w marveled|strong="G2296"\\w* \\w and|strong="G2532"\\w* \\w said|strong="G3004"\\w* \\w to|strong="G3004"\\w* \\w those|strong="G3588"\\w* \\w who|strong="G3588"\\w* \\w followed|strong="G0190"\\w*, \\wj “Most \\+w certainly|strong="G2532"\\+w* \\+w I|strong="G0281"\\+w* \\+w tell|strong="G3004"\\+w* \\+w you|strong="G5210"\\+w*, \\+w I|strong="G0281"\\+w* \\+w haven’t|strong="G3761"\\+w* \\+w found|strong="G2147"\\+w* \\+w so|strong="G2532"\\+w* \\+w great|strong="G5118"\\+w* \\+w a|strong="G2147"\\+w* \\+w faith|strong="G4102"\\+w*, \\+w not|strong="G3761"\\+w* \\+w even|strong="G2532"\\+w* \\+w in|strong="G1722"\\+w* \\+w Israel|strong="G2474"\\+w*. \\wj*
1215
- \\v 11 \\wj \\+w I|strong="G2532"\\+w* \\+w tell|strong="G3004"\\+w* \\+w you|strong="G5210"\\+w* \\+w that|strong="G3754"\\+w* \\+w many|strong="G4183"\\+w* \\+w will|strong="G4183"\\+w* \\+w come|strong="G2240"\\+w* \\+w from|strong="G0575"\\+w* \\+w the|strong="G3588"\\+w* \\+w east|strong="G0395"\\+w* \\+w and|strong="G2532"\\+w* \\+w the|strong="G3588"\\+w* \\+w west|strong="G1424"\\+w*, \\+w and|strong="G2532"\\+w* \\+w will|strong="G4183"\\+w* \\+w sit|strong="G0347"\\+w* \\+w down|strong="G0347"\\+w* \\+w with|strong="G3326"\\+w* \\+w Abraham|strong="G0011"\\+w*, \\+w Isaac|strong="G2464"\\+w*, \\+w and|strong="G2532"\\+w* \\+w Jacob|strong="G2384"\\+w* \\+w in|strong="G1722"\\+w* \\+w the|strong="G3588"\\+w* \\+w Kingdom|strong="G0932"\\+w* \\+w of|strong="G0932"\\+w* \\+w Heaven|strong="G3772"\\+w*, \\wj*
1216
- \\v 12 \\wj \\+w but|strong="G1161"\\+w* \\+w the|strong="G3588"\\+w* children \\+w of|strong="G5207"\\+w* \\+w the|strong="G3588"\\+w* \\+w Kingdom|strong="G0932"\\+w* \\+w will|strong="G1510"\\+w* \\+w be|strong="G1510"\\+w* thrown \\+w out|strong="G1831"\\+w* \\+w into|strong="G1519"\\+w* \\+w the|strong="G3588"\\+w* \\+w outer|strong="G1857"\\+w* \\+w darkness|strong="G4655"\\+w*. \\+w There|strong="G1563"\\+w* \\+w will|strong="G1510"\\+w* \\+w be|strong="G1510"\\+w* \\+w weeping|strong="G2805"\\+w* \\+w and|strong="G2532"\\+w* \\+w gnashing|strong="G1030"\\+w* \\+w of|strong="G5207"\\+w* \\+w teeth|strong="G3599"\\+w*.”\\wj*
1217
- \\v 13 \\w Jesus|strong="G2424"\\w* \\w said|strong="G3004"\\w* \\w to|strong="G3004"\\w* \\w the|strong="G3588"\\w* \\w centurion|strong="G1543"\\w*, \\wj “\\+w Go|strong="G5217"\\+w* \\+w your|strong="G2532"\\+w* \\+w way|strong="G1722"\\+w*. \\+w Let|strong="G1096"\\+w* \\+w it|strong="G2532"\\+w* \\+w be|strong="G1096"\\+w* \\+w done|strong="G1096"\\+w* \\+w for|strong="G1722"\\+w* \\+w you|strong="G4771"\\+w* \\+w as|strong="G5613"\\+w* \\+w you|strong="G4771"\\+w* \\+w have|strong="G2532"\\+w* \\+w believed|strong="G4100"\\+w*.”\\wj* \\w His|strong="G5613"\\w* \\w servant|strong="G3816"\\w* \\w was|strong="G2424"\\w* \\w healed|strong="G2390"\\w* \\w in|strong="G1722"\\w* \\w that|strong="G1565"\\w* \\w hour|strong="G5610"\\w*.
1213
+ const tree = parser.parse(`\\c 8
1214
+ \\v 10 \\w When|strong="G2532"\\w* \\w Jesus|strong="G2424"\\w* \\w heard|strong="G0191"\\w* \\w it|strong="G0191"\\w*, \\w he|strong="G2532"\\w* \\w marveled|strong="G2296"\\w* \\w and|strong="G2532"\\w* \\w said|strong="G3004"\\w* \\w to|strong="G3004"\\w* \\w those|strong="G3588"\\w* \\w who|strong="G3588"\\w* \\w followed|strong="G0190"\\w*, \\wj “Most \\+w certainly|strong="G2532"\\+w* \\+w I|strong="G0281"\\+w* \\+w tell|strong="G3004"\\+w* \\+w you|strong="G5210"\\+w*, \\+w I|strong="G0281"\\+w* \\+w haven’t|strong="G3761"\\+w* \\+w found|strong="G2147"\\+w* \\+w so|strong="G2532"\\+w* \\+w great|strong="G5118"\\+w* \\+w a|strong="G2147"\\+w* \\+w faith|strong="G4102"\\+w*, \\+w not|strong="G3761"\\+w* \\+w even|strong="G2532"\\+w* \\+w in|strong="G1722"\\+w* \\+w Israel|strong="G2474"\\+w*. \\wj*
1215
+ \\v 11 \\wj \\+w I|strong="G2532"\\+w* \\+w tell|strong="G3004"\\+w* \\+w you|strong="G5210"\\+w* \\+w that|strong="G3754"\\+w* \\+w many|strong="G4183"\\+w* \\+w will|strong="G4183"\\+w* \\+w come|strong="G2240"\\+w* \\+w from|strong="G0575"\\+w* \\+w the|strong="G3588"\\+w* \\+w east|strong="G0395"\\+w* \\+w and|strong="G2532"\\+w* \\+w the|strong="G3588"\\+w* \\+w west|strong="G1424"\\+w*, \\+w and|strong="G2532"\\+w* \\+w will|strong="G4183"\\+w* \\+w sit|strong="G0347"\\+w* \\+w down|strong="G0347"\\+w* \\+w with|strong="G3326"\\+w* \\+w Abraham|strong="G0011"\\+w*, \\+w Isaac|strong="G2464"\\+w*, \\+w and|strong="G2532"\\+w* \\+w Jacob|strong="G2384"\\+w* \\+w in|strong="G1722"\\+w* \\+w the|strong="G3588"\\+w* \\+w Kingdom|strong="G0932"\\+w* \\+w of|strong="G0932"\\+w* \\+w Heaven|strong="G3772"\\+w*, \\wj*
1216
+ \\v 12 \\wj \\+w but|strong="G1161"\\+w* \\+w the|strong="G3588"\\+w* children \\+w of|strong="G5207"\\+w* \\+w the|strong="G3588"\\+w* \\+w Kingdom|strong="G0932"\\+w* \\+w will|strong="G1510"\\+w* \\+w be|strong="G1510"\\+w* thrown \\+w out|strong="G1831"\\+w* \\+w into|strong="G1519"\\+w* \\+w the|strong="G3588"\\+w* \\+w outer|strong="G1857"\\+w* \\+w darkness|strong="G4655"\\+w*. \\+w There|strong="G1563"\\+w* \\+w will|strong="G1510"\\+w* \\+w be|strong="G1510"\\+w* \\+w weeping|strong="G2805"\\+w* \\+w and|strong="G2532"\\+w* \\+w gnashing|strong="G1030"\\+w* \\+w of|strong="G5207"\\+w* \\+w teeth|strong="G3599"\\+w*.”\\wj*
1217
+ \\v 13 \\w Jesus|strong="G2424"\\w* \\w said|strong="G3004"\\w* \\w to|strong="G3004"\\w* \\w the|strong="G3588"\\w* \\w centurion|strong="G1543"\\w*, \\wj “\\+w Go|strong="G5217"\\+w* \\+w your|strong="G2532"\\+w* \\+w way|strong="G1722"\\+w*. \\+w Let|strong="G1096"\\+w* \\+w it|strong="G2532"\\+w* \\+w be|strong="G1096"\\+w* \\+w done|strong="G1096"\\+w* \\+w for|strong="G1722"\\+w* \\+w you|strong="G4771"\\+w* \\+w as|strong="G5613"\\+w* \\+w you|strong="G4771"\\+w* \\+w have|strong="G2532"\\+w* \\+w believed|strong="G4100"\\+w*.”\\wj* \\w His|strong="G5613"\\w* \\w servant|strong="G3816"\\w* \\w was|strong="G2424"\\w* \\w healed|strong="G2390"\\w* \\w in|strong="G1722"\\w* \\w that|strong="G1565"\\w* \\w hour|strong="G5610"\\w*.
1218
1218
  `);
1219
1219
  expect(tree).toEqual({
1220
1220
  type: 'root',
@@ -1273,8 +1273,8 @@ describe('UsfmParser', () => {
1273
1273
  });
1274
1274
  });
1275
1275
  it('should not place spaces between Words of Jesus', () => {
1276
- const tree = parser.parse(`\\c 8
1277
- \\v 11 \\wj I tell you that many will come \\wj* \\wj from the east and the west, and will sit down with Abraham, Isaac, and Jacob in the Kingdom of Heaven, \\wj*
1276
+ const tree = parser.parse(`\\c 8
1277
+ \\v 11 \\wj I tell you that many will come \\wj* \\wj from the east and the west, and will sit down with Abraham, Isaac, and Jacob in the Kingdom of Heaven, \\wj*
1278
1278
  `);
1279
1279
  expect(tree).toEqual({
1280
1280
  type: 'root',
@@ -1304,28 +1304,28 @@ describe('UsfmParser', () => {
1304
1304
  });
1305
1305
  });
1306
1306
  it('should handle verses that are split between headings', () => {
1307
- const tree = parser.parse(`\\c 1
1308
- \\v 1 This is Solomon’s Song of Songs.\\f + \\fr 1:1 \\ft Most translators add subheadings for speaker identifications such as The Bride, The Groom, and The Friends based on the gender and number of the Hebrew words.\\f*
1309
- \\s2 The Bride
1310
- \\b
1311
- \\q1
1312
- \\v 2 Let him kiss me with the kisses of his mouth!
1313
- \\q2 For your love is more delightful than wine.
1314
- \\q1
1315
- \\v 3 The fragrance of your perfume is pleasing;
1316
- \\q2 your name is like perfume poured out.
1317
- \\q2 No wonder the maidens adore you.
1318
- \\b
1319
- \\q1
1320
- \\v 4 Take me away with you—let us hurry!
1321
- \\q2 May the king bring me to his chambers.
1322
- \\s2 The Friends
1323
- \\b
1324
- \\q1 We will rejoice and delight in you;
1325
- \\q2 we will praise your love more than wine.
1326
- \\s2 The Bride
1327
- \\b
1328
- \\q1 It is only right that they adore you.
1307
+ const tree = parser.parse(`\\c 1
1308
+ \\v 1 This is Solomon’s Song of Songs.\\f + \\fr 1:1 \\ft Most translators add subheadings for speaker identifications such as The Bride, The Groom, and The Friends based on the gender and number of the Hebrew words.\\f*
1309
+ \\s2 The Bride
1310
+ \\b
1311
+ \\q1
1312
+ \\v 2 Let him kiss me with the kisses of his mouth!
1313
+ \\q2 For your love is more delightful than wine.
1314
+ \\q1
1315
+ \\v 3 The fragrance of your perfume is pleasing;
1316
+ \\q2 your name is like perfume poured out.
1317
+ \\q2 No wonder the maidens adore you.
1318
+ \\b
1319
+ \\q1
1320
+ \\v 4 Take me away with you—let us hurry!
1321
+ \\q2 May the king bring me to his chambers.
1322
+ \\s2 The Friends
1323
+ \\b
1324
+ \\q1 We will rejoice and delight in you;
1325
+ \\q2 we will praise your love more than wine.
1326
+ \\s2 The Bride
1327
+ \\b
1328
+ \\q1 It is only right that they adore you.
1329
1329
  `);
1330
1330
  expect(tree).toEqual({
1331
1331
  type: 'root',
@@ -1441,9 +1441,9 @@ describe('UsfmParser', () => {
1441
1441
  });
1442
1442
  });
1443
1443
  it('should ignore \\zaln-s world-level attributes', () => {
1444
- const tree = parser.parse(`\\c 1
1445
- \\v 1 \\zaln-s | x-strong="H0430" x-lemma="אֱלֹהִים" x-morph="He,Ncmsc" x-tw="rc://*/tw/dict/bible/kt/god"\\*\\w Test|x-occurence="1"\\w* \\zaln-e\\*
1446
- \\v 2 Hello
1444
+ const tree = parser.parse(`\\c 1
1445
+ \\v 1 \\zaln-s | x-strong="H0430" x-lemma="אֱלֹהִים" x-morph="He,Ncmsc" x-tw="rc://*/tw/dict/bible/kt/god"\\*\\w Test|x-occurence="1"\\w* \\zaln-e\\*
1446
+ \\v 2 Hello
1447
1447
  `);
1448
1448
  expect(tree).toEqual({
1449
1449
  type: 'root',
@@ -1532,14 +1532,14 @@ describe('UsfmParser', () => {
1532
1532
  });
1533
1533
  describe('renderMarkdown()', () => {
1534
1534
  it('should create basic markdown from a parse tree', () => {
1535
- const tree = parser.parse(`
1536
- \\h Genesis
1537
- \\c 1
1538
- \\v 1 In the beginning God created the heavens and the earth.
1539
- \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
1540
- \\v 3 And God said, “Let there be light,” \\f + \\fr 1:3 \\ft Cited in 2 Corinthians 4:6\\f* and there was light.
1541
- \\c 2
1542
- \\v 1 Thus the heavens and the earth were completed in all their vast array.
1535
+ const tree = parser.parse(`
1536
+ \\h Genesis
1537
+ \\c 1
1538
+ \\v 1 In the beginning God created the heavens and the earth.
1539
+ \\v 2 Now the earth was formless and void, and darkness was over the surface of the deep. And the Spirit of God was hovering over the surface of the waters.
1540
+ \\v 3 And God said, “Let there be light,” \\f + \\fr 1:3 \\ft Cited in 2 Corinthians 4:6\\f* and there was light.
1541
+ \\c 2
1542
+ \\v 1 Thus the heavens and the earth were completed in all their vast array.
1543
1543
  `);
1544
1544
  const md = parser.renderMarkdown(tree);
1545
1545
  expect(md).toMatchSnapshot();