metanorma-standoc 1.8.7 → 1.9.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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -2
  3. data/Gemfile.devel +0 -0
  4. data/lib/asciidoctor/standoc/base.rb +39 -36
  5. data/lib/asciidoctor/standoc/biblio.rng +1 -0
  6. data/lib/asciidoctor/standoc/blocks.rb +25 -9
  7. data/lib/asciidoctor/standoc/blocks_notes.rb +41 -24
  8. data/lib/asciidoctor/standoc/cleanup.rb +59 -84
  9. data/lib/asciidoctor/standoc/cleanup_block.rb +63 -85
  10. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +51 -29
  11. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +1 -0
  12. data/lib/asciidoctor/standoc/cleanup_image.rb +71 -0
  13. data/lib/asciidoctor/standoc/cleanup_maths.rb +36 -27
  14. data/lib/asciidoctor/standoc/cleanup_ref.rb +24 -15
  15. data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +1 -1
  16. data/lib/asciidoctor/standoc/cleanup_reqt.rb +47 -0
  17. data/lib/asciidoctor/standoc/cleanup_section.rb +104 -94
  18. data/lib/asciidoctor/standoc/converter.rb +10 -3
  19. data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +67 -66
  20. data/lib/asciidoctor/standoc/front.rb +35 -18
  21. data/lib/asciidoctor/standoc/front_contributor.rb +5 -5
  22. data/lib/asciidoctor/standoc/inline.rb +1 -1
  23. data/lib/asciidoctor/standoc/isodoc.rng +305 -4
  24. data/lib/asciidoctor/standoc/lists.rb +4 -2
  25. data/lib/asciidoctor/standoc/macros.rb +50 -23
  26. data/lib/asciidoctor/standoc/macros_form.rb +63 -0
  27. data/lib/asciidoctor/standoc/ref.rb +87 -112
  28. data/lib/asciidoctor/standoc/ref_date_id.rb +62 -0
  29. data/lib/asciidoctor/standoc/ref_sect.rb +20 -17
  30. data/lib/asciidoctor/standoc/section.rb +3 -1
  31. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +31 -16
  32. data/lib/asciidoctor/standoc/terms.rb +27 -16
  33. data/lib/asciidoctor/standoc/utils.rb +35 -9
  34. data/lib/asciidoctor/standoc/validate.rb +30 -28
  35. data/lib/metanorma-standoc.rb +0 -1
  36. data/lib/metanorma/standoc/version.rb +5 -5
  37. data/metanorma-standoc.gemspec +11 -11
  38. data/spec/asciidoctor/base_spec.rb +85 -19
  39. data/spec/asciidoctor/blocks_spec.rb +830 -727
  40. data/spec/asciidoctor/cleanup_sections_spec.rb +51 -14
  41. data/spec/asciidoctor/cleanup_spec.rb +1900 -1917
  42. data/spec/asciidoctor/inline_spec.rb +282 -283
  43. data/spec/asciidoctor/isobib_cache_spec.rb +406 -358
  44. data/spec/asciidoctor/lists_spec.rb +3 -3
  45. data/spec/asciidoctor/macros_plantuml_spec.rb +8 -8
  46. data/spec/asciidoctor/macros_spec.rb +546 -444
  47. data/spec/asciidoctor/macros_yaml2text_spec.rb +1 -1
  48. data/spec/asciidoctor/refs_dl_spec.rb +4 -4
  49. data/spec/asciidoctor/refs_spec.rb +19 -19
  50. data/spec/asciidoctor/section_spec.rb +778 -689
  51. data/spec/asciidoctor/table_spec.rb +6 -6
  52. data/spec/asciidoctor/validate_spec.rb +21 -21
  53. data/spec/spec_helper.rb +13 -9
  54. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +62 -62
  55. data/spec/vcr_cassettes/isobib_get_123.yml +16 -16
  56. data/spec/vcr_cassettes/isobib_get_123_1.yml +28 -28
  57. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +41 -41
  58. data/spec/vcr_cassettes/isobib_get_123_2001.yml +16 -16
  59. data/spec/vcr_cassettes/isobib_get_124.yml +15 -15
  60. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  61. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +63 -61
  62. metadata +68 -67
  63. data/lib/liquid/custom_blocks/key_iterator.rb +0 -21
  64. data/lib/liquid/custom_blocks/with_json_nested_context.rb +0 -18
  65. data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +0 -19
  66. data/lib/liquid/custom_filters/values.rb +0 -7
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe 'Yaml2Text macros' do
3
+ RSpec.describe "Yaml2Text macros" do
4
4
  it_behaves_like "structured data 2 text preprocessor" do
5
5
  let(:extention) { "yaml" }
6
6
  def transform_to_type(data)
@@ -3,7 +3,7 @@ require "relaton_iso"
3
3
 
4
4
  RSpec.describe Asciidoctor::Standoc do
5
5
  it "processes simple dl reference" do
6
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
7
7
  #{ASCIIDOC_BLANK_HDR}
8
8
  [bibliography]
9
9
  == Normative References
@@ -72,7 +72,7 @@ RSpec.describe Asciidoctor::Standoc do
72
72
  end
73
73
 
74
74
  it "processes complex dl reference" do
75
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
75
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
76
76
  #{ASCIIDOC_BLANK_HDR}
77
77
 
78
78
  == Clause
@@ -455,7 +455,7 @@ OUTPUT
455
455
  end
456
456
 
457
457
  it "processes complex dl reference with dot path keys" do
458
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
458
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
459
459
  #{ASCIIDOC_BLANK_HDR}
460
460
  [bibliography]
461
461
  == Normative References
@@ -773,7 +773,7 @@ OUTPUT
773
773
  end
774
774
 
775
775
  it "processes mix of dl and default references" do
776
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
776
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
777
777
  #{ASCIIDOC_BLANK_HDR}
778
778
 
779
779
  == Section
@@ -3,8 +3,8 @@ require "relaton_iso"
3
3
  require "relaton_ietf"
4
4
 
5
5
  RSpec.describe Asciidoctor::Standoc do
6
- it "processes simple ISO reference" do
7
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
6
+ it "processes simple ISO reference" do
7
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
8
8
  #{ASCIIDOC_BLANK_HDR}
9
9
  [bibliography]
10
10
  == Normative References
@@ -47,7 +47,7 @@ RSpec.describe Asciidoctor::Standoc do
47
47
  end
48
48
 
49
49
  it "processes simple ISO reference with date range" do
50
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
50
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
51
51
  #{ASCIIDOC_BLANK_HDR}
52
52
  [bibliography]
53
53
  == Normative References
@@ -113,7 +113,7 @@ RSpec.describe Asciidoctor::Standoc do
113
113
  * [[[iso123,ISO 123]]] _Standard_
114
114
  * [[[iso124,(1)ISO 123]]] _Standard_
115
115
  INPUT
116
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
116
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
117
117
  #{BLANK_HDR}
118
118
  <preface>
119
119
  <foreword id='_' obligation='informative'>
@@ -219,12 +219,12 @@ RSpec.describe Asciidoctor::Standoc do
219
219
  </references></bibliography>
220
220
  </standard-document>
221
221
  OUTPUT
222
- expect { Asciidoctor.convert(input, backend: :standoc, header_footer: true) }.to output(/ERROR: No document identifier retrieved for ISO 123/).to_stderr
222
+ expect { Asciidoctor.convert(input, *OPTIONS) }.to output(/ERROR: No document identifier retrieved for ISO 123/).to_stderr
223
223
  end
224
224
 
225
225
  it "fetches simple ISO reference" do
226
226
  VCR.use_cassette "isobib_get_123_1" do
227
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
227
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
228
228
  #{ISOBIB_BLANK_HDR}
229
229
  [bibliography]
230
230
  == Normative References
@@ -461,7 +461,7 @@ RSpec.describe Asciidoctor::Standoc do
461
461
 
462
462
  it "fetches simple ISO reference in French" do
463
463
  VCR.use_cassette "isobib_get_123_1_fr" do
464
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
464
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
465
465
  = Document title
466
466
  Author
467
467
  :docfile: test.adoc
@@ -720,7 +720,7 @@ compris les éventuels amendements).
720
720
  end
721
721
 
722
722
  it "processes simple IEC reference" do
723
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
723
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
724
724
  #{ASCIIDOC_BLANK_HDR}
725
725
  [bibliography]
726
726
  == Normative References
@@ -766,7 +766,7 @@ compris les éventuels amendements).
766
766
  # mock_isobib_get_iec12382
767
767
  # mock_isobib_get_124
768
768
  VCR.use_cassette "dated_iso_ref_joint_iso_iec" do
769
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
769
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
770
770
  #{ISOBIB_BLANK_HDR}
771
771
  [bibliography]
772
772
  == Normative References
@@ -977,7 +977,7 @@ compris les éventuels amendements).
977
977
 
978
978
  it "declines to fetch individual references" do
979
979
  VCR.use_cassette "dated_iso_ref_joint_iso_iec" do
980
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
980
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
981
981
  #{ISOBIB_BLANK_HDR}
982
982
  [bibliography]
983
983
  == Normative References
@@ -1051,7 +1051,7 @@ OUTPUT
1051
1051
  it "processes draft ISO reference" do
1052
1052
  #stub_fetch_ref no_year: true, note: "The standard is in press"
