metanorma-standoc 1.11.0 → 1.11.3

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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/lib/asciidoctor/standoc/base.rb +4 -100
  4. data/lib/asciidoctor/standoc/blocks.rb +1 -1
  5. data/lib/asciidoctor/standoc/cleanup.rb +2 -1
  6. data/lib/asciidoctor/standoc/cleanup_block.rb +1 -2
  7. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +28 -20
  8. data/lib/asciidoctor/standoc/cleanup_inline.rb +14 -4
  9. data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +25 -15
  10. data/lib/asciidoctor/standoc/cleanup_reqt.rb +3 -3
  11. data/lib/asciidoctor/standoc/cleanup_section_names.rb +2 -2
  12. data/lib/asciidoctor/standoc/cleanup_terms.rb +58 -21
  13. data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +50 -19
  14. data/lib/asciidoctor/standoc/cleanup_text.rb +23 -0
  15. data/lib/asciidoctor/standoc/datamodel/attributes_table_preprocessor.rb +6 -6
  16. data/lib/asciidoctor/standoc/front.rb +1 -1
  17. data/lib/asciidoctor/standoc/inline.rb +13 -11
  18. data/lib/asciidoctor/standoc/isodoc.rng +68 -18
  19. data/lib/asciidoctor/standoc/lists.rb +1 -3
  20. data/lib/asciidoctor/standoc/ref.rb +101 -75
  21. data/lib/asciidoctor/standoc/ref_date_id.rb +30 -1
  22. data/lib/asciidoctor/standoc/ref_sect.rb +18 -7
  23. data/lib/asciidoctor/standoc/render.rb +117 -0
  24. data/lib/asciidoctor/standoc/reqt.rb +1 -1
  25. data/lib/asciidoctor/standoc/section.rb +20 -15
  26. data/lib/asciidoctor/standoc/utils.rb +0 -16
  27. data/lib/asciidoctor/standoc/validate.rb +1 -1
  28. data/lib/isodoc/html/htmlstyle.css +1 -1
  29. data/lib/isodoc/html/htmlstyle.scss +1 -1
  30. data/lib/metanorma/standoc/version.rb +1 -1
  31. data/metanorma-standoc.gemspec +3 -3
  32. data/spec/asciidoctor/blocks_spec.rb +99 -17
  33. data/spec/asciidoctor/cleanup_blocks_spec.rb +24 -0
  34. data/spec/asciidoctor/cleanup_sections_spec.rb +1 -1
  35. data/spec/asciidoctor/cleanup_spec.rb +6 -6
  36. data/spec/asciidoctor/cleanup_terms_spec.rb +448 -89
  37. data/spec/asciidoctor/datamodel/attributes_table_preprocessor_spec.rb +21 -21
  38. data/spec/asciidoctor/datamodel/diagram_preprocessor_spec.rb +16 -16
  39. data/spec/asciidoctor/inline_spec.rb +5 -5
  40. data/spec/asciidoctor/isobib_cache_spec.rb +4 -8
  41. data/spec/asciidoctor/macros_spec.rb +2 -2
  42. data/spec/asciidoctor/refs_dl_spec.rb +4 -4
  43. data/spec/asciidoctor/refs_spec.rb +858 -498
  44. data/spec/asciidoctor/section_spec.rb +32 -3
  45. data/spec/spec_helper.rb +2 -2
  46. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +179 -179
  47. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +14 -14
  48. data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
  49. data/spec/vcr_cassettes/isobib_get_123_1.yml +96 -96
  50. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +108 -108
  51. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  52. data/spec/vcr_cassettes/isobib_get_124.yml +13 -13
  53. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +18 -18
  54. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
  55. metadata +9 -8
@@ -15,11 +15,12 @@ RSpec.describe Asciidoctor::Standoc do
15
15
  script:: Latn
16
16
  type:: prefix
17
17
  isInternational:: true
18
- abbreviationType:: acronym
18
+ abbreviation-type:: acronym
19
19
  pronunciation:: fəɹst
20
20
  domain:: Hydraulics
21
21
  subject:: pipes
22
- usageinfo:: This is usage.
22
+ field-of-application:: Field
23
+ usage-info:: This is usage.
23
24
 
