metanorma-standoc 1.11.2 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -31
  3. data/.gitignore +23 -0
  4. data/Gemfile +1 -0
  5. data/lib/asciidoctor/standoc/base.rb +2 -241
  6. data/lib/asciidoctor/standoc/blocks.rb +2 -238
  7. data/lib/asciidoctor/standoc/blocks_notes.rb +2 -100
  8. data/lib/asciidoctor/standoc/cleanup.rb +2 -207
  9. data/lib/asciidoctor/standoc/cleanup_amend.rb +2 -53
  10. data/lib/asciidoctor/standoc/cleanup_block.rb +2 -173
  11. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +2 -212
  12. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +2 -108
  13. data/lib/asciidoctor/standoc/cleanup_image.rb +2 -69
  14. data/lib/asciidoctor/standoc/cleanup_inline.rb +2 -179
  15. data/lib/asciidoctor/standoc/cleanup_maths.rb +2 -221
  16. data/lib/asciidoctor/standoc/cleanup_ref.rb +2 -169
  17. data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +2 -103
  18. data/lib/asciidoctor/standoc/cleanup_reqt.rb +2 -110
  19. data/lib/asciidoctor/standoc/cleanup_section.rb +2 -184
  20. data/lib/asciidoctor/standoc/cleanup_section_names.rb +2 -91
  21. data/lib/asciidoctor/standoc/cleanup_symbols.rb +2 -47
  22. data/lib/asciidoctor/standoc/cleanup_table.rb +2 -67
  23. data/lib/asciidoctor/standoc/cleanup_terms.rb +2 -117
  24. data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +2 -178
  25. data/lib/asciidoctor/standoc/cleanup_text.rb +2 -95
  26. data/lib/asciidoctor/standoc/cleanup_toc.rb +3 -0
  27. data/lib/asciidoctor/standoc/cleanup_xref.rb +2 -106
  28. data/lib/asciidoctor/standoc/converter.rb +2 -123
  29. data/lib/asciidoctor/standoc/datamodel/attributes_table_preprocessor.rb +2 -56
  30. data/lib/asciidoctor/standoc/datamodel/diagram_preprocessor.rb +2 -102
  31. data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +3 -404
  32. data/lib/asciidoctor/standoc/deprecated.rb +5 -0
  33. data/lib/asciidoctor/standoc/front.rb +2 -219
  34. data/lib/asciidoctor/standoc/front_contributor.rb +2 -191
  35. data/lib/asciidoctor/standoc/inline.rb +2 -231
  36. data/lib/asciidoctor/standoc/lists.rb +2 -119
  37. data/lib/asciidoctor/standoc/macros.rb +2 -203
  38. data/lib/asciidoctor/standoc/macros_form.rb +2 -62
  39. data/lib/asciidoctor/standoc/macros_note.rb +2 -44
  40. data/lib/asciidoctor/standoc/macros_plantuml.rb +2 -112
  41. data/lib/asciidoctor/standoc/macros_terms.rb +2 -180
  42. data/lib/asciidoctor/standoc/ref.rb +2 -251
  43. data/lib/asciidoctor/standoc/ref_sect.rb +2 -153
  44. data/lib/asciidoctor/standoc/ref_utility.rb +2 -0
  45. data/lib/asciidoctor/standoc/render.rb +3 -0
  46. data/lib/asciidoctor/standoc/reqt.rb +2 -89
  47. data/lib/asciidoctor/standoc/section.rb +2 -190
  48. data/lib/asciidoctor/standoc/table.rb +2 -84
  49. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +2 -178
  50. data/lib/asciidoctor/standoc/terms.rb +2 -153
  51. data/lib/asciidoctor/standoc/utils.rb +2 -116
  52. data/lib/asciidoctor/standoc/validate.rb +2 -157
  53. data/lib/asciidoctor/standoc/validate_section.rb +2 -54
  54. data/lib/isodoc/html/htmlstyle.css +44 -29
  55. data/lib/isodoc/html/htmlstyle.scss +17 -12
  56. data/lib/metanorma/standoc/base.rb +163 -0
  57. data/lib/{asciidoctor → metanorma}/standoc/basicdoc.rng +0 -0
  58. data/lib/{asciidoctor → metanorma}/standoc/biblio.rng +0 -0
  59. data/lib/metanorma/standoc/blocks.rb +239 -0
  60. data/lib/metanorma/standoc/blocks_notes.rb +101 -0
  61. data/lib/metanorma/standoc/cleanup.rb +157 -0
  62. data/lib/metanorma/standoc/cleanup_amend.rb +54 -0
  63. data/lib/metanorma/standoc/cleanup_block.rb +173 -0
  64. data/lib/metanorma/standoc/cleanup_boilerplate.rb +213 -0
  65. data/lib/metanorma/standoc/cleanup_footnotes.rb +109 -0
  66. data/lib/metanorma/standoc/cleanup_image.rb +70 -0
  67. data/lib/metanorma/standoc/cleanup_inline.rb +190 -0
  68. data/lib/metanorma/standoc/cleanup_maths.rb +222 -0
  69. data/lib/metanorma/standoc/cleanup_ref.rb +170 -0
  70. data/lib/metanorma/standoc/cleanup_ref_dl.rb +104 -0
  71. data/lib/metanorma/standoc/cleanup_reqt.rb +111 -0
  72. data/lib/metanorma/standoc/cleanup_section.rb +212 -0
  73. data/lib/metanorma/standoc/cleanup_section_names.rb +92 -0
  74. data/lib/metanorma/standoc/cleanup_symbols.rb +48 -0
  75. data/lib/metanorma/standoc/cleanup_table.rb +68 -0
  76. data/lib/metanorma/standoc/cleanup_terms.rb +140 -0
  77. data/lib/metanorma/standoc/cleanup_terms_designations.rb +199 -0
  78. data/lib/metanorma/standoc/cleanup_text.rb +96 -0
  79. data/lib/metanorma/standoc/cleanup_toc.rb +98 -0
  80. data/lib/metanorma/standoc/cleanup_xref.rb +107 -0
  81. data/lib/metanorma/standoc/converter.rb +125 -0
  82. data/lib/metanorma/standoc/datamodel/attributes_table_preprocessor.rb +57 -0
  83. data/lib/metanorma/standoc/datamodel/diagram_preprocessor.rb +103 -0
  84. data/lib/metanorma/standoc/datamodel/plantuml_renderer.rb +409 -0
  85. data/lib/metanorma/standoc/front.rb +224 -0
  86. data/lib/metanorma/standoc/front_contributor.rb +192 -0
  87. data/lib/metanorma/standoc/inline.rb +232 -0
  88. data/lib/{asciidoctor → metanorma}/standoc/isodoc.rng +49 -2
  89. data/lib/metanorma/standoc/lists.rb +120 -0
  90. data/lib/metanorma/standoc/macros.rb +204 -0
  91. data/lib/metanorma/standoc/macros_form.rb +63 -0
  92. data/lib/metanorma/standoc/macros_note.rb +45 -0
  93. data/lib/metanorma/standoc/macros_plantuml.rb +113 -0
  94. data/lib/metanorma/standoc/macros_terms.rb +194 -0
  95. data/lib/metanorma/standoc/ref.rb +243 -0
  96. data/lib/metanorma/standoc/ref_sect.rb +153 -0
  97. data/lib/{asciidoctor/standoc/ref_date_id.rb → metanorma/standoc/ref_utility.rb} +43 -5
  98. data/lib/metanorma/standoc/render.rb +115 -0
  99. data/lib/metanorma/standoc/reqt.rb +90 -0
  100. data/lib/{asciidoctor → metanorma}/standoc/reqt.rng +0 -0
  101. data/lib/metanorma/standoc/section.rb +209 -0
  102. data/lib/metanorma/standoc/table.rb +85 -0
  103. data/lib/metanorma/standoc/term_lookup_cleanup.rb +179 -0
  104. data/lib/metanorma/standoc/terms.rb +160 -0
  105. data/lib/metanorma/standoc/utils.rb +101 -0
  106. data/lib/metanorma/standoc/validate.rb +158 -0
  107. data/lib/metanorma/standoc/validate_section.rb +55 -0
  108. data/lib/metanorma/standoc/version.rb +1 -1
  109. data/lib/{asciidoctor → metanorma}/standoc/views/datamodel/model_representation.adoc.erb +0 -0
  110. data/lib/{asciidoctor → metanorma}/standoc/views/datamodel/plantuml_representation.adoc.erb +0 -0
  111. data/lib/metanorma-standoc.rb +1 -1
  112. data/metanorma-standoc.gemspec +2 -2
  113. data/spec/{asciidoctor → metanorma}/base_spec.rb +499 -407
  114. data/spec/{asciidoctor → metanorma}/blank_spec.rb +1 -1
  115. data/spec/{asciidoctor → metanorma}/blocks_spec.rb +34 -5
  116. data/spec/{asciidoctor → metanorma}/cleanup_blocks_spec.rb +25 -1
  117. data/spec/{asciidoctor → metanorma}/cleanup_sections_spec.rb +1 -1
  118. data/spec/{asciidoctor → metanorma}/cleanup_spec.rb +5 -5
  119. data/spec/{asciidoctor → metanorma}/cleanup_terms_spec.rb +281 -29
  120. data/spec/{asciidoctor → metanorma}/datamodel/attributes_table_preprocessor_spec.rb +1 -1
  121. data/spec/{asciidoctor → metanorma}/datamodel/diagram_preprocessor_spec.rb +1 -1
  122. data/spec/{asciidoctor → metanorma}/inline_spec.rb +170 -1
  123. data/spec/{asciidoctor → metanorma}/isobib_cache_spec.rb +1 -1
  124. data/spec/{asciidoctor → metanorma}/lists_spec.rb +1 -1
  125. data/spec/{asciidoctor → metanorma}/macros_json2text_spec.rb +0 -0
  126. data/spec/{asciidoctor → metanorma}/macros_plantuml_spec.rb +3 -3
  127. data/spec/{asciidoctor → metanorma}/macros_spec.rb +8 -6
  128. data/spec/{asciidoctor → metanorma}/macros_yaml2text_spec.rb +0 -0
  129. data/spec/metanorma/refs_dl_spec.rb +863 -0
  130. data/spec/{asciidoctor → metanorma}/refs_spec.rb +522 -15
  131. data/spec/{asciidoctor → metanorma}/section_spec.rb +88 -1
  132. data/spec/{asciidoctor → metanorma}/table_spec.rb +1 -1
  133. data/spec/{asciidoctor → metanorma}/validate_spec.rb +2 -2
  134. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +53 -53
  135. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +14 -14
  136. data/spec/vcr_cassettes/hide_refs.yml +599 -0
  137. data/spec/vcr_cassettes/isobib_get_123.yml +14 -14
  138. data/spec/vcr_cassettes/isobib_get_123_1.yml +99 -99
  139. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +109 -109
  140. data/spec/vcr_cassettes/isobib_get_123_2001.yml +13 -13
  141. data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
  142. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  143. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
  144. metadata +87 -35
  145. data/spec/asciidoctor/refs_dl_spec.rb +0 -864
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
  require "fileutils"
