metanorma-standoc 1.11.0.1 → 1.11.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) 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 +58 -21
  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 +13 -9
  17. data/lib/asciidoctor/standoc/inline.rb +13 -11
  18. data/lib/asciidoctor/standoc/isodoc.rng +73 -19
  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 +16 -6
  23. data/lib/asciidoctor/standoc/render.rb +115 -0
  24. data/lib/asciidoctor/standoc/reqt.rb +1 -1
  25. data/lib/asciidoctor/standoc/section.rb +33 -15
  26. data/lib/asciidoctor/standoc/terms.rb +7 -1
  27. data/lib/asciidoctor/standoc/utils.rb +0 -16
  28. data/lib/asciidoctor/standoc/validate.rb +1 -1
  29. data/lib/isodoc/html/htmlstyle.css +20 -11
  30. data/lib/isodoc/html/htmlstyle.scss +11 -11
  31. data/lib/metanorma/standoc/version.rb +1 -1
  32. data/metanorma-standoc.gemspec +3 -3
  33. data/spec/asciidoctor/base_spec.rb +48 -0
  34. data/spec/asciidoctor/blocks_spec.rb +99 -17
  35. data/spec/asciidoctor/cleanup_blocks_spec.rb +24 -0
  36. data/spec/asciidoctor/cleanup_sections_spec.rb +1 -1
  37. data/spec/asciidoctor/cleanup_spec.rb +6 -6
  38. data/spec/asciidoctor/cleanup_terms_spec.rb +556 -89
  39. data/spec/asciidoctor/datamodel/attributes_table_preprocessor_spec.rb +21 -21
  40. data/spec/asciidoctor/datamodel/diagram_preprocessor_spec.rb +16 -16
  41. data/spec/asciidoctor/inline_spec.rb +174 -5
  42. data/spec/asciidoctor/isobib_cache_spec.rb +4 -8
  43. data/spec/asciidoctor/macros_spec.rb +2 -2
  44. data/spec/asciidoctor/refs_dl_spec.rb +4 -4
  45. data/spec/asciidoctor/refs_spec.rb +889 -495
  46. data/spec/asciidoctor/section_spec.rb +64 -2
  47. data/spec/spec_helper.rb +2 -2
  48. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +182 -182
  49. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +12 -12
  50. data/spec/vcr_cassettes/isobib_get_123.yml +14 -14
  51. data/spec/vcr_cassettes/isobib_get_123_1.yml +99 -99
  52. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +107 -107
  53. data/spec/vcr_cassettes/isobib_get_123_2001.yml +14 -14
  54. data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
  55. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  56. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
  57. 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>
@@ -699,6 +705,114 @@ RSpec.describe Asciidoctor::Standoc do
699
705
  .to be_equivalent_to xmlpp(output)
700
706
  end
701
707
 