1053
1053
 
1054
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1054
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1055
1055
  #{ASCIIDOC_BLANK_HDR}
1056
1056
  [bibliography]
1057
1057
  == Normative References
@@ -1134,7 +1134,7 @@ OUTPUT
1134
1134
  it "processes all-parts ISO reference" do
1135
1135
  #stub_fetch_ref(all_parts: true)
1136
1136
 
1137
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1137
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1138
1138
  #{ASCIIDOC_BLANK_HDR}
1139
1139
  [bibliography]
1140
1140
  == Normative References
@@ -1191,7 +1191,7 @@ OUTPUT
1191
1191
  it "processes RFC reference in Normative References" do
1192
1192
  # mock_rfcbib_get_rfc8341
1193
1193
  VCR.use_cassette "rfcbib_get_rfc8341" do
1194
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1194
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1195
1195
  #{ISOBIB_BLANK_HDR}
1196
1196
  [bibliography]
1197
1197
  == Normative References
@@ -1363,7 +1363,7 @@ OUTPUT
1363
1363
  end
1364
1364
 
1365
1365
  it "processes non-ISO reference in Normative References" do
1366
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1366
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1367
1367
  #{ASCIIDOC_BLANK_HDR}
1368
1368
  [bibliography]
1369
1369
  == Normative References
@@ -1399,7 +1399,7 @@ OUTPUT
1399
1399
  end
1400
1400
 
1401
1401
  it "processes non-ISO reference in Bibliography" do
1402
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1402
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1403
1403
  #{ASCIIDOC_BLANK_HDR}
1404
1404
  [bibliography]
1405
1405
  == Bibliography
@@ -1454,7 +1454,7 @@ OUTPUT
1454
1454
  expect(RelatonIso::IsoBibliography).to receive(:search).with("ISO 123") do
1455
1455
  raise RelatonBib::RequestError.new "getaddrinfo"
1456
1456
  end.at_least :once
1457
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1457
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1458
1458
  #{ISOBIB_BLANK_HDR}
1459
1459
  [bibliography]
1460
1460
  == Normative References
@@ -1510,7 +1510,7 @@ OUTPUT
1510
1510
  end
1511
1511
 
1512
1512
  it "processes repository reference" do
1513
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1513
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1514
1514
  #{ISOBIB_BLANK_HDR}
1515
1515
  == Scope
1516
1516
 
@@ -1581,7 +1581,7 @@ OUTPUT
1581
1581
  end
1582
1582
 
1583
1583
  it "processes hyperlink reference, ingest RXL or XML if available" do
1584
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1584
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1585
1585
  #{ISOBIB_BLANK_HDR}
1586
1586
  == Scope
1587
1587
 
@@ -1773,7 +1773,7 @@ OUTPUT
1773
1773
  it "overrides normative status of bibliographies" do
1774
1774
  mock_isobib_get_123_no_docid(1)
1775
1775
  mock_isobib_get_123_no_docid_lbl(1)
1776
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1776
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
1777
1777
  #{ISOBIB_BLANK_HDR}
1778
1778
  [bibliography,normative=false]
1779
1779
  == Normative References
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe Asciidoctor::Standoc do
4
4
  it "processes sections" do
5
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
5
+ input = <<~INPUT
6
6
  #{ASCIIDOC_BLANK_HDR}
7
7
  .Foreword
8
8
 
@@ -18,7 +18,7 @@ RSpec.describe Asciidoctor::Standoc do
18
18
  === Introduction Subsection
19
19
 
20
20
  == Acknowledgements
21
-
21
+
22
22
  [.preface]
23
23
  == Dedication
24
24
 
@@ -95,116 +95,115 @@ RSpec.describe Asciidoctor::Standoc do
95
95
  [index,type=thematic]
96
96
  == Thematic Index
97
97
  INPUT
98
- #{BLANK_HDR.sub(/<status>/, "<abstract> <p>Text</p> </abstract><status>")}
99
- <preface><abstract id="_">
100
- <title>Abstract</title>
101
- <p id="_">Text</p>
102
- </abstract><foreword id='_' obligation="informative">
103
- <title>Foreword</title>
104
- <p id="_">Text</p>
105
- </foreword><introduction id="_" obligation="informative">
106
- <title>Introduction</title>
107
- <clause id="_" inline-header="false" obligation="informative">
108
- <title>Introduction Subsection</title>
109
- </clause>
110
- </introduction>
111
- <clause id='_' inline-header='false' obligation='informative'>
112
- <title>Dedication</title>
113
- </clause>
114
- <acknowledgements id='_' obligation='informative'>
115
- <title>Acknowledgements</title>
116
- </acknowledgements>
117
- </preface><sections>
118
-
119
-
120
- <clause id="_" inline-header="false" obligation="normative" type="scope">
121
- <title>Scope</title>
122
- <p id="_">Text</p>
123
- </clause>
124
-
125
- <terms id="_" obligation="normative">
126
- <title>Terms and definitions</title>
127
- <p id="_">For the purposes of this document,
128
- the following terms and definitions apply.</p>
129
- <term id="term-term1">
130
- <preferred>Term1</preferred>
131
- </term>
132
- </terms>
133
- <clause id="_" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title>
134
- <p id='_'>Boilerplate text</p>
135
- <clause id="_" inline-header="false" obligation="normative">
136
- <title>Introduction</title>
137
- <clause id="_" inline-header="false" obligation="normative">
138
- <title>Intro 1</title>
139
- </clause>
140
- </clause>
141
- <terms id="_" obligation="normative">
142
- <title>Intro 2</title>
143
- <clause id="_" inline-header="false" obligation="normative">
144
- <title>Intro 3</title>
145
- </clause>
146
- </terms>
147
- <clause id="_" obligation="normative">
148
- <title>Intro 4</title>
149
- <terms id="_" obligation="normative">
150
- <title>Intro 5</title>
151
- <term id="term-term1-1">
152
- <preferred>Term1</preferred>
153
- </term>
154
- </terms>
155
- </clause>
156
- <terms id="_" obligation="normative">
157
- <title>Normal Terms</title>
158
- <term id="term-term2">
159
- <preferred>Term2</preferred>
160
- </term>
161
- </terms>
162
- <definitions id="_" obligation="normative"><title>Symbols and abbreviated terms</title><clause id="_" inline-header="false" obligation="normative">
163
- <title>General</title>
164
- </clause>
165
- <definitions id="_" obligation="normative" type="symbols">
166
- <title>Symbols</title>
167
- </definitions></definitions></clause>
168
- <definitions id="_" obligation="normative" type="abbreviated_terms">
169
- <title>Abbreviated terms</title>
170
- </definitions>
171
- <clause id="_" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="_" inline-header="false" obligation="normative">
172
- <title>Introduction</title>
173
- </clause>
174
- <clause id="_" inline-header="false" obligation="normative">
175
- <title>Clause 4.2</title>
176
- </clause></clause>
177
- <clause id="_" inline-header="false" obligation="normative">
178
- <title>Terms and Definitions</title>
179
- </clause>
180
-
181
- </sections><annex id="_" inline-header="false" obligation="normative">
182
- <title>Annex</title>
183
- <clause id="_" inline-header="false" obligation="normative">
184
- <title>Annex A.1</title>
185
- </clause>
186
- </annex><bibliography><references id="_" obligation="informative" normative="true">
187
- <title>Normative references</title>
188
- <p id="_">There are no normative references in this document.</p>
189
- </references><clause id="_" obligation="informative">
190
- <title>Bibliography</title>
191
- <references id="_" obligation="informative" normative="false">
192
- <title>Bibliography Subsection</title>
193
- </references>
194
- </clause></bibliography>
195
- <indexsect id='_'>
196
- <title>Index</title>
197
- <p id='_'>This is an index</p>
198
- </indexsect>
199
- <indexsect id='_' type='thematic'>
200
- <title>Thematic Index</title>
201
- </indexsect>
202
- </standard-document>
98
+ output = <<~OUTPUT
99
+ #{BLANK_HDR.sub(/<status>/, '<abstract> <p>Text</p> </abstract><status>')}
100
+ <preface><abstract id="_">
101
+ <title>Abstract</title>
102
+ <p id="_">Text</p>
103
+ </abstract><foreword id='_' obligation="informative">
104
+ <title>Foreword</title>
105
+ <p id="_">Text</p>
106
+ </foreword><introduction id="_" obligation="informative">
107
+ <title>Introduction</title>
108
+ <clause id="_" inline-header="false" obligation="informative">
109
+ <title>Introduction Subsection</title>
110
+ </clause>
111
+ </introduction>
112
+ <clause id='_' inline-header='false' obligation='informative'>
113
+ <title>Dedication</title>
114
+ </clause>
115
+ <acknowledgements id='_' obligation='informative'>
116
+ <title>Acknowledgements</title>
117
+ </acknowledgements>
118
+ </preface><sections>
119
+ <clause id="_" inline-header="false" obligation="normative" type="scope">
120
+ <title>Scope</title>
121
+ <p id="_">Text</p>
122
+ </clause>
123
+ <terms id="_" obligation="normative">
124
+ <title>Terms and definitions</title>
125
+ <p id="_">For the purposes of this document,
126
+ the following terms and definitions apply.</p>
127
+ <term id="term-term1">
128
+ <preferred>Term1</preferred>
129
+ </term>
130
+ </terms>
131
+ <clause id="_" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title>
132
+ <p id='_'>Boilerplate text</p>
133
+ <clause id="_" inline-header="false" obligation="normative">
134
+ <title>Introduction</title>
135
+ <clause id="_" inline-header="false" obligation="normative">
136
+ <title>Intro 1</title>
137
+ </clause>
138
+ </clause>
139
+ <terms id="_" obligation="normative">
140
+ <title>Intro 2</title>
141
+ <clause id="_" inline-header="false" obligation="normative">
142
+ <title>Intro 3</title>
143
+ </clause>
144
+ </terms>
145
+ <clause id="_" obligation="normative">
146
+ <title>Intro 4</title>
147
+ <terms id="_" obligation="normative">
148
+ <title>Intro 5</title>
149
+ <term id="term-term1-1">
150
+ <preferred>Term1</preferred>
151
+ </term>
152
+ </terms>
153
+ </clause>
154
+ <terms id="_" obligation="normative">
155
+ <title>Normal Terms</title>
156
+ <term id="term-term2">
157
+ <preferred>Term2</preferred>
158
+ </term>
159
+ </terms>
160
+ <definitions id="_" obligation="normative"><title>Symbols and abbreviated terms</title><clause id="_" inline-header="false" obligation="normative">
161
+ <title>General</title>
162
+ </clause>
163
+ <definitions id="_" obligation="normative" type="symbols">
164
+ <title>Symbols</title>
165
+ </definitions></definitions></clause>
166
+ <definitions id="_" obligation="normative" type="abbreviated_terms">
167
+ <title>Abbreviated terms</title>
168
+ </definitions>
169
+ <clause id="_" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="_" inline-header="false" obligation="normative">
170
+ <title>Introduction</title>
171
+ </clause>
172
+ <clause id="_" inline-header="false" obligation="normative">
173
+ <title>Clause 4.2</title>
174
+ </clause></clause>
175
+ <clause id="_" inline-header="false" obligation="normative">
176
+ <title>Terms and Definitions</title>
177
+ </clause>
178
+ </sections><annex id="_" inline-header="false" obligation="normative">
179
+ <title>Annex</title>
180
+ <clause id="_" inline-header="false" obligation="normative">
181
+ <title>Annex A.1</title>
182
+ </clause>
183
+ </annex><bibliography><references id="_" obligation="informative" normative="true">
184
+ <title>Normative references</title>
185
+ <p id="_">There are no normative references in this document.</p>
186
+ </references><clause id="_" obligation="informative">
187
+ <title>Bibliography</title>
188
+ <references id="_" obligation="informative" normative="false">
189
+ <title>Bibliography Subsection</title>
190
+ </references>
191
+ </clause></bibliography>
192
+ <indexsect id='_'>
193
+ <title>Index</title>
194
+ <p id='_'>This is an index</p>
195
+ </indexsect>
196
+ <indexsect id='_' type='thematic'>
197
+ <title>Thematic Index</title>
198
+ </indexsect>
199
+ </standard-document>
203
200
  OUTPUT