3
3
 
4
- RSpec.describe Asciidoctor::Standoc do
4
+ RSpec.describe Metanorma::Standoc do
5
5
  it "processes a blank document" do
6
6
  input = <<~INPUT
7
7
  #{ASCIIDOC_BLANK_HDR}
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
  require "open3"
3
3
 
4
- RSpec.describe Asciidoctor::Standoc do
4
+ RSpec.describe Metanorma::Standoc do
5
5
  it "processes format-specific pass blocks" do
6
6
  input = <<~INPUT
7
7
  #{ASCIIDOC_BLANK_HDR}
@@ -1444,7 +1444,7 @@ OUTPUT
1444
1444
  ====
1445
1445
  INPUT
1446
1446
  output = <<~"OUTPUT"
1447
- #{BLANK_HDR}
1447
+ #{BLANK_HDR}
1448
1448
  <sections>
1449
1449
  <recommendation id="_" unnumbered="true" type="verification" model="ogc" tag='X' multilingual-rendering='common'>
1450
1450
  <label>/ogc/recommendation/wfs/2</label>
@@ -1452,7 +1452,8 @@ OUTPUT
1452
1452
  <subject>developer, implementer</subject>
1453
1453
  <inherit>/ss/584/2015/level/1</inherit>
1454
1454
  <inherit>/ss/584/2015/level/2</inherit>