24
25
  [.source]
25
26
  <<ISO2191,section=1>>
@@ -32,7 +33,7 @@ RSpec.describe Asciidoctor::Standoc do
32
33
  type:: suffix
33
34
  domain:: Hydraulics1
34
35
  subject: pipes1
35
- usageinfo:: This is usage 1.
36
+ usage-info:: This is usage 1.
36
37
  absent:: true
37
38
 
38
39
  deprecated:[Fourth Designation]
@@ -41,12 +42,14 @@ RSpec.describe Asciidoctor::Standoc do
41
42
  language:: jp
42
43
  script:: Japn
43
44
  type:: full
45
+ field-of-application:: Field
44
46
  grammar::
45
47
  gender::: masculine, feminine
48
+ number::: singular, plural
46
49
  isPreposition::: false
47
50
  isNoun::: true
48
- grammarValue::: irregular declension
49
- geographicArea:: AUS
51
+ grammar-value::: irregular declension
52
+ geographic-area:: AUS
50
53
 
51
54
  related:see[<<second>>,Fifth Designation]
52
55
 
@@ -55,7 +58,7 @@ RSpec.describe Asciidoctor::Standoc do
55
58
  grammar::
56
59
  gender::: neuter
57
60
  isVerb::: true
58
- geographicArea:: GRC
61
+ geographic-area:: GRC
59
62
 
60
63
  [.source]
61
64
  <<ISO2191,section=2>>
@@ -69,7 +72,7 @@ RSpec.describe Asciidoctor::Standoc do
69
72
  === Second Term
70
73
 
71
74
  [%metadata]
72
- usageinfo::
75
+ usage-info::
73
76
  +
74
77
  --
75
78
  Usage Info 1.
@@ -85,12 +88,14 @@ RSpec.describe Asciidoctor::Standoc do
85
88
  <title>Terms and definitions</title>
86
89
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
87
90
  <term id='term-first-designation'>
88
- <preferred language='fr' script='Latn' type='prefix' isInternational="true">
89
- <expression>
91
+ <preferred>
92
+ <expression language='fr' script='Latn' type='prefix' isInternational="true">
90
93
  <name>First Designation</name>
91
- <abbreviationType>acronym</abbreviationType>
94
+ <abbreviation-type>acronym</abbreviation-type>
92
95
  <pronunciation>f&#601;&#633;st</pronunciation>
93
96
  </expression>
97
+ <field-of-application>Field</field-of-application>
98
+ <usage-info>This is usage.</usage-info>
94
99
  <termsource status='identical' type='authoritative'>
95
100
  <origin bibitemid='ISO2191' type='inline' citeas=''>
96
101
  <localityStack>
@@ -101,26 +106,30 @@ RSpec.describe Asciidoctor::Standoc do
101
106
  </origin>
102
107
  </termsource>
103
108
  </preferred>
104
- <admitted language='he' script='Hebr' type='suffix' absent="true">
105
- <expression>
109
+ <admitted absent="true">
110
+ <expression language='he' script='Hebr' type='suffix'>
106
111
  <name>Third Designation</name>
107
112
  </expression>
113
+ <usage-info>This is usage 1.</usage-info>
108
114
  </admitted>
109
- <deprecates language='jp' script='Japn' type='full' geographicArea="AUS">
110
- <expression>
115
+ <deprecates geographic-area="AUS">
116
+ <expression language='jp' script='Japn' type='full'>
111
117
  <name>Fourth Designation</name>
112
118
  <grammar>
113
119
  <gender>masculine</gender>
114
120
  <gender>feminine</gender>
121
+ <number>singular</number>
122
+ <number>plural</number>
115
123
  <isPreposition>false</isPreposition>
116
124
  <isNoun>true</isNoun>
117
- <grammarValue>irregular declension</grammarValue>
125
+ <grammar-value>irregular declension</grammar-value>
118
126
  </grammar>
119
127
  </expression>
128
+ <field-of-application>Field</field-of-application>
120
129
  </deprecates>
121
- <related type='abbreviation'>
122
- <preferred geographicArea="GRC">
123
- <expression>
130
+ <related type='see'>
131
+ <preferred geographic-area="GRC">
132
+ <expression type="abbreviation">
124
133
  <name>Fifth Designation</name>