201
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
202
+ .to be_equivalent_to xmlpp(output)
204
203
  end
205
204
 
206
- it "processes sections with number attributes" do
207
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
205
+ it "processes sections with number attributes" do
206
+ input = <<~INPUT
208
207
  #{ASCIIDOC_BLANK_HDR}
209
208
  [number=1bis]
210
209
  == Scope
@@ -268,81 +267,84 @@ RSpec.describe Asciidoctor::Standoc do
268
267
  [number=20bis]
269
268
  === Bibliography Subsection
270
269
  INPUT
271
- #{BLANK_HDR}
272
- <sections>
273
- <clause id='_' number='1bis' type='scope' inline-header='false' obligation='normative'>
274
- <title>Scope</title>
275
- <p id='_'>Text</p>
276
- </clause>
277
- <terms id='_' number='3bis' obligation='normative'>
278
- <title>Terms and definitions</title>
279
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
280
- <term id='term-term1' number='4bis'>
281
- <preferred>Term1</preferred>
282
- </term>
283
- </terms>
284
- <terms id='_' number='5bis' obligation='normative'>
285
- <title>Terms, definitions, symbols and abbreviated terms</title>
286
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
287
- <clause id='_' number='6bis' inline-header='false' obligation='normative'>
288
- <title>Introduction</title>
289
- <clause id='_' number='7bis' inline-header='false' obligation='normative'>
290
- <title>Intro 1</title>
291
- </clause>
270
+ output = <<~OUTPUT
271
+ #{BLANK_HDR}
272
+ <sections>
273
+ <clause id='_' number='1bis' type='scope' inline-header='false' obligation='normative'>
274
+ <title>Scope</title>
275
+ <p id='_'>Text</p>
292
276
  </clause>
293
- <term id='term-intro-2' number='8bis'>
294
- <preferred>Intro 2</preferred>
295
- </term>
296
- <definitions id='_' number='9bis' obligation='normative'>
297
- <title>Symbols and abbreviated terms</title>
298
- <clause id='_' number='10bis' inline-header='false' obligation='normative'>
299
- <title>General</title>
277
+ <terms id='_' number='3bis' obligation='normative'>
278
+ <title>Terms and definitions</title>
279
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
280
+ <term id='term-term1' number='4bis'>
281
+ <preferred>Term1</preferred>
282
+ </term>
283
+ </terms>
284
+ <terms id='_' number='5bis' obligation='normative'>
285
+ <title>Terms, definitions, symbols and abbreviated terms</title>
286
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
287
+ <clause id='_' number='6bis' inline-header='false' obligation='normative'>
288
+ <title>Introduction</title>
289
+ <clause id='_' number='7bis' inline-header='false' obligation='normative'>
290
+ <title>Intro 1</title>
291
+ </clause>
300
292
  </clause>
301
- <definitions id='_' number='11bis' type='symbols' obligation='normative'>
302
- <title>Symbols</title>
293
+ <term id='term-intro-2' number='8bis'>
294
+ <preferred>Intro 2</preferred>
295
+ </term>
296
+ <definitions id='_' number='9bis' obligation='normative'>
297
+ <title>Symbols and abbreviated terms</title>
298
+ <clause id='_' number='10bis' inline-header='false' obligation='normative'>
299
+ <title>General</title>
300
+ </clause>
301
+ <definitions id='_' number='11bis' type='symbols' obligation='normative'>
302
+ <title>Symbols</title>
303
+ </definitions>
303
304
  </definitions>
305
+ </terms>
306
+ <definitions id='_' number='12bis' type='abbreviated_terms' obligation='normative'>
307
+ <title>Abbreviated terms</title>
304
308
  </definitions>
305
- </terms>
306
- <definitions id='_' number='12bis' type='abbreviated_terms' obligation='normative'>
307
- <title>Abbreviated terms</title>
308
- </definitions>
309
- <clause id='_' number='13bis' inline-header='false' obligation='normative'>
310
- <title>Clause 4</title>
311
- <clause id='_' number='14bis' inline-header='false' obligation='normative'>
312
- <title>Introduction</title>
309
+ <clause id='_' number='13bis' inline-header='false' obligation='normative'>
310
+ <title>Clause 4</title>
311
+ <clause id='_' number='14bis' inline-header='false' obligation='normative'>
312
+ <title>Introduction</title>
313
+ </clause>
314
+ <clause id='_' number='15bis' inline-header='false' obligation='normative'>
315
+ <title>Clause 4.2</title>
316
+ </clause>
313
317
  </clause>
314
- <clause id='_' number='15bis' inline-header='false' obligation='normative'>
315
- <title>Clause 4.2</title>
318
+ <clause id='_' number='16bis' inline-header='false' obligation='normative'>
319
+ <title>Terms and Definitions</title>
316
320
  </clause>
317
- </clause>
318
- <clause id='_' number='16bis' inline-header='false' obligation='normative'>
319
- <title>Terms and Definitions</title>
320
- </clause>
321
- </sections>
322
- <annex id='_' number='17bis' inline-header='false' obligation='normative'>
323
- <title>Annex</title>
324
- <clause id='_' number='18bis' inline-header='false' obligation='normative'>
325
- <title>Annex A.1</title>
326
- </clause>
327
- </annex>
328
- <bibliography>
329
- <references id='_' number='2bis' normative='true' obligation='informative'>
330
- <title>Normative references</title>
331
- <p id='_'>There are no normative references in this document.</p>
332
- </references>
333
- <clause id='_' number='19bis' obligation='informative'>
334
- <title>Bibliography</title>
335
- <references id='_' number='20bis' normative='false' obligation='informative'>
336
- <title>Bibliography Subsection</title>
321
+ </sections>
322
+ <annex id='_' number='17bis' inline-header='false' obligation='normative'>
323
+ <title>Annex</title>
324
+ <clause id='_' number='18bis' inline-header='false' obligation='normative'>
325
+ <title>Annex A.1</title>
326
+ </clause>
327
+ </annex>
328
+ <bibliography>
329
+ <references id='_' number='2bis' normative='true' obligation='informative'>
330
+ <title>Normative references</title>
331
+ <p id='_'>There are no normative references in this document.</p>
337
332
  </references>