1455
- <description><p id="_">I recommend this</p></description>
1455
+ <description><p id="_">I recommend this</p>
1456
+ </description>
1456
1457
  </recommendation>
1457
1458
  </sections>
1458
1459
  </standard-document>
@@ -1470,6 +1471,9 @@ OUTPUT
1470
1471
  .Title
1471
1472
  ====
1472
1473
  I recommend this
1474
+
1475
+ . http://www.example.com[]
1476
+ . <<ABC>>
1473
1477
  ====
1474
1478
  INPUT
1475
1479
  output = <<~OUTPUT
@@ -1478,7 +1482,20 @@ OUTPUT
1478
1482
  <requirement id="ABC" subsequence="A" number="3" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common'>
1479
1483
  <title>Title</title>
1480
1484
  <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
1481
- <description><p id="_">I recommend this</p></description>
1485
+ <description><p id="_">I recommend this</p>
1486
+ <ol id='_' type='arabic'>
1487
+ <li>
1488
+ <p id='_'>
1489
+ <link target='http://www.example.com'/>
1490
+ </p>
1491
+ </li>
1492
+ <li>
1493
+ <p id='_'>
1494
+ <xref target='ABC'/>
1495
+ </p>
1496
+ </li>
1497
+ </ol>
1498
+ </description>
1482
1499
  </requirement>