708
+ it "differentiates stem-only and mixed terms" do
709
+ input = <<~INPUT
710
+ #{ASCIIDOC_BLANK_HDR}
711
+ == Terms and Definitions
712
+
713
+ === stem:[t_90]
714
+
715
+ Time
716
+
717
+ === stem:[t_90]-sensitivity
718
+
719
+ Sensitivity
720
+
721
+ === sensitivity to stem:[t_90]
722
+
723
+ Sensitivity #2
724
+ INPUT
725
+ output = <<~OUTPUT
726
+ #{BLANK_HDR}
727
+ <sections>
728
+ <terms id='_' obligation='normative'>
729
+ <title>Terms and definitions</title>
730
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
731
+ <term id='term-_-t90-'>
732
+ <preferred>
733
+ <letter-symbol>
734
+ <name>
735
+ <stem type='MathML'>
736
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
737
+ <msub>
738
+ <mrow>
739
+ <mi>t</mi>
740
+ </mrow>
741
+ <mrow>
742
+ <mn>90</mn>
743
+ </mrow>
744
+ </msub>
745
+ </math>
746
+ </stem>
747
+ </name>
748
+ </letter-symbol>
749
+ </preferred>
750
+ <definition>
751
+ <verbal-definition>
752
+ <p id='_'>Time</p>
753
+ </verbal-definition>
754
+ </definition>
755
+ </term>
756
+ <term id='term-t90-sensitivity'>
757
+ <preferred>
758
+ <expression>
759
+ <name>
760
+ <stem type='MathML'>
761
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
762
+ <msub>
763
+ <mrow>
764
+ <mi>t</mi>
765
+ </mrow>
766
+ <mrow>
767
+ <mn>90</mn>
768
+ </mrow>
769
+ </msub>
770
+ </math>
771
+ </stem>
772
+ -sensitivity
773
+ </name>
774
+ </expression>
775
+ </preferred>
776
+ <definition>
777
+ <verbal-definition>
778
+ <p id='_'>Sensitivity</p>
779
+ </verbal-definition>
780
+ </definition>
781
+ </term>
782
+ <term id='term-sensitivity-to-t90'>
783
+ <preferred>
784
+ <expression>
785
+ <name>
786
+ sensitivity to
787
+ <stem type='MathML'>
788
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
789
+ <msub>
790
+ <mrow>
791
+ <mi>t</mi>
792
+ </mrow>
793
+ <mrow>
794
+ <mn>90</mn>
795
+ </mrow>
796
+ </msub>
797
+ </math>
798
+ </stem>
799
+ </name>
800
+ </expression>
801
+ </preferred>
802
+ <definition>
803
+ <verbal-definition>
804
+ <p id='_'>Sensitivity #2</p>
805
+ </verbal-definition>
806
+ </definition>
807
+ </term>
808
+ </terms>
809
+ </sections>
810
+ </standard-document>
811
+ OUTPUT
812
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
813
+ .to be_equivalent_to xmlpp(output)
814
+ end
815
+
702
816
  it "moves term domains out of the term definition paragraph" do
703
817
  input = <<~INPUT
704
818
  #{ASCIIDOC_BLANK_HDR}
@@ -722,15 +836,14 @@ RSpec.describe Asciidoctor::Standoc do
722
836
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
723
837
  <term id="term-tempus">
724
838
  <preferred><expression><name>Tempus</name></expression></preferred>
725
- <domain>relativity</domain><definition><verbaldefinition><p id="_"> Time</p></verbaldefinition></definition>
839
+ <domain>relativity</domain><definition><verbal-definition><p id="_"> Time</p></verbal-definition></definition>
726
840
  </term>
727
841
  <term id='term-tempus1'>
728
842
  <preferred><expression><name>Tempus1</name></expression></preferred>
729
843
  <domain>relativity2</domain>
730
- <definition><verbaldefinition>
844
+ <definition><verbal-definition>
731
845
  <p id='_'>Time2</p>
732
- <p id='_'> </p>
733
- </verbaldefinition></definition>
846
+ </verbal-definition></definition>
734
847
  </term>
735
848
  </terms>
736
849
  </sections>
@@ -759,6 +872,17 @@ RSpec.describe Asciidoctor::Standoc do
759
872
  ++++
760
873
 
761
874
  This paragraph is extraneous
875
+
876
+ * This is a list
877
+
878
+ []
879
+ . This too is a list
880
+
881
+ []
882
+ This is:: another list
883
+
884
+
885
+ This is a concluding paragraph
762
886
  INPUT
763
887
  output = <<~OUTPUT
764
888
  #{BLANK_HDR}
@@ -774,18 +898,45 @@ RSpec.describe Asciidoctor::Standoc do
774
898
  <mn>90</mn>
775
899
  </mrow>
776
900
  </msub></math></stem></name></letter-symbol></preferred>
901
+ <admitted>
902
+ <letter-symbol>
903
+ <name>
904
+ <stem type='MathML'>
905
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
906
+ <msub>
907
+ <mrow>
908
+ <mi>t</mi>
909
+ </mrow>
910
+ <mrow>
911
+ <mi>A</mi>
912
+ </mrow>
913
+ </msub>
914
+ </math>
915
+ </stem>
916
+ </name>
917
+ </letter-symbol>
918
+ </admitted>
777
919
  <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>