338
- </clause>
339
- </bibliography>
340
- </standard-document>
341
- OUTPUT
342
- end
333
+ <clause id='_' number='19bis' obligation='informative'>
334
+ <title>Bibliography</title>
335
+ <references id='_' number='20bis' normative='false' obligation='informative'>
336
+ <title>Bibliography Subsection</title>
337
+ </references>
338
+ </clause>
339
+ </bibliography>
340
+ </standard-document>
341
+ OUTPUT
342
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
343
+ .to be_equivalent_to xmlpp(output)
344
+ end
343
345
 
344
- it "processes sections with language and script attributes" do
345
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
346
+ it "processes sections with language and script attributes" do
347
+ input = <<~INPUT
346
348
  #{ASCIIDOC_BLANK_HDR}
347
349
  [language=en,script=Latn]
348
350
  == Foreword
@@ -446,109 +448,108 @@ RSpec.describe Asciidoctor::Standoc do
446
448
  [language=en,script=Latn]
447
449
  === Bibliography Subsection
448
450
  INPUT
449
- #{BLANK_HDR.sub(/<status>/, "<abstract> <p>Text</p> </abstract><status>")}
450
- <preface><abstract id="_" language="en" script="Latn">
451
- <title>Abstract</title>
452
- <p id="_">Text</p>
453
- </abstract><foreword id='_' language='en' script='Latn' obligation='informative'>
454
- <title>Foreword</title>
455
- <p id="_">Text</p>
456
- </foreword><introduction id="_" language="en" script="Latn" obligation="informative">
457
- <title>Introduction</title>
458
- <clause id="_" language="en" script="Latn" inline-header="false" obligation="informative">
459
- <title>Introduction Subsection</title>
460
- </clause>
461
- </introduction>
462
- <clause id='_' language='en' script='Latn' inline-header='false' obligation='informative'>
463
- <title>Dedication</title>
464
- </clause>
465
- <acknowledgements id='_' language='en' script='Latn' obligation='informative'>
466
- <title>Acknowledgements</title>
467
- </acknowledgements>
468
- </preface><sections>
469
-
470
-
471
- <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative" type="scope">
472
- <title>Scope</title>
473
- <p id="_">Text</p>
474
- </clause>
475
-
476
- <terms id="_" language="en" script="Latn" obligation="normative">
477
- <title>Terms and definitions</title>
478
- <p id="_">For the purposes of this document,
479
- the following terms and definitions apply.</p>
480
- <term id="term-term1" language="en" script="Latn">
481
- <preferred>Term1</preferred>
482
- </term>
483
- </terms>
484
- <clause id="_" language="en" script="Latn" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title>
485
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
486
- <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
487
- <title>Introduction</title>
488
- <clause id="_" inline-header="false" obligation="normative">
489
- <title>Intro 1</title>
490
- </clause>
491
- </clause>
492
- <terms id="_" language="en" script="Latn" obligation="normative">
493
- <title>Intro 2</title>
494
- <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
495
- <title>Intro 3</title>
496
- </clause>
497
- </terms>
498
- <clause id="_" language="en" script="Latn" obligation="normative">
499
- <title>Intro 4</title>
500
- <terms id="_" language="en" script="Latn" obligation="normative">
501
- <title>Intro 5</title>
502
- <term id="term-term1-1">
503
- <preferred>Term1</preferred>
504
- </term>
505
- </terms>
506
- </clause>
507
- <terms id="_" language="en" script="Latn" obligation="normative">
508
- <title>Normal Terms</title>
509
- <term id="term-term2">
510
- <preferred>Term2</preferred>
511
- </term>
512
- </terms>
513
- <definitions id="_" language="en" script="Latn" obligation="normative"><title>Symbols and abbreviated terms</title><clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
514
- <title>General</title>
515
- </clause>
516
- <definitions id="_" obligation="normative" type="symbols">
517
- <title>Symbols</title>
518
- </definitions></definitions></clause>
519
- <definitions id="_" language="en" script="Latn" obligation="normative" type="abbreviated_terms">
520
- <title>Abbreviated terms</title>
521
- </definitions>
522
- <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
523
- <title>Introduction</title>
524
- </clause>
525
- <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
526
- <title>Clause 4.2</title>
527
- </clause></clause>
528
- <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
529
- <title>Terms and Definitions</title>
530
- </clause>
531
-
532
- </sections><annex id="_" language="en" script="Latn" inline-header="false" obligation="normative">
533
- <title>Annex</title>
534
- <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
535
- <title>Annex A.1</title>
536
- </clause>
537
- </annex><bibliography><references id="_" language="en" script="Latn" obligation="informative" normative="true">
538
- <title>Normative references</title>
539
- <p id="_">There are no normative references in this document.</p>
540
- </references><clause id="_" language="en" script="Latn" obligation="informative">
541
- <title>Bibliography</title>
542
- <references id="_" language="en" script="Latn" obligation="informative" normative="false">
543
- <title>Bibliography Subsection</title>
544
- </references>
545
- </clause></bibliography>
546
- </standard-document>
451
+ output = <<~OUTPUT
452
+ #{BLANK_HDR.sub(/<status>/, '<abstract> <p>Text</p> </abstract><status>')}
453
+ <preface><abstract id="_" language="en" script="Latn">
454
+ <title>Abstract</title>
455
+ <p id="_">Text</p>
456
+ </abstract><foreword id='_' language='en' script='Latn' obligation='informative'>
457
+ <title>Foreword</title>
458
+ <p id="_">Text</p>
459
+ </foreword><introduction id="_" language="en" script="Latn" obligation="informative">
460
+ <title>Introduction</title>
461
+ <clause id="_" language="en" script="Latn" inline-header="false" obligation="informative">
462
+ <title>Introduction Subsection</title>
463
+ </clause>
464
+ </introduction>
465
+ <clause id='_' language='en' script='Latn' inline-header='false' obligation='informative'>
466
+ <title>Dedication</title>
467
+ </clause>
468
+ <acknowledgements id='_' language='en' script='Latn' obligation='informative'>
469
+ <title>Acknowledgements</title>
470
+ </acknowledgements>
471
+ </preface><sections>
472
+ <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative" type="scope">
473
+ <title>Scope</title>
474
+ <p id="_">Text</p>
475
+ </clause>
476
+ <terms id="_" language="en" script="Latn" obligation="normative">
477
+ <title>Terms and definitions</title>
478
+ <p id="_">For the purposes of this document,
479
+ the following terms and definitions apply.</p>
480
+ <term id="term-term1" language="en" script="Latn">
481
+ <preferred>Term1</preferred>
482
+ </term>
483
+ </terms>
484
+ <clause id="_" language="en" script="Latn" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title>
485
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
486
+ <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
487
+ <title>Introduction</title>
488
+ <clause id="_" inline-header="false" obligation="normative">
489
+ <title>Intro 1</title>
490
+ </clause>
491
+ </clause>
492
+ <terms id="_" language="en" script="Latn" obligation="normative">
493
+ <title>Intro 2</title>
494
+ <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
495
+ <title>Intro 3</title>
496
+ </clause>
497
+ </terms>
498
+ <clause id="_" language="en" script="Latn" obligation="normative">
499
+ <title>Intro 4</title>
500
+ <terms id="_" language="en" script="Latn" obligation="normative">
501
+ <title>Intro 5</title>
502
+ <term id="term-term1-1">
503
+ <preferred>Term1</preferred>
504
+ </term>
505
+ </terms>
506
+ </clause>
507
+ <terms id="_" language="en" script="Latn" obligation="normative">
508
+ <title>Normal Terms</title>
509
+ <term id="term-term2">
510
+ <preferred>Term2</preferred>
511
+ </term>
512
+ </terms>
513
+ <definitions id="_" language="en" script="Latn" obligation="normative"><title>Symbols and abbreviated terms</title><clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
514
+ <title>General</title>
515
+ </clause>
516
+ <definitions id="_" obligation="normative" type="symbols">
517
+ <title>Symbols</title>
518
+ </definitions></definitions></clause>
519
+ <definitions id="_" language="en" script="Latn" obligation="normative" type="abbreviated_terms">
520
+ <title>Abbreviated terms</title>
521
+ </definitions>
522
+ <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
523
+ <title>Introduction</title>
524
+ </clause>
525
+ <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
526
+ <title>Clause 4.2</title>
527
+ </clause></clause>
528
+ <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
529
+ <title>Terms and Definitions</title>
530
+ </clause>
531
+ </sections><annex id="_" language="en" script="Latn" inline-header="false" obligation="normative">
532
+ <title>Annex</title>
533
+ <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
534
+ <title>Annex A.1</title>
535
+ </clause>
536
+ </annex><bibliography><references id="_" language="en" script="Latn" obligation="informative" normative="true">
537
+ <title>Normative references</title>
538
+ <p id="_">There are no normative references in this document.</p>
539
+ </references><clause id="_" language="en" script="Latn" obligation="informative">
540
+ <title>Bibliography</title>
541
+ <references id="_" language="en" script="Latn" obligation="informative" normative="false">
542
+ <title>Bibliography Subsection</title>
543
+ </references>
544
+ </clause></bibliography>
545
+ </standard-document>
547
546
  OUTPUT
548
- end
547
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
548
+ .to be_equivalent_to xmlpp(output)
549
+ end
549
550
 
550
551
  it "processes sections with title and type attributes" do