1483
1500
  </sections>
1484
1501
  </standard-document>
@@ -1526,6 +1543,9 @@ OUTPUT
1526
1543
  [.permission]
1527
1544
  =====
1528
1545
  I also permit this
1546
+
1547
+ . List
1548
+ . List
1529
1549
  =====
1530
1550
 
1531
1551
  [requirement,type="general",label="/req/core/quantities-uom"]
@@ -1541,7 +1561,16 @@ OUTPUT
1541
1561
  <p id="_">Example 2</p>
1542
1562
  </example></description>
1543
1563
  <permission id="_">
1544
- <description><p id="_">I also permit this</p></description>
1564
+ <description><p id="_">I also permit this</p>
1565
+ <ol id='_' type='arabic'>
1566
+ <li>
1567
+ <p id='_'>List</p>
1568
+ </li>
1569
+ <li>
1570
+ <p id='_'>List</p>
1571
+ </li>
1572
+ </ol>
1573
+ </description>
1545
1574
  </permission>
1546
1575
  <requirement id='_' type='general'>
1547
1576
  <label>/req/core/quantities-uom</label>
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
  require "fileutils"
3
3
 
4
- RSpec.describe Asciidoctor::Standoc do
4
+ RSpec.describe Metanorma::Standoc do
5
5
  it "processes svgmap" do
6
6
  FileUtils.cp "spec/fixtures/action_schemaexpg1.svg",
7
7
  "action_schemaexpg1.svg"
