metanorma-standoc 1.10.4.1 → 1.10.8

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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +19 -23
  3. data/lib/asciidoctor/standoc/base.rb +11 -13
  4. data/lib/asciidoctor/standoc/basicdoc.rng +21 -4
  5. data/lib/asciidoctor/standoc/blocks.rb +27 -22
  6. data/lib/asciidoctor/standoc/blocks_notes.rb +17 -22
  7. data/lib/asciidoctor/standoc/cleanup.rb +38 -71
  8. data/lib/asciidoctor/standoc/cleanup_block.rb +5 -70
  9. data/lib/asciidoctor/standoc/cleanup_image.rb +6 -7
  10. data/lib/asciidoctor/standoc/cleanup_inline.rb +27 -98
  11. data/lib/asciidoctor/standoc/cleanup_maths.rb +113 -21
  12. data/lib/asciidoctor/standoc/cleanup_ref.rb +5 -0
  13. data/lib/asciidoctor/standoc/cleanup_reqt.rb +56 -18
  14. data/lib/asciidoctor/standoc/cleanup_section.rb +1 -0
  15. data/lib/asciidoctor/standoc/cleanup_section_names.rb +31 -14
  16. data/lib/asciidoctor/standoc/cleanup_table.rb +68 -0
  17. data/lib/asciidoctor/standoc/cleanup_terms.rb +1 -1
  18. data/lib/asciidoctor/standoc/cleanup_text.rb +73 -0
  19. data/lib/asciidoctor/standoc/cleanup_xref.rb +107 -0
  20. data/lib/asciidoctor/standoc/converter.rb +13 -0
  21. data/lib/asciidoctor/standoc/isodoc.rng +241 -61
  22. data/lib/asciidoctor/standoc/lists.rb +15 -15
  23. data/lib/asciidoctor/standoc/macros.rb +14 -43
  24. data/lib/asciidoctor/standoc/macros_note.rb +45 -0
  25. data/lib/asciidoctor/standoc/macros_terms.rb +33 -15
  26. data/lib/asciidoctor/standoc/reqt.rb +2 -2
  27. data/lib/asciidoctor/standoc/reqt.rng +23 -2
  28. data/lib/asciidoctor/standoc/table.rb +22 -20
  29. data/lib/asciidoctor/standoc/terms.rb +9 -1
  30. data/lib/asciidoctor/standoc/validate.rb +23 -14
  31. data/lib/asciidoctor/standoc/validate_section.rb +5 -2
  32. data/lib/metanorma/standoc/version.rb +1 -1
  33. data/metanorma-standoc.gemspec +1 -1
  34. data/spec/asciidoctor/base_spec.rb +0 -33
  35. data/spec/asciidoctor/blank_spec.rb +37 -0
  36. data/spec/asciidoctor/blocks_spec.rb +151 -30
  37. data/spec/asciidoctor/cleanup_blocks_spec.rb +1018 -0
  38. data/spec/asciidoctor/cleanup_sections_spec.rb +207 -0
  39. data/spec/asciidoctor/cleanup_spec.rb +193 -1078
  40. data/spec/asciidoctor/inline_spec.rb +36 -0
  41. data/spec/asciidoctor/isobib_cache_spec.rb +8 -8
  42. data/spec/asciidoctor/lists_spec.rb +6 -6
  43. data/spec/asciidoctor/macros_plantuml_spec.rb +1 -1
  44. data/spec/asciidoctor/macros_spec.rb +41 -26
  45. data/spec/asciidoctor/refs_dl_spec.rb +1 -1
  46. data/spec/asciidoctor/refs_spec.rb +220 -444
  47. data/spec/asciidoctor/section_spec.rb +1 -1
  48. data/spec/asciidoctor/validate_spec.rb +51 -0
  49. data/spec/assets/xref_error.adoc +1 -0
  50. data/spec/fixtures/datamodel_description_sections_tree.xml +24 -24
  51. data/spec/spec_helper.rb +5 -7
  52. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +231 -143
  53. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +152 -0
  54. data/spec/vcr_cassettes/isobib_get_123.yml +52 -36
  55. data/spec/vcr_cassettes/isobib_get_123_1.yml +103 -71
  56. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +112 -80
  57. data/spec/vcr_cassettes/isobib_get_123_2001.yml +50 -34
  58. data/spec/vcr_cassettes/isobib_get_124.yml +51 -35
  59. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +16 -16
  60. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +70 -46
  61. metadata +11 -4