125
134
  <grammar>
126
135
  <gender>neuter</gender>
@@ -140,10 +149,9 @@ RSpec.describe Asciidoctor::Standoc do
140
149
  </related>
141
150
  <domain>Hydraulics</domain>
142
151
  <subject>pipes</subject>
143
- <usageinfo>This is usage.</usageinfo>
144
- <definition><verbaldefinition>
152
+ <definition><verbal-definition>
145
153
  <p id='_'>Definition</p>
146
- </verbaldefinition></definition>
154
+ </verbal-definition></definition>
147
155
  <termsource status='identical' type='authoritative'>
148
156
  <origin bibitemid='ISO2191' type='inline' citeas=''>
149
157
  <localityStack>
@@ -159,11 +167,11 @@ RSpec.describe Asciidoctor::Standoc do
159
167
  <expression>
160
168
  <name>Second Term</name>
161
169
  </expression>
162
- </preferred>
163
- <usageinfo>
170
+ <usage-info>
164
171
  <p id='_'>Usage Info 1.</p>
165
172
  <p id='_'>Usage Info 2.</p>
166
- </usageinfo>
173
+ </usage-info>
174
+ </preferred>
167
175
  </term>
168
176
  </terms>
169
177
  </sections>
@@ -255,9 +263,9 @@ RSpec.describe Asciidoctor::Standoc do
255
263
  <tt>seventh-designation</tt>
256
264
  </strong>
257
265
  </related>
258
- <definition><verbaldefinition>
266
+ <definition><verbal-definition>
259
267
  <p id='_'>Definition</p>
260
- </verbaldefinition></definition>
268
+ </verbal-definition></definition>
261
269
  </term>
262
270
  </terms>
263
271
  <clause id='_' inline-header='false' obligation='normative'>
@@ -361,9 +369,9 @@ RSpec.describe Asciidoctor::Standoc do
361
369
  </preferred>
362
370
  <xref target='second'/>
363
371
  </related>
364
- <definition><verbaldefinition>
372
+ <definition><verbal-definition>
365
373
  <p id='_'>Definition</p>
366
- </verbaldefinition></definition>
374
+ </verbal-definition></definition>
367
375
  </term>
368
376
  </terms>
369
377
  </sections>
@@ -401,8 +409,8 @@ RSpec.describe Asciidoctor::Standoc do
401
409
  <title>Terms and definitions</title>
402
410
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
403
411
  <term id='second'>
404
- <preferred isInternational='true'>
405
- <expression>
412
+ <preferred>
413
+ <expression isInternational='true'>
406
414
  <name/>
407
415
  </expression>
408
416
  </preferred>
@@ -424,9 +432,9 @@ RSpec.describe Asciidoctor::Standoc do
424
432
  <related type='see'>
425
433
  <xref target='second'/>
426
434
  </related>
427
- <definition><verbaldefinition>
435
+ <definition><verbal-definition>
428
436
  <p id='_'>Definition</p>
429
- </verbaldefinition></definition>
437
+ </verbal-definition></definition>
430
438
  </term>
431
439
  </terms>
432
440
  </sections>
@@ -494,8 +502,8 @@ RSpec.describe Asciidoctor::Standoc do
494
502
  <title>Terms and definitions</title>
495
503
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
496
504
  <term id='second'>
497
- <preferred isInternational='true'>
498
- <graphical-symbol>
505
+ <preferred>
506
+ <graphical-symbol isInternational='true'>
499
507
  <figure id='_'>
500
508
  <pre id='_'>&lt;LITERAL&gt; FIGURATIVE</pre>
501
509
  </figure>
@@ -526,13 +534,13 @@ RSpec.describe Asciidoctor::Standoc do
526
534
  <xref target='second'/>
527
535
  </related>
528
536
  <definition>