920
+ <verbal-definition>
921
+ <p id="_">This paragraph is extraneous</p>
922
+ <ul id='_'>
923
+ <li>
924
+ <p id='_'>This is a list</p>
925
+ </li>
926
+ </ul>
927
+ <ol id='_' type='arabic'>
928
+ <li>
929
+ <p id='_'>This too is a list</p>
930
+ </li>
931
+ </ol>
932
+ <dl id='_'>
933
+ <dt>This is</dt>
934
+ <dd>
935
+ <p id='_'>another list</p>
936
+ </dd>
937
+ </dl>
938
+ <p id='_'>This is a concluding paragraph</p>
939
+ </verbal-definition>
789
940
  </definition>
790
941
  </term>
791
942
  </terms>
@@ -826,7 +977,7 @@ RSpec.describe Asciidoctor::Standoc do
826
977
  <title>Terms and definitions</title>
827
978
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
828
979
  <term id="term-term"><preferred><expression><name>Term</name></expression></preferred>
829
- <definition><verbaldefinition><p id='_'>Definition</p></verbaldefinition></definition>
980
+ <definition><verbal-definition><p id='_'>Definition</p></verbal-definition></definition>
830
981
  <termnote id="_">
831
982
  <p id="_">Note</p>
832
983
  </termnote><termnote id="_">
@@ -865,7 +1016,10 @@ RSpec.describe Asciidoctor::Standoc do
865
1016
 
866
1017
  [.source]
867
1018
  <<ISO2191,section=1>>
1019
+ --
868
1020
 
1021
+ [.definition]
1022
+ --
869
1023
  |===
870
1024
  | A | B
871
1025
 
@@ -908,7 +1062,7 @@ RSpec.describe Asciidoctor::Standoc do
908
1062
  </expression>
909
1063
  </preferred>
910
1064
  <definition>
911
- <verbaldefinition>
1065
+ <verbal-definition>
912
1066
  <p id='_'>Definition</p>
913
1067
  <termsource status='identical' type='authoritative'>
914
1068
  <origin bibitemid='ISO2191' type='inline' citeas=''>
@@ -919,8 +1073,8 @@ RSpec.describe Asciidoctor::Standoc do
919
1073
  </localityStack>
920
1074
  </origin>
921
1075
  </termsource>
922
- </verbaldefinition>
923
- <nonverbalrepresentation>
1076
+ </verbal-definition>
1077
+ <non-verbal-representation>
924
1078
  <table id='_'>
925
1079
  <thead>
926
1080
  <tr>
@@ -935,7 +1089,7 @@ RSpec.describe Asciidoctor::Standoc do
935
1089
  </tr>
936
1090
  </tbody>
937
1091
  </table>
938
- </nonverbalrepresentation>
1092
+ </non-verbal-representation>
939
1093
  </definition>
940
1094
  <termsource status='identical' type='authoritative'>
941
1095
  <origin bibitemid='ISO2191' type='inline' citeas=''>
@@ -954,7 +1108,7 @@ RSpec.describe Asciidoctor::Standoc do
954
1108
  </expression>
955
1109
  </preferred>
956
1110
  <definition>
957
- <nonverbalrepresentation>
1111
+ <non-verbal-representation>
958
1112
  <figure id='_'>
959
1113
  <pre id='_'>Literal</pre>
960
1114
  </figure>
@@ -976,7 +1130,7 @@ RSpec.describe Asciidoctor::Standoc do
976
1130
  </localityStack>
977
1131
  </origin>
978
1132
  </termsource>
979
- </nonverbalrepresentation>
1133
+ </non-verbal-representation>
980
1134
  </definition>
981
1135
  </term>
982
1136
  </terms>
@@ -987,4 +1141,317 @@ RSpec.describe Asciidoctor::Standoc do
987
1141
  .to be_equivalent_to xmlpp(output)
988
1142
  end
989
1143
 