551
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
552
+ input = <<~INPUT
552
553
  #{ASCIIDOC_BLANK_HDR}
553
554
  .Foreword
554
555
 
@@ -606,84 +607,87 @@ RSpec.describe Asciidoctor::Standoc do
606
607
 
607
608
  === Bibliography Subsection
608
609
  INPUT
609
- #{BLANK_HDR.sub(/<status>/, "<abstract> <p>Text</p> </abstract><status>")}
610
- <preface>
611
- <abstract id='_'>
612
- <title>Abstract</title>
613
- <p id='_'>Text</p>
614
- </abstract>
615
- <foreword id='_' obligation='informative'>
616
- <title>Foreword</title>
617
- <p id='_'>Text</p>
618
- </foreword>
619
- <introduction id='_' obligation='informative'>
620
- <title>Introduction</title>
621
- <clause id='_' inline-header='false' obligation='informative'>
622
- <title>Introduction Subsection</title>
623
- </clause>
624
- </introduction>
625
- <acknowledgements id='_' obligation='informative'>
626
- <title>Acknowledgements</title>
627
- </acknowledgements>
628
- </preface>
629
- <sections>
630
- <terms id='_' obligation='normative'>
631
- <title>Terms and definitions</title>
632
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
633
- <term id='term-term1'>
634
- <preferred>Term1</preferred>
635
- </term>
636
- </terms>
637
- <clause id='_' obligation='normative'>
638
- <title>Terms, definitions and symbols</title>
639
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
640
- <terms id='_' obligation='normative'>
641
- <title>Normal Terms</title>
642
- <term id='term-term2'>
643
- <preferred>Term2</preferred>
644
- </term>
645
- </terms>
646
- <definitions id='_' obligation="normative" type="symbols">
647
- <title>Symbols</title>
648
- </definitions>
649
- </clause>
650
- <definitions id='_' obligation="normative" type="abbreviated_terms">
651
- <title>Abbreviated terms</title>
652
- </definitions>
653
- <clause id='_' inline-header='false' obligation='normative' type="ABC">
654
- <title>Clause 4</title>
655
- <clause id='_' inline-header='false' obligation='normative' type="DEF">
656
- <title>Introduction</title>
657
- </clause>
658
- <clause id='_' inline-header='false' obligation='normative'>
659
- <title>Clause 4.2</title>
660
- </clause>
661
- </clause>
662
- </sections>
663
- <annex id='_' inline-header='false' obligation='normative'>
664
- <title>Annex</title>
665
- <clause id='_' inline-header='false' obligation='normative'>
666
- <title>Annex A.1</title>
667
- </clause>
668
- </annex>
669
- <bibliography>
670
- <references id='_' obligation='informative' normative="true">
671
- <title>Normative references</title>
672
- <p id="_">There are no normative references in this document.</p>
673
- </references>
674
- <clause id='_' obligation='informative'>
675
- <title>Bibliography</title>
676
- <references id='_' obligation='informative' normative="false">
677
- <title>Bibliography Subsection</title>
678
- </references>
679
- </clause>
680
- </bibliography>
681
- </standard-document>
610
+ output = <<~OUTPUT
611
+ #{BLANK_HDR.sub(/<status>/, '<abstract> <p>Text</p> </abstract><status>')}
612
+ <preface>
613
+ <abstract id='_'>
614
+ <title>Abstract</title>
615
+ <p id='_'>Text</p>
616
+ </abstract>
617
+ <foreword id='_' obligation='informative'>
618
+ <title>Foreword</title>
619
+ <p id='_'>Text</p>
620
+ </foreword>
621
+ <introduction id='_' obligation='informative'>
622
+ <title>Introduction</title>
623
+ <clause id='_' inline-header='false' obligation='informative'>
624
+ <title>Introduction Subsection</title>
625
+ </clause>
626
+ </introduction>
627
+ <acknowledgements id='_' obligation='informative'>
628
+ <title>Acknowledgements</title>
629
+ </acknowledgements>
630
+ </preface>
631
+ <sections>
632
+ <terms id='_' obligation='normative'>
633
+ <title>Terms and definitions</title>
634
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
635
+ <term id='term-term1'>
636
+ <preferred>Term1</preferred>
637
+ </term>
638
+ </terms>
639
+ <clause id='_' obligation='normative'>
640
+ <title>Terms, definitions and symbols</title>
641
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
642
+ <terms id='_' obligation='normative'>
643
+ <title>Normal Terms</title>
644
+ <term id='term-term2'>
645
+ <preferred>Term2</preferred>
646
+ </term>
647
+ </terms>
648
+ <definitions id='_' obligation="normative" type="symbols">
649
+ <title>Symbols</title>
650
+ </definitions>
651
+ </clause>
652
+ <definitions id='_' obligation="normative" type="abbreviated_terms">
653
+ <title>Abbreviated terms</title>
654
+ </definitions>
655
+ <clause id='_' inline-header='false' obligation='normative' type="ABC">
656
+ <title>Clause 4</title>
657
+ <clause id='_' inline-header='false' obligation='normative' type="DEF">
658
+ <title>Introduction</title>
659
+ </clause>
660
+ <clause id='_' inline-header='false' obligation='normative'>
661
+ <title>Clause 4.2</title>
662
+ </clause>
663
+ </clause>
664
+ </sections>
665
+ <annex id='_' inline-header='false' obligation='normative'>
666
+ <title>Annex</title>
667
+ <clause id='_' inline-header='false' obligation='normative'>
668
+ <title>Annex A.1</title>
669
+ </clause>
670
+ </annex>
671
+ <bibliography>
672
+ <references id='_' obligation='informative' normative="true">
673
+ <title>Normative references</title>
674
+ <p id="_">There are no normative references in this document.</p>
675
+ </references>
676
+ <clause id='_' obligation='informative'>
677
+ <title>Bibliography</title>
678
+ <references id='_' obligation='informative' normative="false">
679
+ <title>Bibliography Subsection</title>
680
+ </references>
681
+ </clause>
682
+ </bibliography>
683
+ </standard-document>
682
684
  OUTPUT
685
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
686
+ .to be_equivalent_to xmlpp(output)
683
687
  end
684
688
 
685
689
  it "varies terms & symbols title" do
686
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
690
+ input = <<~INPUT
687
691
  #{ASCIIDOC_BLANK_HDR}
688
692
  [heading="terms, definitions, symbols and abbreviated terms"]
689
693
  == Terms, Definitions, Symbols Section
@@ -692,56 +696,97 @@ RSpec.describe Asciidoctor::Standoc do
692
696
 
693
697
  === Symbols
694
698
 
695
- INPUT
696
- #{BLANK_HDR}
697
- <sections>
698
- <terms id='_' obligation='normative'>
699
- <title>Terms, definitions and symbols</title>
700
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
701
- <term id='term-term'>
702
- <preferred>Term</preferred>
703
- </term>
704
- <definitions id='_' obligation="normative" type="symbols">
705
- <title>Symbols</title>
706
- </definitions>
707
- </terms>
708
- </sections>
709
- </standard-document>
710
- OUTPUT
711
- end
699
+ INPUT
700
+ output = <<~OUTPUT
701
+ #{BLANK_HDR}
702
+ <sections>
703
+ <terms id='_' obligation='normative'>
704
+ <title>Terms, definitions and symbols</title>
705
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
706
+ <term id='term-term'>
707
+ <preferred>Term</preferred>
708
+ </term>
709
+ <definitions id='_' obligation="normative" type="symbols">
710
+ <title>Symbols</title>
711
+ </definitions>
712
+ </terms>
713
+ </sections>
714
+ </standard-document>
715
+ OUTPUT
716
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
717
+ .to be_equivalent_to xmlpp(output)
718
+ end
712
719
 
713
720
  it "varies terms & abbreviated terms title" do
714
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
721
+ input = <<~INPUT
715
722
  #{ASCIIDOC_BLANK_HDR}
716
723
  [heading="terms, definitions, symbols and abbreviated terms"]
717
724
  == Terms, Definitions, Abbreviated Terms Section
718
725
 
719
726
  === Term
720
-
727
+
721
728
  [heading="abbreviated terms"]
722
729
  === Symbols
723
730
 
724
- INPUT
731
+ INPUT
732
+ output = <<~OUTPUT
725
733
  #{BLANK_HDR}
726
- <sections>
727
- <terms id='_' obligation='normative'>
728
- <title>Terms, definitions and abbreviated terms</title>
729
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
730
- <term id='term-term'>
731
- <preferred>Term</preferred>
732
- </term>
733
- <definitions id='_' obligation="normative" type="abbreviated_terms">
734
- <title>Abbreviated terms</title>
735
- </definitions>
736
- </terms>
737
- </sections>
738
- </standard-document>
739
- OUTPUT
740
- end
734
+ <sections>
735
+ <terms id='_' obligation='normative'>
736
+ <title>Terms, definitions and abbreviated terms</title>
737
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
738
+ <term id='term-term'>
739
+ <preferred>Term</preferred>
740
+ </term>
741
+ <definitions id='_' obligation="normative" type="abbreviated_terms">
742
+ <title>Abbreviated terms</title>
743
+ </definitions>
744
+ </terms>
745
+ </sections>
746
+ </standard-document>
747
+ OUTPUT
748
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
749
+ .to be_equivalent_to xmlpp(output)
750
+ end
751
+
752
+ it "varies terms symbols & abbreviated terms title" do
753
+ input = <<~INPUT
754
+ #{ASCIIDOC_BLANK_HDR}
755
+ [heading="terms, definitions, symbols and abbreviated terms"]
756
+ == Terms, Definitions, Abbreviated Terms Section
757
+
758
+ === Term
741
759
 