529
- <verbaldefinition><p id='_'>Definition</p></verbaldefinition>
530
- <nonverbalrepresentation>
531
- <figure id='_'>
532
- <name>Caption</name>
533
- <pre id='_'>&lt;LITERAL&gt; FIGURATIVE</pre>
534
- </figure>
535
- </nonverbalrepresentation>
537
+ <verbal-definition>
538
+ <figure id='_'>
539
+ <name>Caption</name>
540
+ <pre id='_'>&lt;LITERAL&gt; FIGURATIVE</pre>
541
+ </figure>
542
+ <p id='_'>Definition</p>
543
+ </verbal-definition>
536
544
  </definition>
537
545
  </term>
538
546
  </terms>
@@ -548,6 +556,7 @@ RSpec.describe Asciidoctor::Standoc do
548
556
  #{ASCIIDOC_BLANK_HDR}
549
557
  == Terms and Definitions
550
558
 
559
+ [[des1]]
551
560
  === First Designation
552
561
 
553
562
  [%metadata]
@@ -555,13 +564,13 @@ RSpec.describe Asciidoctor::Standoc do
555
564
  script:: Latn
556
565
  type:: prefix
557
566
  isInternational:: true
558
- abbreviationType:: acronym
567
+ abbreviation-type:: acronym
559
568
  pronunciation:: fəɹst
560
569
  domain:: Hydraulics
561
570
  subject:: pipes
562
- usageinfo:: This is usage.
571
+ usage-info:: This is usage.
563
572
 
564
- related:see[Fifth Designation]
573
+ related:see[<<des1>>,Fifth Designation]
565
574
 
566
575
  [%metadata]
567
576
  grammar::
@@ -578,7 +587,7 @@ RSpec.describe Asciidoctor::Standoc do
578
587
  gender::: masculine, feminine
579
588
  isPreposition::: false
580
589
  isNoun::: true
581
- grammarValue::: irregular declension
590
+ grammar-value::: irregular declension
582
591
 
583
592
  alt:[Third Designation]
584
593
 
@@ -588,7 +597,7 @@ RSpec.describe Asciidoctor::Standoc do
588
597
  type:: suffix
589
598
  domain:: Hydraulics1
590
599
  subject: pipes1
591
- usageinfo:: This is usage 1.
600
+ usage-info:: This is usage 1.
592
601
 
593
602
  preferred:[Second Designation]
594
603
 
@@ -604,50 +613,47 @@ RSpec.describe Asciidoctor::Standoc do
604
613
  <terms id='_' obligation='normative'>
605
614
  <title>Terms and definitions</title>
606
615
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
607
- <term id='term-first-designation'>
608
- <preferred language='fr' script='Latn' type='prefix' isInternational="true">
609
- <expression>
616
+ <term id='des1'>
617
+ <preferred>
618
+ <expression language='fr' script='Latn' type='prefix' isInternational="true">
610
619
  <name>First Designation</name>
611
- <abbreviationType>acronym</abbreviationType>
620
+ <abbreviation-type>acronym</abbreviation-type>
612
621
  <pronunciation>f&#601;&#633;st</pronunciation>
613
622
  </expression>
623
+ <usage-info>This is usage.</usage-info>
614
624
  </preferred>
615
- <preferred type='abbreviation'>
616
- <expression>
625
+ <preferred>
626
+ <expression type='abbreviation'>
617
627
  <name>Second Designation</name>
618
628
  </expression>
619
629
  </preferred>
620
- <admitted language='he' script='Hebr' type='suffix'>
621
- <expression>
630
+ <admitted>
631
+ <expression language='he' script='Hebr' type='suffix'>
622
632
  <name>Third Designation</name>
623
633
  </expression>
634
+ <usage-info>This is usage 1.</usage-info>
624
635
  </admitted>
625
- <deprecates language='jp' script='Japn' type='full'>
626
- <expression>
636
+ <deprecates>
637
+ <expression language='jp' script='Japn' type='full'>
627
638
  <name>Fourth Designation</name>
628
639
  <grammar>
629
640
  <gender>masculine</gender>
630
641
  <gender>feminine</gender>
631
642
  <isPreposition>false</isPreposition>
632
643
  <isNoun>true</isNoun>
633
- <grammarValue>irregular declension</grammarValue>
644
+ <grammar-value>irregular declension</grammar-value>
634
645
  </grammar>
635
646
  </expression>
636
647
  </deprecates>
637
648
  <related type='see'>