1144
+ it "differentiates stem expressions before, after, and within verbal definitions" do
1145
+ input = <<~INPUT
1146
+ #{ASCIIDOC_BLANK_HDR}
1147
+
1148
+ == Terms and definitions
1149
+
1150
+ === Term
1151
+
1152
+ stem:[lambda]
1153
+
1154
+ [.definition]
1155
+ --
1156
+
1157
+ Definition
1158
+
1159
+ stem:[mu]
1160
+ --
1161
+
1162
+ [.definition]
1163
+ --
1164
+
1165
+ stem:[nu]
1166
+ --
1167
+
1168
+ INPUT
1169
+ output = <<~OUTPUT
1170
+ #{BLANK_HDR}
1171
+ <sections>
1172
+ <terms id='_' obligation='normative'>
1173
+ <title>Terms and definitions</title>
1174
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1175
+ <term id='term-term'>
1176
+ <preferred>
1177
+ <expression>
1178
+ <name>Term</name>
1179
+ </expression>
1180
+ </preferred>
1181
+ <admitted>
1182
+ <letter-symbol>
1183
+ <name>
1184
+ <stem type='MathML'>
1185
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1186
+ <mi>&#955;</mi>
1187
+ </math>
1188
+ </stem>
1189
+ </name>
1190
+ </letter-symbol>
1191
+ </admitted>
1192
+ <definition>
1193
+ <verbal-definition>
1194
+ <p id='_'>Definition</p>
1195
+ <p id='_'>
1196
+ <stem type='MathML'>
1197
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1198
+ <mi>&#956;</mi>
1199
+ </math>
1200
+ </stem>
1201
+ </p>
1202
+ </verbal-definition>
1203
+ </definition>
1204
+ <definition>
1205
+ <verbal-definition>
1206
+ <p id='_'>
1207
+ <stem type='MathML'>
1208
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1209
+ <mi>&#957;</mi>
1210
+ </math>
1211
+ </stem>
1212
+ </p>
1213
+ </verbal-definition>
1214
+ </definition>
1215
+ </term>
1216
+ </terms>
1217
+ </sections>
1218
+ </standard-document>
1219
+ OUTPUT
1220
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1221
+ .to be_equivalent_to xmlpp(output)
1222
+ end
1223
+
1224
+ it "differentiates formuals before, after, and within verbal definitions" do
1225
+ input = <<~INPUT
1226
+ #{ASCIIDOC_BLANK_HDR}
1227
+
1228
+ == Terms and definitions
1229
+
1230
+ === Term
1231
+
1232
+ [stem]
1233
+ ++++
1234
+ lambda
1235
+ ++++
1236
+
1237
+ [.definition]
1238
+ --
1239
+
1240
+ Definition
1241
+
1242
+ [stem]
1243
+ ++++
1244
+ mu
1245
+ ++++
1246
+ --
1247
+
1248
+ [.definition]
1249
+ --
1250
+
1251
+ [stem]
1252
+ ++++
1253
+ nu
1254
+ ++++
1255
+ --
1256
+
1257
+ INPUT
1258
+ output = <<~OUTPUT
1259
+ #{BLANK_HDR}
1260
+ <sections>
1261
+ <terms id='_' obligation='normative'>
1262
+ <title>Terms and definitions</title>
1263
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1264
+ <term id='term-term'>
1265
+ <preferred>
1266
+ <expression>
1267
+ <name>Term</name>
1268
+ </expression>
1269
+ </preferred>
1270
+ <admitted>
1271
+ <letter-symbol>
1272
+ <name>
1273
+ <stem type='MathML'>
1274
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1275
+ <mi>&#955;</mi>
1276
+ </math>
1277
+ </stem>
1278
+ </name>
1279
+ </letter-symbol>
1280
+ </admitted>
1281
+ <definition>
1282
+ <verbal-definition>
1283
+ <p id='_'>Definition</p>
1284
+ <formula id='_'>
1285
+ <stem type='MathML'>
1286
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1287
+ <mi>&#956;</mi>
1288
+ </math>
1289
+ </stem>
1290
+ </formula>
1291
+ </verbal-definition>
1292
+ <non-verbal-representation>
1293
+ <formula id='_'>
1294
+ <stem type='MathML'>
1295
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1296
+ <mi>&#957;</mi>
1297
+ </math>
1298
+ </stem>
1299
+ </formula>
1300
+ </non-verbal-representation>
1301
+ </definition>
1302
+ </term>
1303
+ </terms>
1304
+ </sections>
1305
+ </standard-document>
1306
+ OUTPUT
1307
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1308
+ .to be_equivalent_to xmlpp(output)
1309
+ end
1310
+
1311
+ it "automatically indexes term indexes" do
1312
+ input = <<~INPUT
1313
+ #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:\n/, ":nodoc:\n:index-terms:\n")}
1314
+
1315
+ == Terms and definitions
1316
+
1317
+ === Term
1318
+
1319
+ [stem]
1320
+ ++++
1321
+ lambda
1322
+ ++++
1323
+
1324
+ admitted:[x]
1325
+
1326
+ === Term2
1327
+
1328
+ preferred:[stem:[mu_0 // 2]]
1329
+
1330
+ == Symbols and Abbreviated Terms
1331
+
1332
+ x^2^:: Definition
1333
+ INPUT
1334
+ output = <<~OUTPUT
1335
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Standoc::VERSION}'>
1336
+ <bibdata type='standard'>
1337
+ <title language='en' format='text/plain'>Document title</title>
1338
+ <language>en</language>
1339
+ <script>Latn</script>
1340
+ <status>
1341
+ <stage>published</stage>
1342
+ </status>
1343
+ <copyright>
1344
+ <from>2021</from>
1345
+ </copyright>
1346
+ <ext>
1347
+ <doctype>article</doctype>
1348
+ </ext>
1349
+ </bibdata>
1350
+ <sections>
1351
+ <terms id='_' obligation='normative'>
1352
+ <title>Terms and definitions</title>
1353
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1354
+ <term id='term-term'>
1355
+ <preferred>
1356
+ <expression>
1357
+ <name>
1358
+ Term
1359
+ <index>
1360
+ <primary>Term</primary>
1361
+ </index>
1362
+ </name>
1363
+ </expression>
1364
+ </preferred>
1365
+ <admitted>
1366
+ <letter-symbol>
1367
+ <name>
1368
+ <stem type='MathML'>
1369
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1370
+ <mi>&#955;</mi>
1371
+ </math>
1372
+ </stem>
1373
+ </name>
1374
+ </letter-symbol>
1375
+ </admitted>
1376
+ <definition>
1377
+ <verbal-definition>
1378
+ <p id='_'>admitted:[x]</p>
1379
+ </verbal-definition>
1380
+ </definition>
1381
+ </term>
1382
+ <term id='term-term2'>
1383
+ <preferred>
1384
+ <expression>
1385
+ <name>
1386
+ Term2
1387
+ <index>
1388
+ <primary>Term2</primary>
1389
+ </index>
1390
+ </name>
1391
+ </expression>
1392
+ </preferred>
1393
+ <preferred>
1394
+ <letter-symbol>
1395
+ <name>
1396
+ <stem type='MathML'>
1397
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1398
+ <msub>
1399
+ <mrow>
1400
+ <mi>&#956;</mi>
1401
+ </mrow>
1402
+ <mrow>
1403
+ <mn>0</mn>
1404
+ </mrow>
1405
+ </msub>
1406
+ <mo>/</mo>
1407
+ <mn>2</mn>
1408
+ </math>
1409
+ </stem>
1410
+ <index>
1411
+ <primary>
1412
+ <stem type='MathML'>
1413
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1414
+ <msub>
1415
+ <mrow>
1416
+ <mi>&#956;</mi>
1417
+ </mrow>
1418
+ <mrow>
1419
+ <mn>0</mn>
1420
+ </mrow>
1421
+ </msub>
1422
+ <mo>/</mo>
1423
+ <mn>2</mn>
1424
+ </math>
1425
+ </stem>
1426
+ </primary>
1427
+ </index>
1428
+ </name>
1429
+ </letter-symbol>
1430
+ </preferred>
1431
+ </term>
1432
+ </terms>
1433
+ <definitions id='_' obligation='normative'>
1434
+ <title>Symbols and abbreviated terms</title>
1435
+ <dl id='_'>
1436
+ <dt id='symbol-x2'>
1437
+ x
1438
+ <sup>2</sup>
1439
+ <index>
1440
+ <primary>
1441
+ x
1442
+ <sup>2</sup>
1443
+ </primary>
1444
+ </index>
1445
+ </dt>
1446
+ <dd>
1447
+ <p id='_'>Definition</p>
1448
+ </dd>
1449
+ </dl>
1450
+ </definitions>
1451
+ </sections>
1452
+ </standard-document>
1453
+ OUTPUT
1454
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1455
+ .to be_equivalent_to xmlpp(output)
1456
+ end
990
1457
  end