@@ -1015,4 +1015,28 @@ RSpec.describe Asciidoctor::Standoc do
1015
1015
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1016
1016
  .to be_equivalent_to xmlpp(output)
1017
1017
  end
1018
+
1019
+ it "updates anchor reference along with anchor to match content" do
1020
+ input = <<~INPUT
1021
+ #{ASCIIDOC_BLANK_HDR}
1022
+
1023
+ [[samplecode]]
1024
+ .Sample Code
1025
+ ====
1026
+
1027
+ [source,ruby]
1028
+ --
1029
+ puts "Hello, world."
1030
+ %w{a b c}.each do |x| <1>
1031
+ puts x
1032
+ end
1033
+ --
1034
+ <1> This is an annotation
1035
+ ====
1036
+ INPUT
1037
+ output = Nokogiri::XML(Asciidoctor.convert(input, *OPTIONS))
1038
+ callout_id = output.at("//xmlns:callout/@target").text
1039
+ annotation_id = output.at("//xmlns:annotation/@id").text
1040
+ expect(callout_id).to eq(annotation_id)
1041
+ end
1018
1042
  end
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
  require "relaton_iec"
3
3
  require "fileutils"
4
4
 
5
- RSpec.describe Asciidoctor::Standoc do
5
+ RSpec.describe Metanorma::Standoc do
6
6
  it "appends any initial user-supplied text to boilerplate in terms and definitions" do
7
7
  input = <<~INPUT
8
8
  #{ASCIIDOC_BLANK_HDR}
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
  require "relaton_iec"
3
3
  require "fileutils"
4
4
 
5
- RSpec.describe Asciidoctor::Standoc do
5
+ RSpec.describe Metanorma::Standoc do
6
6
  it "applies smartquotes by default" do
7
7
  input = <<~INPUT
8
8
  #{ASCIIDOC_BLANK_HDR}
@@ -778,7 +778,7 @@ RSpec.describe Asciidoctor::Standoc do
778
778
  </sections>
779
779
  </standard-document>
780
780
  OUTPUT