760
+ === Abbreviated Terms
761
+
762
+ === Symbols
763
+
764
+ INPUT
765
+ output = <<~OUTPUT
766
+ #{BLANK_HDR}
767
+ <sections>
768
+ <terms id='_' obligation='normative'>
769
+ <title>Terms, definitions, symbols and abbreviated terms</title>
770
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
771
+ <term id='term-term'>
772
+ <preferred>Term</preferred>
773
+ </term>
774
+ <definitions id='_' type='abbreviated_terms' obligation='normative'>
775
+ <title>Abbreviated terms</title>
776
+ </definitions>
777
+ <definitions id='_' type='symbols' obligation='normative'>
778
+ <title>Symbols</title>
779
+ </definitions>
780
+ </terms>
781
+ </sections>
782
+ </standard-document>
783
+ OUTPUT
784
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
785
+ .to be_equivalent_to xmlpp(output)
786
+ end
742
787
 
743
788
  it "processes section obligations" do
744
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
789
+ input = <<~INPUT
745
790
  #{ASCIIDOC_BLANK_HDR}
746
791
  [obligation=informative]
747
792
  == Clause 1
@@ -753,26 +798,29 @@ RSpec.describe Asciidoctor::Standoc do
753
798
 
754
799
  [appendix,obligation=informative]
755
800
  == Annex
756
- INPUT
757
- #{BLANK_HDR}
758
- <sections><clause id="_" inline-header="false" obligation="informative">
759
- <title>Clause 1</title>
760
- <clause id="_" inline-header="false" obligation="informative">
761
- <title>Clause 1a</title>
762
- </clause>
763
- </clause>
764
- <clause id="_" inline-header="false" obligation="normative">
765
- <title>Clause 2</title>
766
- </clause>
767
- </sections><annex id="_" inline-header="false" obligation="informative">
768
- <title>Annex</title>
769
- </annex>
770
- </standard-document>
771
- OUTPUT
801
+ INPUT
802
+ output = <<~OUTPUT
803
+ #{BLANK_HDR}
804
+ <sections><clause id="_" inline-header="false" obligation="informative">
805
+ <title>Clause 1</title>
806
+ <clause id="_" inline-header="false" obligation="informative">
807
+ <title>Clause 1a</title>
808
+ </clause>
809
+ </clause>
810
+ <clause id="_" inline-header="false" obligation="normative">
811
+ <title>Clause 2</title>
812
+ </clause>
813
+ </sections><annex id="_" inline-header="false" obligation="informative">
814
+ <title>Annex</title>
815
+ </annex>
816
+ </standard-document>
817
+ OUTPUT
818
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
819
+ .to be_equivalent_to xmlpp(output)
772
820
  end
773
821
 
774
- it "processes inline headers" do
775
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
822
+ it "processes inline headers" do
823
+ input = <<~INPUT
776
824
  #{ASCIIDOC_BLANK_HDR}
777
825
  == Clause 1
778
826
 
@@ -784,46 +832,52 @@ RSpec.describe Asciidoctor::Standoc do
784
832
 
785
833
  [%inline-header]
786
834
  === Clause Aa
787
- INPUT
788
- #{BLANK_HDR}
789
- <sections><clause id="_" inline-header="false" obligation="normative">
790
- <title>Clause 1</title>
791
- <clause id="_" inline-header="true" obligation="normative">
792
- <title>Clause 1a</title>
793
- </clause>
794
- </clause>
795
- </sections><annex id="_" inline-header="false" obligation="normative">
796
- <title>Annex A</title>
797
- <clause id="_" inline-header="true" obligation="normative">
798
- <title>Clause Aa</title>
799
- </clause>
800
- </annex>
801
- </standard-document>
802
- OUTPUT
803
- end
835
+ INPUT
836
+ output = <<~OUTPUT
837
+ #{BLANK_HDR}
838
+ <sections><clause id="_" inline-header="false" obligation="normative">
839
+ <title>Clause 1</title>
840
+ <clause id="_" inline-header="true" obligation="normative">
841
+ <title>Clause 1a</title>
842
+ </clause>
843
+ </clause>
844
+ </sections><annex id="_" inline-header="false" obligation="normative">
845
+ <title>Annex A</title>
846
+ <clause id="_" inline-header="true" obligation="normative">
847
+ <title>Clause Aa</title>
848
+ </clause>
849
+ </annex>
850
+ </standard-document>
851
+ OUTPUT
852
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
853
+ .to be_equivalent_to xmlpp(output)
854
+ end
804
855
 
805
856
  it "processes blank headers" do
806
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
857
+ input = <<~INPUT
807
858
  #{ASCIIDOC_BLANK_HDR}
808
859
  == Clause 1
809
860
 
810
861
  === {blank}
811
862
 
812
- INPUT
813
- #{BLANK_HDR}
814
- <sections>
815
- <clause id="_" inline-header="false" obligation="normative">
816
- <title>Clause 1</title>
817
- <clause id="_" inline-header="false" obligation="normative">
818
- </clause>
819
- </clause>
820
- </sections>
821
- </standard-document>
822
- OUTPUT
863
+ INPUT
864
+ output = <<~OUTPUT
865
+ #{BLANK_HDR}
866
+ <sections>
867
+ <clause id="_" inline-header="false" obligation="normative">
868
+ <title>Clause 1</title>
869
+ <clause id="_" inline-header="false" obligation="normative">
870
+ </clause>
871
+ </clause>
872
+ </sections>
873
+ </standard-document>
874
+ OUTPUT
875
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
876
+ .to be_equivalent_to xmlpp(output)
823
877
  end
824
878
 
825
- it "processes terminal nodes in terms with term subsection names" do
826
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
879
+ it "processes terminal nodes in terms with term subsection names" do
880
+ input = <<~INPUT
827
881
  #{ASCIIDOC_BLANK_HDR}
828
882
 
829
883
  == Terms, definitions, symbols and abbreviated terms
@@ -832,27 +886,29 @@ RSpec.describe Asciidoctor::Standoc do
832
886
 
833
887
  === Symbols
834
888
 
835
- INPUT
836
- #{BLANK_HDR}
837
- <sections>
838
- <terms id='_' obligation='normative'>
839
- <title>Terms, definitions and symbols</title>
840
- <p id='_'>No terms and definitions are listed in this document.</p>
841
- <clause id='_' inline-header='false' obligation='normative'>
842
- <title>Terms and definitions</title>
843
- </clause>
844
- <definitions id='_' obligation="normative" type="symbols">
845
- <title>Symbols</title>
846
- </definitions>
847
- </terms>
848
- </sections>
849
- </standard-document>
850
- OUTPUT
851
- end
852
-
853
-
854
- it "processes terms & definitions with external source" do
855
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
889
+ INPUT
890
+ output = <<~OUTPUT
891
+ #{BLANK_HDR}
892
+ <sections>
893
+ <terms id='_' obligation='normative'>
894
+ <title>Terms, definitions and symbols</title>
895
+ <p id='_'>No terms and definitions are listed in this document.</p>
896
+ <clause id='_' inline-header='false' obligation='normative'>
897
+ <title>Terms and definitions</title>
898
+ </clause>
899
+ <definitions id='_' obligation="normative" type="symbols">
900
+ <title>Symbols</title>
901
+ </definitions>
902
+ </terms>
903
+ </sections>
904
+ </standard-document>
905
+ OUTPUT
906
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
907
+ .to be_equivalent_to xmlpp(output)
908
+ end
909
+
910
+ it "processes terms & definitions with external source" do
911
+ input = <<~INPUT
856
912
  #{ASCIIDOC_BLANK_HDR}
857
913
 
858
914
  Foreword
@@ -862,27 +918,29 @@ RSpec.describe Asciidoctor::Standoc do
862
918
 
863
919
  === Term1
864
920
 
865
- INPUT
866
- #{BLANK_HDR}
867
- <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/>
868
- <preface><foreword id='_' obligation="informative">
869
- <title>Foreword</title>
870
- <p id="_">Foreword</p>
871
- </foreword></preface><sections>
872
- <terms id="_" obligation="normative">
873
- <title>Terms and definitions</title><p id="_">For the purposes of this document, the terms and definitions
874
- given in <eref bibitemid="iso1234"/> and <eref bibitemid="iso5678"/> and the following apply.</p>
875
- <term id="term-term1">
876
- <preferred>Term1</preferred>
877
- </term>
878
- </terms></sections>
879
- </standard-document>
880
-
881
- OUTPUT
882
- end
883
-
884
- it "processes empty terms & definitions" do
885
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
921
+ INPUT
922
+ output = <<~OUTPUT
923
+ #{BLANK_HDR}
924
+ <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/>
925
+ <preface><foreword id='_' obligation="informative">
926
+ <title>Foreword</title>
927
+ <p id="_">Foreword</p>
928
+ </foreword></preface><sections>
929
+ <terms id="_" obligation="normative">
930
+ <title>Terms and definitions</title><p id="_">For the purposes of this document, the terms and definitions
931
+ given in <eref bibitemid="iso1234"/> and <eref bibitemid="iso5678"/> and the following apply.</p>
932
+ <term id="term-term1">
933
+ <preferred>Term1</preferred>
934
+ </term>
935
+ </terms></sections>
936
+ </standard-document>
937
+ OUTPUT
938
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
939
+ .to be_equivalent_to xmlpp(output)
940
+ end
941
+
942
+ it "processes empty terms & definitions" do
943
+ input = <<~INPUT
886
944
  #{ASCIIDOC_BLANK_HDR}