638
- <strong>
639
- term
640
- <tt>Fifth Designation</tt>
641
- not resolved via ID
642
- <tt>fifth-designation</tt>
643
- </strong>
649
+ <preferred><expression><name>Fifth Designation</name><grammar><gender>neuter</gender></grammar></expression>
650
+ </preferred><xref target='des1'/>
644
651
  </related>
645
652
  <domain>Hydraulics</domain>
646
653
  <subject>pipes</subject>
647
- <usageinfo>This is usage.</usageinfo>
648
- <definition><verbaldefinition>
654
+ <definition><verbal-definition>
649
655
  <p id='_'>Definition</p>
650
- </verbaldefinition></definition>
656
+ </verbal-definition></definition>
651
657
  </term>
652
658
  </terms>
653
659
  </sections>
@@ -690,7 +696,7 @@ RSpec.describe Asciidoctor::Standoc do
690
696
  <mn>91</mn>
691
697
  </mrow>
692
698
  </msub></math></stem></name></letter-symbol></admitted>
693
- <definition><verbaldefinition><p id="_">Time</p></verbaldefinition></definition></term>
699
+ <definition><verbal-definition><p id="_">Time</p></verbal-definition></definition></term>
694
700
  </terms>
695
701
  </sections>
696
702
  </standard-document>
@@ -722,15 +728,14 @@ RSpec.describe Asciidoctor::Standoc do
722
728
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
723
729
  <term id="term-tempus">
724
730
  <preferred><expression><name>Tempus</name></expression></preferred>
725
- <domain>relativity</domain><definition><verbaldefinition><p id="_"> Time</p></verbaldefinition></definition>
731
+ <domain>relativity</domain><definition><verbal-definition><p id="_"> Time</p></verbal-definition></definition>
726
732
  </term>
727
733
  <term id='term-tempus1'>
728
734
  <preferred><expression><name>Tempus1</name></expression></preferred>
729
735
  <domain>relativity2</domain>
730
- <definition><verbaldefinition>
736
+ <definition><verbal-definition>
731
737
  <p id='_'>Time2</p>
732
- <p id='_'> </p>
733
- </verbaldefinition></definition>
738
+ </verbal-definition></definition>
734
739
  </term>
735
740
  </terms>
736
741
  </sections>
@@ -759,6 +764,17 @@ RSpec.describe Asciidoctor::Standoc do
759
764
  ++++
760
765
 
761
766
  This paragraph is extraneous
767
+
768
+ * This is a list
769
+
770
+ []
771
+ . This too is a list
772
+
773
+ []
774
+ This is:: another list
775
+
776
+
777
+ This is a concluding paragraph
762
778
  INPUT
763
779
  output = <<~OUTPUT
764
780
  #{BLANK_HDR}
@@ -774,18 +790,45 @@ RSpec.describe Asciidoctor::Standoc do
774
790
  <mn>90</mn>
775
791
  </mrow>
776
792
  </msub></math></stem></name></letter-symbol></preferred>
793
+ <admitted>
794
+ <letter-symbol>
795
+ <name>
796
+ <stem type='MathML'>
797
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
798
+ <msub>
799
+ <mrow>
800
+ <mi>t</mi>
801
+ </mrow>
802
+ <mrow>
803
+ <mi>A</mi>
804
+ </mrow>
805
+ </msub>
806
+ </math>
807
+ </stem>
808
+ </name>
809
+ </letter-symbol>
810
+ </admitted>
777
811
  <definition>
778
- <verbaldefinition><p id="_">This paragraph is extraneous</p></verbaldefinition>
779
- <nonverbalrepresentation><formula id="_">
780
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
781
- <mrow>
782
- <mi>t</mi>
783
- </mrow>
784
- <mrow>
785
- <mi>A</mi>
786
- </mrow>
787
- </msub></math></stem>
788
- </formula></nonverbalrepresentation>
812
+ <verbal-definition>
813
+ <p id="_">This paragraph is extraneous</p>
814
+ <ul id='_'>
815
+ <li>
816
+ <p id='_'>This is a list</p>
817
+ </li>
818
+ </ul>
819
+ <ol id='_' type='arabic'>
820
+ <li>
821
+ <p id='_'>This too is a list</p>
822
+ </li>
823
+ </ol>
824
+ <dl id='_'>
825
+ <dt>This is</dt>
826
+ <dd>
827
+ <p id='_'>another list</p>
828
+ </dd>
829
+ </dl>
830
+ <p id='_'>This is a concluding paragraph</p>
831
+ </verbal-definition>
789
832
  </definition>