781
- expect(Asciidoctor::Standoc::Converter.new(nil, *OPTIONS)
781
+ expect(Metanorma::Standoc::Converter.new(nil, *OPTIONS)
782
782
  .cleanup(Nokogiri::XML(input)).to_xml)
783
783
  .to be_equivalent_to xmlpp(output)
784
784
  end
@@ -836,7 +836,7 @@ RSpec.describe Asciidoctor::Standoc do
836
836
  </bibliography>
837
837
  </standard-document>
838
838
  OUTPUT
839
- expect(Asciidoctor::Standoc::Converter.new(nil, *OPTIONS)
839
+ expect(Metanorma::Standoc::Converter.new(nil, *OPTIONS)
840
840
  .cleanup(Nokogiri::XML(input)).to_xml)
841
841
  .to be_equivalent_to xmlpp(output)
842
842
  end
@@ -1822,7 +1822,7 @@ RSpec.describe Asciidoctor::Standoc do
1822
1822
  <stage>published</stage>
1823
1823
  </status>
1824
1824
  <copyright>
1825
- <from>2021</from>
1825
+ <from>#{Time.now.year}</from>
1826
1826
  </copyright>
1827
1827
  <ext>
1828
1828
  <doctype>article</doctype>
@@ -1865,7 +1865,7 @@ RSpec.describe Asciidoctor::Standoc do
1865
1865
  private
1866
1866
 
1867
1867
  def mock_mathml_italicise(string)
1868
- allow_any_instance_of(::Asciidoctor::Standoc::Cleanup)
1868
+ allow_any_instance_of(::Metanorma::Standoc::Cleanup)
1869
1869
  .to receive(:mathml_mi_italics).and_return(string)
1870
1870
  end
1871
1871
 
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
  require "relaton_iec"
3
3
  require "fileutils"
4
4
 
5
- RSpec.describe Asciidoctor::Standoc do
5
+ RSpec.describe Metanorma::Standoc do
6
6
  it "processes term and designation metadata and term sources" do
7
7
  input = <<~INPUT
8
8
  #{ASCIIDOC_BLANK_HDR}
@@ -88,8 +88,8 @@ RSpec.describe Asciidoctor::Standoc do
88
88
  <title>Terms and definitions</title>
89
89
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
90
90
  <term id='term-first-designation'>
91
- <preferred language='fr' script='Latn' type='prefix' isInternational="true">
92
- <expression>
91
+ <preferred>
92
+ <expression language='fr' script='Latn' type='prefix' isInternational="true">
93
93
  <name>First Designation</name>
94
94
  <abbreviation-type>acronym</abbreviation-type>
95
95
  <pronunciation>f&#601;&#633;st</pronunciation>
@@ -106,14 +106,14 @@ RSpec.describe Asciidoctor::Standoc do
106
106
  </origin>
107
107
  </termsource>
108
108
  </preferred>
109
- <admitted language='he' script='Hebr' type='suffix' absent="true">
110
- <expression>
109
+ <admitted absent="true">
110
+ <expression language='he' script='Hebr' type='suffix'>
111
111
  <name>Third Designation</name>
112
112
  </expression>
113
113
  <usage-info>This is usage 1.</usage-info>
114
114
  </admitted>
115
- <deprecates language='jp' script='Japn' type='full' geographic-area="AUS">
116
- <expression>
115
+ <deprecates geographic-area="AUS">
116
+ <expression language='jp' script='Japn' type='full'>
117
117
  <name>Fourth Designation</name>
118
118
  <grammar>
119
119
  <gender>masculine</gender>
@@ -127,9 +127,9 @@ RSpec.describe Asciidoctor::Standoc do
127
127
  </expression>
128
128
  <field-of-application>Field</field-of-application>
129
129
  </deprecates>
130
- <related type='abbreviation'>
130
+ <related type='see'>
131
131
  <preferred geographic-area="GRC">
132
- <expression>
132
+ <expression type="abbreviation">
133
133
  <name>Fifth Designation</name>
134
134
  <grammar>
135
135
  <gender>neuter</gender>
@@ -409,8 +409,8 @@ RSpec.describe Asciidoctor::Standoc do
409
409
  <title>Terms and definitions</title>
410
410
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
411
411
  <term id='second'>
412
- <preferred isInternational='true'>
413
- <expression>
412
+ <preferred>
413
+ <expression isInternational='true'>
414
414
  <name/>
415
415
  </expression>
416
416
  </preferred>
@@ -502,8 +502,8 @@ RSpec.describe Asciidoctor::Standoc do
502
502
  <title>Terms and definitions</title>
503
503
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
504
504
  <term id='second'>
505
- <preferred isInternational='true'>
506
- <graphical-symbol>
505
+ <preferred>
506
+ <graphical-symbol isInternational='true'>
507
507
  <figure id='_'>
508
508
  <pre id='_'>&lt;LITERAL&gt; FIGURATIVE</pre>
509
509
  </figure>
@@ -556,6 +556,7 @@ RSpec.describe Asciidoctor::Standoc do
556
556
  #{ASCIIDOC_BLANK_HDR}
557
557
  == Terms and Definitions
558
558
 
559
+ [[des1]]
559
560
  === First Designation
560
561
 
561
562
  [%metadata]
@@ -569,7 +570,7 @@ RSpec.describe Asciidoctor::Standoc do
569
570
  subject:: pipes
570
571
  usage-info:: This is usage.
571
572
 
572
- related:see[Fifth Designation]
573
+ related:see[<<des1>>,Fifth Designation]
573
574
 
574
575
  [%metadata]
575
576
  grammar::
@@ -612,28 +613,28 @@ RSpec.describe Asciidoctor::Standoc do
612
613
  <terms id='_' obligation='normative'>
613
614
  <title>Terms and definitions</title>
614
615
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
615
- <term id='term-first-designation'>
616
- <preferred language='fr' script='Latn' type='prefix' isInternational="true">
617
- <expression>
616
+ <term id='des1'>
617
+ <preferred>
618
+ <expression language='fr' script='Latn' type='prefix' isInternational="true">
618
619
  <name>First Designation</name>
619
620
  <abbreviation-type>acronym</abbreviation-type>
620
621
  <pronunciation>f&#601;&#633;st</pronunciation>
621
622
  </expression>
622
623
  <usage-info>This is usage.</usage-info>
623
624
  </preferred>
624
- <preferred type='abbreviation'>
625
- <expression>
625
+ <preferred>
626
+ <expression type='abbreviation'>
626
627
  <name>Second Designation</name>
627
628
  </expression>
628
629
  </preferred>
629
- <admitted language='he' script='Hebr' type='suffix'>
630
- <expression>
630
+ <admitted>
631
+ <expression language='he' script='Hebr' type='suffix'>
631
632
  <name>Third Designation</name>
632
633
  </expression>
633
634
  <usage-info>This is usage 1.</usage-info>
634
635
  </admitted>
635
- <deprecates language='jp' script='Japn' type='full'>
636
- <expression>
636
+ <deprecates>
637
+ <expression language='jp' script='Japn' type='full'>
637
638
  <name>Fourth Designation</name>
638
639
  <grammar>
639
640
  <gender>masculine</gender>
@@ -645,12 +646,8 @@ RSpec.describe Asciidoctor::Standoc do
645
646
  </expression>
646
647
  </deprecates>
647
648
  <related type='see'>
648
- <strong>
649
- term
650
- <tt>Fifth Designation</tt>
651
- not resolved via ID
652
- <tt>fifth-designation</tt>
653
- </strong>
649
+ <preferred><expression><name>Fifth Designation</name><grammar><gender>neuter</gender></grammar></expression>
650
+ </preferred><xref target='des1'/>
654
651
  </related>
655
652
  <domain>Hydraulics</domain>
656
653
  <subject>pipes</subject>
@@ -708,6 +705,114 @@ RSpec.describe Asciidoctor::Standoc do
708
705
  .to be_equivalent_to xmlpp(output)
709
706
  end
710
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
+
711
816
  it "moves term domains out of the term definition paragraph" do
712
817
  input = <<~INPUT
713
818
  #{ASCIIDOC_BLANK_HDR}
@@ -1202,4 +1307,151 @@ RSpec.describe Asciidoctor::Standoc do
1202
1307
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1203
1308
  .to be_equivalent_to xmlpp(output)
1204
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>#{Time.now.year}</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
+ <expression>
1367
+ <name>x</name>
1368
+ </expression>
1369
+ </admitted>
1370
+ <admitted>
1371
+ <letter-symbol>
1372
+ <name>
1373
+ <stem type='MathML'>
1374
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1375
+ <mi>&#955;</mi>
1376
+ </math>
1377
+ </stem>
1378
+ </name>
1379
+ </letter-symbol>
1380
+ </admitted>
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
1205
1457
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "spec_helper"
4
4
 
5
- RSpec.describe Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor do
5
+ RSpec.describe Metanorma::Standoc::Datamodel::AttributesTablePreprocessor do
6
6
  describe "#process" do
7
7
  context "when simple models without relations" do
8
8
  let(:datamodel_file) do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "spec_helper"
4
4
 
5
- RSpec.describe Asciidoctor::Standoc::Datamodel::DiagramPreprocessor do
5
+ RSpec.describe Metanorma::Standoc::Datamodel::DiagramPreprocessor do
6
6
  describe "#process" do
7
7
  context "when simple models without relations" do
8
8
  let(:datamodel_file) do