@@ -480,4 +480,40 @@ RSpec.describe Asciidoctor::Standoc do
480
480
  expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
481
481
  .to be_equivalent_to(output)
482
482
  end
483
+
484
+ it "processes format-specific inline pass" do
485
+ input = <<~INPUT
486
+ #{ASCIIDOC_BLANK_HDR}
487
+
488
+ pass-format:rfc,html[<abc>X &gt; Y</abc>]
489
+ INPUT
490
+ output = <<~OUTPUT
491
+ #{BLANK_HDR}
492
+ <sections>
493
+ <p id='_'>
494
+ <passthrough formats='rfc,html'>&lt;abc&gt;X &gt; Y&lt;/abc&gt;</passthrough>
495
+ </p>
496
+ </sections>
497
+ </standard-document>
498
+ OUTPUT
499
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
500
+ .to be_equivalent_to xmlpp(output)
501
+ end
502
+
503
+ it "processes Metanorma XML inline pass" do
504
+ input = <<~INPUT
505
+ #{ASCIIDOC_BLANK_HDR}
506
+
507
+ +<abc>X &gt;+ +++Y+++ pass:c[</abc>]
508
+ INPUT
509
+ output = <<~OUTPUT
510
+ #{BLANK_HDR}
511
+ <sections>
512
+ <p id='_'>&lt;abc&gt;X &gt; Y &lt;/abc&gt;</p>
513
+ </sections>
514
+ </standard-document>
515
+ OUTPUT
516
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
517
+ .to be_equivalent_to xmlpp(output)
518
+ end
483
519
  end
@@ -88,14 +88,14 @@ ISO_124_DATED = <<~XML.freeze
88
88
  <ext>
89
89
  <doctype>international-standard</doctype>
90
90
  <editorialgroup>
91
- <technical-committee number="45" type="TC">ISO/TC 45/SC 3Raw materials (including latex) for use in the rubber industry</technical-committee>
91
+ <technical-committee number='45' type='TC' identifier='ISO/TC 45/SC 3'>Raw materials (including latex) for use in the rubber industry</technical-committee>
92
92
  </editorialgroup>
93
93
  <ics>
94
94
  <code>83.040.10</code>
95
95
  <text>Latex and raw rubber</text>
96
96
  </ics>
97
97
  <structuredidentifier type="ISO">
98
- <project-number>ISO 124</project-number>
98
+ <project-number part="">ISO 124</project-number>
99
99
  </structuredidentifier>
100
100
  </ext>
101
101
  </bibdata>
@@ -186,14 +186,14 @@ ISO_123_UNDATED = <<~XML.freeze
186
186
  <ext>
187
187
  <doctype>international-standard</doctype>
188
188
  <editorialgroup>
189
- <technical-committee number="45" type="TC">ISO/TC 45/SC 3Raw materials (including latex) for use in the rubber industry</technical-committee>
189
+ <technical-committee number='45' type='TC' identifier='ISO/TC 45/SC 3'>Raw materials (including latex) for use in the rubber industry</technical-committee>
190
190
  </editorialgroup>
191
191
  <ics>
192
192
  <code>83.040.10</code>
193
193
  <text>Latex and raw rubber</text>
194
194
  </ics>
195
195
  <structuredidentifier type="ISO">
196
- <project-number>ISO 123</project-number>
196
+ <project-number part="">ISO 123</project-number>
197
197
  </structuredidentifier>
198
198
  </ext>
199
199
  </bibdata>
@@ -227,9 +227,9 @@ ISO_123_DATED = <<~XML.freeze
227
227
  <script>Latn</script>