790
833
  </term>
791
834
  </terms>
@@ -826,7 +869,7 @@ RSpec.describe Asciidoctor::Standoc do
826
869
  <title>Terms and definitions</title>
827
870
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
828
871
  <term id="term-term"><preferred><expression><name>Term</name></expression></preferred>
829
- <definition><verbaldefinition><p id='_'>Definition</p></verbaldefinition></definition>
872
+ <definition><verbal-definition><p id='_'>Definition</p></verbal-definition></definition>
830
873
  <termnote id="_">
831
874
  <p id="_">Note</p>
832
875
  </termnote><termnote id="_">
@@ -865,7 +908,10 @@ RSpec.describe Asciidoctor::Standoc do
865
908
 
866
909
  [.source]
867
910
  <<ISO2191,section=1>>
911
+ --
868
912
 
913
+ [.definition]
914
+ --
869
915
  |===
870
916
  | A | B
871
917
 
@@ -908,7 +954,7 @@ RSpec.describe Asciidoctor::Standoc do
908
954
  </expression>
909
955
  </preferred>
910
956
  <definition>
911
- <verbaldefinition>
957
+ <verbal-definition>
912
958
  <p id='_'>Definition</p>
913
959
  <termsource status='identical' type='authoritative'>
914
960
  <origin bibitemid='ISO2191' type='inline' citeas=''>
@@ -919,8 +965,8 @@ RSpec.describe Asciidoctor::Standoc do
919
965
  </localityStack>
920
966
  </origin>
921
967
  </termsource>
922
- </verbaldefinition>
923
- <nonverbalrepresentation>
968
+ </verbal-definition>
969
+ <non-verbal-representation>
924
970
  <table id='_'>
925
971
  <thead>
926
972
  <tr>
@@ -935,7 +981,7 @@ RSpec.describe Asciidoctor::Standoc do
935
981
  </tr>
936
982
  </tbody>
937
983
  </table>
938
- </nonverbalrepresentation>
984
+ </non-verbal-representation>
939
985
  </definition>
940
986
  <termsource status='identical' type='authoritative'>
941
987
  <origin bibitemid='ISO2191' type='inline' citeas=''>
@@ -954,7 +1000,7 @@ RSpec.describe Asciidoctor::Standoc do
954
1000
  </expression>
955
1001
  </preferred>
956
1002
  <definition>
957
- <nonverbalrepresentation>
1003
+ <non-verbal-representation>
958
1004
  <figure id='_'>
959
1005
  <pre id='_'>Literal</pre>
960
1006
  </figure>
@@ -976,7 +1022,7 @@ RSpec.describe Asciidoctor::Standoc do
976
1022
  </localityStack>
977
1023
  </origin>
978
1024
  </termsource>
979
- </nonverbalrepresentation>
1025
+ </non-verbal-representation>
980
1026
  </definition>
981
1027
  </term>
982
1028
  </terms>
@@ -987,4 +1033,317 @@ RSpec.describe Asciidoctor::Standoc do
987
1033
  .to be_equivalent_to xmlpp(output)
988
1034
  end
989
1035
 