887
945
 
888
946
  Foreword
@@ -890,23 +948,25 @@ RSpec.describe Asciidoctor::Standoc do
890
948
  == Terms and Definitions
891
949
 
892
950
 
893
- INPUT
894
- #{BLANK_HDR}
895
- <preface><foreword id='_' obligation="informative">
896
- <title>Foreword</title>
897
- <p id="_">Foreword</p>
898
- </foreword></preface><sections>
899
- <terms id="_" obligation="normative">
900
- <title>Terms and definitions</title><p id="_">No terms and definitions are listed in this document.</p>
901
- </terms></sections>
902
- </standard-document>
903
-
904
- OUTPUT
905
- end
951
+ INPUT
952
+ output = <<~OUTPUT
953
+ #{BLANK_HDR}
954
+ <preface><foreword id='_' obligation="informative">
955
+ <title>Foreword</title>
956
+ <p id="_">Foreword</p>
957
+ </foreword></preface><sections>
958
+ <terms id="_" obligation="normative">
959
+ <title>Terms and definitions</title><p id="_">No terms and definitions are listed in this document.</p>
960
+ </terms></sections>
961
+ </standard-document>
906
962
 
963
+ OUTPUT
964
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
965
+ .to be_equivalent_to xmlpp(output)
966
+ end
907
967
 
908
- it "processes empty terms & definitions with external source" do
909
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
968
+ it "processes empty terms & definitions with external source" do
969
+ input = <<~INPUT
910
970
  #{ASCIIDOC_BLANK_HDR}
911
971
 
912
972
  Foreword
@@ -914,27 +974,27 @@ RSpec.describe Asciidoctor::Standoc do
914
974
  [source="iso1234,iso5678"]
915
975
  == Terms and Definitions
916
976
 
917
- INPUT
918
- #{BLANK_HDR}
919
- <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/>
920
- <preface><foreword id='_' obligation="informative">
921
- <title>Foreword</title>
922
- <p id="_">Foreword</p>
923
- </foreword></preface><sections>
924
- <terms id="_" obligation="normative">
925
- <title>Terms and definitions</title>
926
- <p id="_">For the purposes of this document,
927
- the terms and definitions given in <eref bibitemid="iso1234"/> and <eref bibitemid="iso5678"/> apply.</p>
928
-
929
-
930
- </terms></sections>
931
- </standard-document>
932
-
933
- OUTPUT
934
- end
977
+ INPUT
978
+ output = <<~OUTPUT
979
+ #{BLANK_HDR}
980
+ <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/>
981
+ <preface><foreword id='_' obligation="informative">
982
+ <title>Foreword</title>
983
+ <p id="_">Foreword</p>
984
+ </foreword></preface><sections>
985
+ <terms id="_" obligation="normative">
986
+ <title>Terms and definitions</title>
987
+ <p id="_">For the purposes of this document,
988
+ the terms and definitions given in <eref bibitemid="iso1234"/> and <eref bibitemid="iso5678"/> apply.</p>
989
+ </terms></sections>
990
+ </standard-document>
991
+ OUTPUT
992
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
993
+ .to be_equivalent_to xmlpp(output)
994
+ end
935
995
 
936
- it "processes term document sources in French" do
937
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
996
+ it "processes term document sources in French" do
997
+ input = <<~INPUT
938
998
  = Document title
939
999
  Author
940
1000
  :docfile: test.adoc
@@ -948,26 +1008,26 @@ RSpec.describe Asciidoctor::Standoc do
948
1008
  [source="iso1234,iso5678"]
949
1009
  == Terms and Definitions
950
1010
 
951
- INPUT
952
- #{BLANK_HDR.sub(%r{<language>en</language>}, "<language>fr</language>")}
953
- <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/>
954
- <preface><foreword id='_' obligation="informative">
955
- <title>Avant-propos</title>
956
- <p id="_">Foreword</p>
957
- </foreword></preface><sections>
958
- <terms id="_" obligation="normative">
959
- <title>Terms et définitions</title>
960
- <p id="_">Pour les besoins du présent document, les termes et définitions de <eref bibitemid="iso1234"/> et <eref bibitemid="iso5678"/> s’appliquent.</p>
961
-
962
-
963
- </terms></sections>
964
- </standard-document>
965
-
966
- OUTPUT
967
- end
1011
+ INPUT
1012
+ output = <<~OUTPUT
1013
+ #{BLANK_HDR.sub(%r{<language>en</language>}, '<language>fr</language>')}
1014
+ <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/>
1015
+ <preface><foreword id='_' obligation="informative">
1016
+ <title>Avant-propos</title>
1017
+ <p id="_">Foreword</p>
1018
+ </foreword></preface><sections>
1019
+ <terms id="_" obligation="normative">
1020
+ <title>Terms et définitions</title>
1021
+ <p id="_">Pour les besoins du présent document, les termes et définitions de <eref bibitemid="iso1234"/> et <eref bibitemid="iso5678"/> s’appliquent.</p>
1022
+ </terms></sections>
1023
+ </standard-document>
1024
+ OUTPUT
1025
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1026
+ .to be_equivalent_to xmlpp(output)
1027
+ end
968
1028
 
969
- it "processes term document sources in Chinese" do
970
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1029
+ it "processes term document sources in Chinese" do
1030
+ input = <<~INPUT
971
1031
  = Document title
972
1032
  Author
973
1033
  :docfile: test.adoc
@@ -982,163 +1042,192 @@ RSpec.describe Asciidoctor::Standoc do
982
1042
  [source="iso1234,iso5678"]
983
1043
  == Terms and Definitions
984
1044
 