228
228
  <abstract format='text/plain' language='en' script='Latn'>
229
229
  This International Standard specifies procedures for sampling natural rubber
230
- latex concentrate and for sampling syntheticrubber latices and artificial
230
+ latex concentrate and for sampling synthetic rubber latices and artificial
231
231
  latices. It is also suitable for sampling rubber latex contained in drums,
232
- tank cars ortanks. The procedures may also be used for sampling plastics
232
+ tank cars or tanks. The procedures may also be used for sampling plastics
233
233
  dispersions.
234
234
  </abstract>
235
235
  <status>
@@ -253,14 +253,14 @@ ISO_123_DATED = <<~XML.freeze
253
253
  <ext>
254
254
  <doctype>international-standard</doctype>
255
255
  <editorialgroup>
256
- <technical-committee number="45" type="TC">ISO/TC 45/SC 3Raw materials (including latex) for use in the rubber industry</technical-committee>
256
+ <technical-committee number='45' type='TC' identifier='ISO/TC 45/SC 3'>Raw materials (including latex) for use in the rubber industry</technical-committee>
257
257
  </editorialgroup>
258
258
  <ics>
259
259
  <code>83.040.10</code>
260
260
  <text>Latex and raw rubber</text>
261
261
  </ics>
262
262
  <structuredidentifier type="ISO">
263
- <project-number>ISO 123</project-number>
263
+ <project-number part="">ISO 123</project-number>
264
264
  </structuredidentifier>
265
265
  </ext>
266
266
  </bibdata>
@@ -73,7 +73,7 @@ RSpec.describe Asciidoctor::Standoc do
73
73
  output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
74
74
  #{ASCIIDOC_BLANK_HDR}
75
75
  [[id]]