1036
+ it "differentiates stem expressions before, after, and within verbal definitions" do
1037
+ input = <<~INPUT
1038
+ #{ASCIIDOC_BLANK_HDR}
1039
+
1040
+ == Terms and definitions
1041
+
1042
+ === Term
1043
+
1044
+ stem:[lambda]
1045
+
1046
+ [.definition]
1047
+ --
1048
+
1049
+ Definition
1050
+
1051
+ stem:[mu]
1052
+ --
1053
+
1054
+ [.definition]
1055
+ --
1056
+
1057
+ stem:[nu]
1058
+ --
1059
+
1060
+ INPUT
1061
+ output = <<~OUTPUT
1062
+ #{BLANK_HDR}
1063
+ <sections>
1064
+ <terms id='_' obligation='normative'>
1065
+ <title>Terms and definitions</title>
1066
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1067
+ <term id='term-term'>
1068
+ <preferred>
1069
+ <expression>
1070
+ <name>Term</name>
1071
+ </expression>
1072
+ </preferred>
1073
+ <admitted>
1074
+ <letter-symbol>
1075
+ <name>
1076
+ <stem type='MathML'>
1077
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1078
+ <mi>&#955;</mi>
1079
+ </math>
1080
+ </stem>
1081
+ </name>
1082
+ </letter-symbol>
1083
+ </admitted>
1084
+ <definition>
1085
+ <verbal-definition>
1086
+ <p id='_'>Definition</p>
1087
+ <p id='_'>
1088
+ <stem type='MathML'>
1089
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1090
+ <mi>&#956;</mi>
1091
+ </math>
1092
+ </stem>
1093
+ </p>
1094
+ </verbal-definition>
1095
+ </definition>
1096
+ <definition>
1097
+ <verbal-definition>
1098
+ <p id='_'>
1099
+ <stem type='MathML'>
1100
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1101
+ <mi>&#957;</mi>
1102
+ </math>
1103
+ </stem>
1104
+ </p>
1105
+ </verbal-definition>
1106
+ </definition>
1107
+ </term>
1108
+ </terms>
1109
+ </sections>
1110
+ </standard-document>
1111
+ OUTPUT
1112
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1113
+ .to be_equivalent_to xmlpp(output)
1114
+ end
1115
+
1116
+ it "differentiates formuals before, after, and within verbal definitions" do
1117
+ input = <<~INPUT
1118
+ #{ASCIIDOC_BLANK_HDR}
1119
+
1120
+ == Terms and definitions
1121
+
1122
+ === Term
1123
+
1124
+ [stem]
1125
+ ++++
1126
+ lambda
1127
+ ++++
1128
+
1129
+ [.definition]
1130
+ --
1131
+
1132
+ Definition
1133
+
1134
+ [stem]
1135
+ ++++
1136
+ mu
1137
+ ++++
1138
+ --
1139
+
1140
+ [.definition]
1141
+ --
1142
+
1143
+ [stem]
1144
+ ++++
1145
+ nu
1146
+ ++++
1147
+ --
1148
+
1149
+ INPUT
1150
+ output = <<~OUTPUT
1151
+ #{BLANK_HDR}
1152
+ <sections>
1153
+ <terms id='_' obligation='normative'>
1154
+ <title>Terms and definitions</title>
1155
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1156
+ <term id='term-term'>
1157
+ <preferred>
1158
+ <expression>
1159
+ <name>Term</name>
1160
+ </expression>
1161
+ </preferred>
1162
+ <admitted>
1163
+ <letter-symbol>
1164
+ <name>
1165
+ <stem type='MathML'>
1166
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1167
+ <mi>&#955;</mi>
1168
+ </math>
1169
+ </stem>
1170
+ </name>
1171
+ </letter-symbol>
1172
+ </admitted>
1173
+ <definition>
1174
+ <verbal-definition>
1175
+ <p id='_'>Definition</p>
1176
+ <formula id='_'>
1177
+ <stem type='MathML'>
1178
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1179
+ <mi>&#956;</mi>
1180
+ </math>
1181
+ </stem>
1182
+ </formula>
1183
+ </verbal-definition>
1184
+ <non-verbal-representation>
1185
+ <formula id='_'>
1186
+ <stem type='MathML'>
1187
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1188
+ <mi>&#957;</mi>
1189
+ </math>
1190
+ </stem>
1191
+ </formula>
1192
+ </non-verbal-representation>
1193
+ </definition>
1194
+ </term>
1195
+ </terms>
1196
+ </sections>
1197
+ </standard-document>
1198
+ OUTPUT
1199
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1200
+ .to be_equivalent_to xmlpp(output)
1201
+ end
1202
+
1203
+ it "automatically indexes term indexes" do
1204
+ input = <<~INPUT
1205
+ #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:\n/, ":nodoc:\n:index-terms:\n")}
1206
+
1207
+ == Terms and definitions
1208
+
1209
+ === Term
1210
+
1211
+ [stem]
1212
+ ++++
1213
+ lambda
1214
+ ++++
1215
+
1216
+ admitted:[x]
1217
+
1218
+ === Term2
1219
+
1220
+ preferred:[stem:[mu_0 // 2]]
1221
+
1222
+ == Symbols and Abbreviated Terms
1223
+
1224
+ x^2^:: Definition
1225
+ INPUT
1226
+ output = <<~OUTPUT
1227
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='1.11.2'>
1228
+ <bibdata type='standard'>
1229
+ <title language='en' format='text/plain'>Document title</title>
1230
+ <language>en</language>
1231
+ <script>Latn</script>
1232
+ <status>
1233
+ <stage>published</stage>
1234
+ </status>
1235
+ <copyright>
1236
+ <from>2021</from>
1237
+ </copyright>
1238
+ <ext>
1239
+ <doctype>article</doctype>
1240
+ </ext>
1241
+ </bibdata>
1242
+ <sections>
1243
+ <terms id='_' obligation='normative'>
1244
+ <title>Terms and definitions</title>
1245
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1246
+ <term id='term-term'>
1247
+ <preferred>
1248
+ <expression>
1249
+ <name>
1250
+ Term
1251
+ <index>
1252
+ <primary>Term</primary>
1253
+ </index>
1254
+ </name>
1255
+ </expression>
1256
+ </preferred>
1257
+ <admitted>
1258
+ <letter-symbol>
1259
+ <name>
1260
+ <stem type='MathML'>
1261
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1262
+ <mi>&#955;</mi>
1263
+ </math>
1264
+ </stem>
1265
+ </name>
1266
+ </letter-symbol>
1267
+ </admitted>
1268
+ <definition>
1269
+ <verbal-definition>
1270
+ <p id='_'>admitted:[x]</p>
1271
+ </verbal-definition>
1272
+ </definition>
1273
+ </term>
1274
+ <term id='term-term2'>
1275
+ <preferred>
1276
+ <expression>
1277
+ <name>
1278
+ Term2
1279
+ <index>
1280
+ <primary>Term2</primary>
1281
+ </index>
1282
+ </name>
1283
+ </expression>
1284
+ </preferred>
1285
+ <preferred>
1286
+ <letter-symbol>
1287
+ <name>
1288
+ <stem type='MathML'>
1289
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1290
+ <msub>
1291
+ <mrow>
1292
+ <mi>&#956;</mi>
1293
+ </mrow>
1294
+ <mrow>
1295
+ <mn>0</mn>
1296
+ </mrow>
1297
+ </msub>
1298
+ <mo>/</mo>
1299
+ <mn>2</mn>
1300
+ </math>
1301
+ </stem>
1302
+ <index>
1303
+ <primary>
1304
+ <stem type='MathML'>
1305
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1306
+ <msub>
1307
+ <mrow>
1308
+ <mi>&#956;</mi>
1309
+ </mrow>
1310
+ <mrow>
1311
+ <mn>0</mn>
1312
+ </mrow>
1313
+ </msub>
1314
+ <mo>/</mo>
1315
+ <mn>2</mn>
1316
+ </math>
1317
+ </stem>
1318
+ </primary>
1319
+ </index>
1320
+ </name>
1321
+ </letter-symbol>
1322
+ </preferred>
1323
+ </term>
1324
+ </terms>
1325
+ <definitions id='_' obligation='normative'>
1326
+ <title>Symbols and abbreviated terms</title>
1327
+ <dl id='_'>
1328
+ <dt id='symbol-x2'>
1329
+ x
1330
+ <sup>2</sup>
1331
+ <index>
1332
+ <primary>
1333
+ x
1334
+ <sup>2</sup>
1335
+ </primary>
1336
+ </index>
1337
+ </dt>
1338
+ <dd>
1339
+ <p id='_'>Definition</p>
1340
+ </dd>
1341
+ </dl>
1342
+ </definitions>
1343
+ </sections>
1344
+ </standard-document>
1345
+ OUTPUT
1346
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1347
+ .to be_equivalent_to xmlpp(output)
1348
+ end
990
1349
  end