985
- INPUT
986
- #{BLANK_HDR.sub(%r{<language>en</language>}, "<language>zh</language>").sub(%r{<script>Latn</script>}, "<script>Hans</script>")}
987
- <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/><preface><foreword id='_' obligation="informative">
988
- <title>前言</title>
989
- <p id="_">Foreword</p>
990
- </foreword></preface><sections>
991
- <terms id="_" obligation="normative">
992
- <title>术语和定义</title><p id="_"><eref bibitemid="iso1234"/>和<eref bibitemid="iso5678"/>界定的术语和定义适用于本文件。</p>
993
-
994
-
995
-
996
- </terms></sections>
997
- </standard-document>
998
- OUTPUT
999
- end
1000
-
1001
- it "warn about external source for terms & definitions that does not point anywhere" do
1002
- expect{Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)}.to output(/not referenced/).to_stderr
1003
- #{ASCIIDOC_BLANK_HDR}
1004
-
1005
- [source="iso712"]
1006
- == Terms and Definitions
1007
- === Term2
1008
- INPUT
1009
- end
1010
-
1011
- it "treats terminal terms subclause named as terms clause as a normal clause" do
1012
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1013
- #{ASCIIDOC_BLANK_HDR}
1014
- [[tda]]
1015
- == Terms, definitions, symbols and abbreviations
1016
-
1017
- [[terms]]
1018
- === Terms and definitions
1019
-
1020
- === Symbols
1021
-
1022
- INPUT
1023
- #{BLANK_HDR}
1024
- <sections>
1025
- <terms id='tda' obligation='normative'>
1026
- <title>Terms, definitions and symbols</title>
1027
- <p id='_'>No terms and definitions are listed in this document.</p>
1028
- <clause id='terms' inline-header='false' obligation='normative'>
1029
- <title>Terms and definitions</title>
1030
- </clause>
1031
- <definitions id='_' obligation="normative" type="symbols">
1032
- <title>Symbols</title>
1033
- </definitions>
1034
- </terms>
1035
- </sections>
1036
- </standard-document>
1037
-
1038
- OUTPUT
1039
- end
1040
-
1041
- it "treats non-terminal terms subclause named as terms clause as a terms clause" do
1042
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1043
- #{ASCIIDOC_BLANK_HDR}
1044
- == Scope
1045
-
1046
- [[tda]]
1047
- == Terms, definitions, symbols and abbreviations
1048
-
1049
- [[terms]]
1050
- === Terms and definitions
1051
-
1052
- [[terms-concepts]]
1053
- ==== Basic concepts
1054
-
1055
- [[term-date]]
1056
- ===== date
1057
-
1058
- _time_ (<<term-time>>) on the _calendar_ (<<term-calendar>>) _time scale_ (<<term-time-scale>>)
1059
-
1060
- INPUT
1061
- #{BLANK_HDR}
1062
- <sections>
1063
- <clause id='_' inline-header='false' obligation='normative' type="scope">
1064
- <title>Scope</title>
1065
- </clause>
1066
- <clause id='tda' obligation='normative'>
1067
- <title>Terms and definitions</title>
1068
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1069
- <clause id='terms' obligation='normative'>
1070
- <title>Terms and definitions</title>
1071
- <terms id='terms-concepts' obligation='normative'>
1072
- <title>Basic concepts</title>
1073
- <term id='term-date'>
1074
- <preferred>date</preferred>
1075
- <definition>
1076
- <p id='_'>
1077
- <em>time</em>
1078
- (
1079
- <xref target='term-time'/>
1080
- ) on the
1081
- <em>calendar</em>
1082
- (
1083
- <xref target='term-calendar'/>
1084
- )
1085
- <em>time scale</em>
1086
- (
1087
- <xref target='term-time-scale'/>
1088
- )
1089
- </p>
1090
- </definition>
1091
- </term>
1092
- </terms>
1093
- </clause>
1094
- </clause>
1095
- </sections>
1096
- </standard-document>
1097
- OUTPUT
1098
- end
1099
-
1100
- it "leaves alone special titles in preface or appendix" do
1101
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(strip_guid(<<~"OUTPUT"))
1102
- #{ASCIIDOC_BLANK_HDR}
1103
-
1104
- [.preface]
1105
- [[t1]]
1106
- == Terms and definitions
1107
-
1108
- [[t2]]
1109
- === Term1
1110
-
1111
- [appendix,language=fr]
1112
- [[sym]]
1113
- == Symbols and abbreviated terms
1114
-
1115
- [.appendix]
1116
- [[app]]
1117
- [bibliography]
1118
- == Normative Reference
1119
- INPUT
1120
- #{BLANK_HDR}
1121
- <preface>
1122
- <terms id='t1' obligation='normative'>
1123
- <title>Terms and definitions</title>
1124
- <term id='t2'>
1125
- <preferred>Term1</preferred>
1126
- </term>
1127
- </terms>
1128
- </preface>
1129
- <sections> </sections>
1130
- <annex id='_' obligation='' language='fr' script=''>
1131
- <definitions id='sym' language='fr' obligation="normative">
1132
- <title>Symbols and abbreviated terms</title>
1133
- </definitions>
1134
- </annex>
1135
- <annex id='_' obligation='' language='' script=''>
1136
- <references id='app' obligation='informative' normative="false">
1137
- <title>Bibliography</title>
1138
- </references>
1139
- </annex>
1140
- </standard-document>
1141
- OUTPUT
1142
- end
1045
+ INPUT
1046
+ output = <<~OUTPUT
1047
+ #{BLANK_HDR.sub(%r{<language>en</language>}, '<language>zh</language>').sub(%r{<script>Latn</script>}, '<script>Hans</script>')}
1048
+ <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/><preface><foreword id='_' obligation="informative">
1049
+ <title>前言</title>
1050
+ <p id="_">Foreword</p>
1051
+ </foreword></preface><sections>
1052
+ <terms id="_" obligation="normative">
1053
+ <title>术语和定义</title><p id="_"><eref bibitemid="iso1234"/>和<eref bibitemid="iso5678"/>界定的术语和定义适用于本文件。</p>
1054
+ </terms></sections>
1055
+ </standard-document>
1056
+ OUTPUT
1057
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1058
+ .to be_equivalent_to xmlpp(output)
1059
+ end
1060
+
1061
+ it "warn about external source for terms & definitions that does not point anywhere" do
1062
+ input = <<~INPUT
1063
+ #{ASCIIDOC_BLANK_HDR}
1064
+
1065
+ [source="iso712"]
1066
+ == Terms and Definitions
1067
+ === Term2
1068
+ INPUT
1069
+ expect { Asciidoctor.convert(input, *OPTIONS) }
1070
+ .to output(/not referenced/).to_stderr
1071
+ end
1072
+
1073
+ it "treats terminal terms subclause named as terms clause as a normal clause" do
1074
+ input = <<~INPUT
1075
+ #{ASCIIDOC_BLANK_HDR}
1076
+ [[tda]]
1077
+ == Terms, definitions, symbols and abbreviations
1078
+
1079
+ [[terms]]
1080
+ === Terms and definitions
1081
+
1082
+ === Symbols
1083
+
1084
+ INPUT
1085
+ output = <<~OUTPUT
1086
+ #{BLANK_HDR}
1087
+ <sections>
1088
+ <terms id='tda' obligation='normative'>
1089
+ <title>Terms, definitions and symbols</title>
1090
+ <p id='_'>No terms and definitions are listed in this document.</p>
1091
+ <clause id='terms' inline-header='false' obligation='normative'>
1092
+ <title>Terms and definitions</title>
1093
+ </clause>
1094
+ <definitions id='_' obligation="normative" type="symbols">
1095
+ <title>Symbols</title>
1096
+ </definitions>
1097
+ </terms>
1098
+ </sections>
1099
+ </standard-document>
1100
+ OUTPUT
1101
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1102
+ .to be_equivalent_to xmlpp(output)
1103
+ end
1104
+
1105
+ it "treats non-terminal terms subclause named as terms clause as a terms clause" do
1106
+ input = <<~INPUT
1107
+ #{ASCIIDOC_BLANK_HDR}
1108
+ == Scope
1109
+
1110
+ [[tda]]
1111
+ == Terms, definitions, symbols and abbreviations
1112
+
1113
+ [[terms]]
1114
+ === Terms and definitions
1115
+
1116
+ [[terms-concepts]]
1117
+ ==== Basic concepts
1118
+
1119
+ [[term-date]]
1120
+ ===== date
1121
+
1122
+ _time_ (<<term-time>>) on the _calendar_ (<<term-calendar>>) _time scale_ (<<term-time-scale>>)
1123
+
1124
+ INPUT
1125
+ output = <<~OUTPUT
1126
+ #{BLANK_HDR}
1127
+ <sections>
1128
+ <clause id='_' inline-header='false' obligation='normative' type="scope">
1129
+ <title>Scope</title>
1130
+ </clause>
1131
+ <clause id='tda' obligation='normative'>
1132
+ <title>Terms and definitions</title>
1133
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1134
+ <clause id='terms' obligation='normative'>
1135
+ <title>Terms and definitions</title>
1136
+ <terms id='terms-concepts' obligation='normative'>
1137
+ <title>Basic concepts</title>
1138
+ <term id='term-date'>
1139
+ <preferred>date</preferred>
1140
+ <definition>
1141
+ <p id='_'>
1142
+ <em>time</em>
1143
+ (
1144
+ <xref target='term-time'/>
1145
+ ) on the
1146
+ <em>calendar</em>
1147
+ (
1148
+ <xref target='term-calendar'/>
1149
+ )
1150
+ <em>time scale</em>
1151
+ (
1152
+ <xref target='term-time-scale'/>
1153
+ )
1154
+ </p>
1155
+ </definition>
1156
+ </term>
1157
+ </terms>
1158
+ </clause>
1159
+ </clause>
1160
+ </sections>
1161
+ </standard-document>
1162
+ OUTPUT
1163
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1164
+ .to be_equivalent_to xmlpp(output)
1165
+ end
1166
+
1167
+ it "leaves alone special titles in preface or appendix" do
1168
+ input = <<~INPUT
1169
+ #{ASCIIDOC_BLANK_HDR}
1170
+
1171
+ [.preface]
1172
+ [[t1]]
1173
+ == Terms and definitions
1174
+
1175
+ [[t2]]
1176
+ === Term1
1177
+
1178
+ [appendix,language=fr]
1179
+ [[sym]]
1180
+ == Symbols and abbreviated terms
1181
+
1182
+ [.appendix]
1183
+ [[app]]
1184
+ [bibliography]
1185
+ == Normative Reference
1186
+ INPUT
1187
+ output = <<~OUTPUT
1188
+ #{BLANK_HDR}
1189
+ <preface>
1190
+ <terms id='t1' obligation='normative'>
1191
+ <title>Terms and definitions</title>
1192
+ <term id='t2'>
1193
+ <preferred>Term1</preferred>
1194
+ </term>
1195
+ </terms>
1196
+ </preface>
1197
+ <sections> </sections>
1198
+ <annex id='_' obligation='' language='fr' script=''>
1199
+ <definitions id='sym' language='fr' obligation="normative">
1200
+ <title>Symbols and abbreviated terms</title>
1201
+ </definitions>
1202
+ </annex>
1203
+ <annex id='_' obligation='' language='' script=''>
1204
+ <references id='app' obligation='informative' normative="false">
1205
+ <title>Bibliography</title>
1206
+ </references>
1207
+ </annex>
1208
+ </standard-document>
1209
+ OUTPUT
1210
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1211
+ .to be_equivalent_to xmlpp(output)
1212
+ end
1213
+
1214
+ it "recognises special titles despite following indexterms" do
1215
+ input = <<~INPUT
1216
+ #{ASCIIDOC_BLANK_HDR}
1217
+
1218
+ == Scope (((indexterm)))
1219
+ INPUT
1220
+ output = <<~OUTPUT
1221
+ #{BLANK_HDR}
1222
+ <sections>
1223
+ <clause id='_' type='scope' inline-header='false' obligation='normative'>
1224
+ <title>Scope</title>
1225
+ </clause>
1226
+ </sections>
1227
+ </standard-document>
1228
+ OUTPUT
1229
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1230
+ .to be_equivalent_to xmlpp(output)
1231
+ end
1143
1232
 
1144
1233
  end