76
- [keep-with-next=true,keep-lines-together=true]
76
+ [keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
77
77
  * First
78
78
  * Second
79
79
  +
@@ -84,7 +84,7 @@ RSpec.describe Asciidoctor::Standoc do
84
84
  --
85
85
 
86
86
  [[id1]]
87
- [keep-with-next=true,keep-lines-together=true]
87
+ [keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
88
88
  [loweralpha]
89
89
  . First
90
90
  . Second
@@ -103,7 +103,7 @@ RSpec.describe Asciidoctor::Standoc do
103
103
  [arabic]
104
104
  ... E
105
105
  ... F
106
- [keep-with-next=true,keep-lines-together=true]
106
+ [keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
107
107
  Notes1::
108
108
  Notes:: Note 1.
109
109
  +
@@ -117,14 +117,14 @@ RSpec.describe Asciidoctor::Standoc do
117
117
  INPUT
118
118
  expect(xmlpp(strip_guid(output))).to be_equivalent_to xmlpp(<<~"OUTPUT")
119
119
  #{BLANK_HDR}
120
- <sections><ul id="id" keep-with-next="true" keep-lines-together="true">
120
+ <sections><ul id="id" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common' >
121
121
  <li>
122
122
  <p id="_">First</p>
123
123
  </li>
124
124
  <li><p id="_">Second</p><p id="_">entry1</p>
125
125
  <p id="_">entry2</p></li>
126
126
  </ul>
127
- <ol id="id1" type="alphabet" keep-with-next="true" keep-lines-together="true">
127
+ <ol id="id1" type="alphabet" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common' >
128
128
  <li>
129
129
  <p id="_">First</p>
130
130
  </li>
@@ -164,7 +164,7 @@ RSpec.describe Asciidoctor::Standoc do
164
164
  </li>
165
165
  <li>
166
166
  <p id="_">F</p>
167
- <dl id="_" keep-with-next="true" keep-lines-together="true">
167
+ <dl id="_" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common'>
168
168
  <dt>Notes1</dt>
169
169
  <dd/>
170
170
  <dt>Notes</dt>
@@ -201,7 +201,7 @@ RSpec.describe Asciidoctor::Standoc do
201
201
  <tr>
202
202
  <th valign='top' align='left'>Name</th>
203
203
  <th valign='top' align='left'>Definition</th>
204
- <th valign='top' align='left'>Mandatory/ Optional/ Conditional</th>
204
+ <th valign='top' align='left'>Mandatory / Optional / Conditional</th>
205
205
  <th valign='top' align='left'>Max Occur</th>
206
206
  <th valign='top' align='left'>Data Type</th>
207
207
  </tr>
@@ -175,7 +175,8 @@ RSpec.describe Asciidoctor::Standoc do
175
175
  term:[blah,word]
176
176
  {{blah,term,word}}
177
177
  {{blah,term,word,xref}}
178
- {{blah,term,word,xref,option="noital,noref"}}
178
+ {{blah,term,word,xref,options="noital,noref,nolinkmention,nolinkref"}}
179
+ {{blah,term,word,xref,options="ital,ref,linkmention,linkref"}}
179
180
 
180
181
  [[clause1]]
181
182
  == Clause
@@ -283,7 +284,17 @@ RSpec.describe Asciidoctor::Standoc do
283
284
  <tt>blah</tt>
284
285
  </strong>
285
286
  </concept>
286
- <concept ital='false' ref='false'>
287
+ <concept ital='false' ref='false' linkmention='false' linkref='false'>
288
+ <strong>
289
+ term
290
+ <tt>blah</tt>
291
+ , display
292
+ <tt>term</tt>
293
+ not resolved via ID
294
+ <tt>blah</tt>
295
+ </strong>
296
+ </concept>
297
+ <concept ital='true' ref='true' linkmention='true' linkref='true'>
287
298
  <strong>
288
299
  term
289
300
  <tt>blah</tt>
@@ -323,8 +334,8 @@ RSpec.describe Asciidoctor::Standoc do
323
334
  {{<<Clause2>>,word}}
324
335
  {{<<Clause2>>,word,term}}
325
336
  {{<<Clause2>>,word,term,xref}}
326
- {{<<Clause2>>,word,term,xref,option="noital,noref"}}
327
- {{<<Clause2>>,word,term,xref,option="ital,ref"}}
337
+ {{<<Clause2>>,word,term,xref,options="noital,noref,nolinkmention,nolinkref"}}
338
+ {{<<Clause2>>,word,term,xref,options="ital,ref,linkmention,linkref"}}
328
339
 
329
340
  == Terms and definitions
330
341
  === Clause1
@@ -398,12 +409,12 @@ RSpec.describe Asciidoctor::Standoc do
398
409
  <renderterm>term</renderterm>
399
410
  <xref target='Clause2'>xref</xref>
400
411
  </concept>
401
- <concept ital='false' ref='false'>
412
+ <concept ital='false' ref='false' linkmention='false' linkref='false'>
402
413
  <refterm>word</refterm>
403
414
  <renderterm>term</renderterm>
404
415
  <xref target='Clause2'>xref</xref>
405
416
  </concept>
406
- <concept ital='true' ref='true'>
417
+ <concept ital='true' ref='true' linkmention='true' linkref='true'>
407
418
  <refterm>word</refterm>
408
419
  <renderterm>term</renderterm>
409
420
  <xref target='Clause2'>xref</xref>
@@ -678,7 +689,7 @@ RSpec.describe Asciidoctor::Standoc do
678
689
  <definitions id='clause1' obligation='normative'>
679
690
  <title>Symbols and abbreviated terms</title>
680
691
  <dl id='_'>
681
- <dt id='symbol-_-_x_-'>
692
+ <dt id='symbol-_-__x230a_x__x230b_-'>
682
693
  <stem type='MathML'>
683
694
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
684
695
  <mo>&#8970;</mo>
@@ -700,7 +711,7 @@ RSpec.describe Asciidoctor::Standoc do
700
711
  function.
701
712
  </p>
702
713
  </dd>
703
- <dt id='symbol-_-_x_--1'>
714
+ <dt id='symbol-_-__x2308_x__x2309_-'>
704
715
  <stem type='MathML'>
705
716
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
706
717
  <mo>&#8968;</mo>
@@ -1073,7 +1084,7 @@ RSpec.describe Asciidoctor::Standoc do
1073
1084
  output = <<~OUTPUT
1074
1085
  #{BLANK_HDR}
1075
1086
  <sections>
1076
- <form id='_' name='N1' action='/action_page.php' class="checkboxes">
1087
+ <form id='N0' name='N1' action='/action_page.php' class="checkboxes">
1077
1088
  <p id='_'>
1078
1089
  <label for='fname'>First name:</label>
1079
1090
  <br/>
@@ -1147,6 +1158,9 @@ RSpec.describe Asciidoctor::Standoc do
1147
1158
  [[clause1Ab]]
1148
1159
  ==== Clause 1Ab
1149
1160
 
1161
+ [.variant-title,type=toc]
1162
+ 1Ab Clause
1163
+
1150
1164
  [[clause1B]]
1151
1165
  === Clause 1B
1152
1166
 
@@ -1173,6 +1187,7 @@ RSpec.describe Asciidoctor::Standoc do
1173
1187
  </clause>
1174
1188
  <clause id='clause1Ab' inline-header='false' obligation='normative'>
1175
1189
  <title>Clause 1Ab</title>
1190
+ <variant-title type='toc'>1Ab Clause</variant-title>
1176
1191
  </clause>
1177
1192
  </clause>
1178
1193
  <clause id='clause1B' inline-header='false' obligation='normative'>
@@ -1196,7 +1211,7 @@ RSpec.describe Asciidoctor::Standoc do
1196
1211
  <xref target='clause1Aa'>Clause 1Aa</xref>
1197
1212
  </li>
1198
1213
  <li>
1199
- <xref target='clause1Ab'>Clause 1Ab</xref>
1214
+ <xref target='clause1Ab'>1Ab Clause</xref>
1200
1215
  </li>
1201
1216
  </ul>
1202
1217
  </li>
@@ -1596,44 +1611,44 @@ RSpec.describe Asciidoctor::Standoc do
1596
1611
  [lutaml_uml_datamodel_description,#{example_file}]
1597
1612
  --
1598
1613
  [.diagram_include_block, base_path="requirements/"]
1599
- ...
1614
+ .....
1600
1615
  Diagram text
1601
- ...
1616
+ .....
1602
1617
 
1603
1618
  [.include_block, package="Another", base_path="spec/fixtures/"]
1604
- ...
1619
+ .....
1605
1620
  my text
1606
- ...
1621
+ .....
1607
1622
 
1608
1623
  [.include_block, base_path="spec/fixtures/"]
1609
- ...
1624
+ .....
1610
1625
  my text
1611
- ...
1626
+ .....
1612
1627
 
1613
1628
  [.before]
1614
- ...
1629
+ .....
1615
1630
  mine text
1616
- ...
1631
+ .....
1617
1632
 
1618
1633
  [.before, package="Another"]
1619
- ...
1634
+ .....
1620
1635
  text before Another package
1621
- ...
1636
+ .....
1622
1637
 
1623
1638
  [.after, package="Another"]
1624
- ...
1639
+ .....
1625
1640
  text after Another package
1626
- ...
1641
+ .....
1627
1642
 
1628
1643
  [.after, package="CityGML"]
1629
- ...
1644
+ .....
1630
1645
  text after CityGML package
1631
- ...
1646
+ .....
1632
1647
 
1633
1648
  [.after]
1634
- ...
1649
+ .....
1635
1650
  footer text
1636
- ...
1651
+ .....
1637
1652
  --
1638
1653
  TEXT
1639
1654
  end
@@ -821,7 +821,7 @@ OUTPUT
821
821
  <title>Subsection</title>
822
822
  </clause>
823
823
  <references id='_' obligation='informative' normative="true">
824
- <title>Normative references</title>
824
+ <title>Normative References</title>
825
825
  <bibitem id='A'>
826
826
  <formattedref format='application/x-isodoc+xml'>Title</formattedref>
827
827
  <docidentifier>B</docidentifier>