metanorma-standoc 1.9.0 → 1.10.0

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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -13
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +4 -8
  5. data/lib/asciidoctor/standoc/base.rb +31 -35
  6. data/lib/asciidoctor/standoc/biblio.rng +1 -0
  7. data/lib/asciidoctor/standoc/blocks.rb +25 -9
  8. data/lib/asciidoctor/standoc/blocks_notes.rb +41 -24
  9. data/lib/asciidoctor/standoc/cleanup.rb +59 -84
  10. data/lib/asciidoctor/standoc/cleanup_block.rb +63 -85
  11. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +28 -15
  12. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +1 -0
  13. data/lib/asciidoctor/standoc/cleanup_image.rb +71 -0
  14. data/lib/asciidoctor/standoc/cleanup_inline.rb +117 -77
  15. data/lib/asciidoctor/standoc/cleanup_maths.rb +36 -27
  16. data/lib/asciidoctor/standoc/cleanup_ref.rb +31 -15
  17. data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +1 -1
  18. data/lib/asciidoctor/standoc/cleanup_reqt.rb +47 -0
  19. data/lib/asciidoctor/standoc/cleanup_section.rb +77 -135
  20. data/lib/asciidoctor/standoc/cleanup_section_names.rb +75 -0
  21. data/lib/asciidoctor/standoc/cleanup_terms.rb +19 -18
  22. data/lib/asciidoctor/standoc/converter.rb +7 -2
  23. data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +67 -66
  24. data/lib/asciidoctor/standoc/front.rb +35 -18
  25. data/lib/asciidoctor/standoc/front_contributor.rb +70 -45
  26. data/lib/asciidoctor/standoc/inline.rb +45 -34
  27. data/lib/asciidoctor/standoc/isodoc.rng +209 -4
  28. data/lib/asciidoctor/standoc/lists.rb +4 -2
  29. data/lib/asciidoctor/standoc/macros.rb +11 -11
  30. data/lib/asciidoctor/standoc/macros_form.rb +63 -0
  31. data/lib/asciidoctor/standoc/macros_plantuml.rb +19 -21
  32. data/lib/asciidoctor/standoc/macros_terms.rb +33 -23
  33. data/lib/asciidoctor/standoc/ref.rb +87 -112
  34. data/lib/asciidoctor/standoc/ref_date_id.rb +62 -0
  35. data/lib/asciidoctor/standoc/ref_sect.rb +20 -17
  36. data/lib/asciidoctor/standoc/section.rb +3 -1
  37. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +40 -27
  38. data/lib/asciidoctor/standoc/terms.rb +25 -18
  39. data/lib/asciidoctor/standoc/utils.rb +35 -9
  40. data/lib/asciidoctor/standoc/validate.rb +48 -33
  41. data/lib/metanorma-standoc.rb +0 -1
  42. data/lib/metanorma/standoc/version.rb +1 -1
  43. data/metanorma-standoc.gemspec +4 -4
  44. data/spec/asciidoctor/base_spec.rb +701 -508
  45. data/spec/asciidoctor/blocks_spec.rb +831 -738
  46. data/spec/asciidoctor/cleanup_sections_spec.rb +51 -14
  47. data/spec/asciidoctor/cleanup_spec.rb +889 -682
  48. data/spec/asciidoctor/inline_spec.rb +62 -14
  49. data/spec/asciidoctor/isobib_cache_spec.rb +404 -358
  50. data/spec/asciidoctor/lists_spec.rb +149 -137
  51. data/spec/asciidoctor/macros_plantuml_spec.rb +8 -8
  52. data/spec/asciidoctor/macros_spec.rb +923 -503
  53. data/spec/asciidoctor/macros_yaml2text_spec.rb +1 -1
  54. data/spec/asciidoctor/refs_dl_spec.rb +4 -4
  55. data/spec/asciidoctor/refs_spec.rb +1528 -1533
  56. data/spec/asciidoctor/section_spec.rb +405 -299
  57. data/spec/asciidoctor/table_spec.rb +6 -6
  58. data/spec/asciidoctor/validate_spec.rb +342 -304
  59. data/spec/spec_helper.rb +13 -9
  60. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +54 -54
  61. data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
  62. data/spec/vcr_cassettes/isobib_get_123_1.yml +25 -25
  63. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +37 -37
  64. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  65. data/spec/vcr_cassettes/isobib_get_124.yml +13 -13
  66. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  67. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
  68. metadata +16 -15
  69. data/lib/liquid/custom_blocks/key_iterator.rb +0 -21
  70. data/lib/liquid/custom_blocks/with_json_nested_context.rb +0 -18
  71. data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +0 -19
  72. data/lib/liquid/custom_filters/values.rb +0 -7
@@ -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
 
@@ -95,112 +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
- <clause id="_" inline-header="false" obligation="normative" type="scope">
119
- <title>Scope</title>
120
- <p id="_">Text</p>
121
- </clause>
122
- <terms id="_" obligation="normative">
123
- <title>Terms and definitions</title>
124
- <p id="_">For the purposes of this document,
125
- the following terms and definitions apply.</p>
126
- <term id="term-term1">
127
- <preferred>Term1</preferred>
128
- </term>
129
- </terms>
130
- <clause id="_" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title>
131
- <p id='_'>Boilerplate text</p>
132
- <clause id="_" inline-header="false" obligation="normative">
133
- <title>Introduction</title>
134
- <clause id="_" inline-header="false" obligation="normative">
135
- <title>Intro 1</title>
136
- </clause>
137
- </clause>
138
- <terms id="_" obligation="normative">
139
- <title>Intro 2</title>
140
- <clause id="_" inline-header="false" obligation="normative">
141
- <title>Intro 3</title>
142
- </clause>
143
- </terms>
144
- <clause id="_" obligation="normative">
145
- <title>Intro 4</title>
146
- <terms id="_" obligation="normative">
147
- <title>Intro 5</title>
148
- <term id="term-term1-1">
149
- <preferred>Term1</preferred>
150
- </term>
151
- </terms>
152
- </clause>
153
- <terms id="_" obligation="normative">
154
- <title>Normal Terms</title>
155
- <term id="term-term2">
156
- <preferred>Term2</preferred>
157
- </term>
158
- </terms>
159
- <definitions id="_" obligation="normative"><title>Symbols and abbreviated terms</title><clause id="_" inline-header="false" obligation="normative">
160
- <title>General</title>
161
- </clause>
162
- <definitions id="_" obligation="normative" type="symbols">
163
- <title>Symbols</title>
164
- </definitions></definitions></clause>
165
- <definitions id="_" obligation="normative" type="abbreviated_terms">
166
- <title>Abbreviated terms</title>
167
- </definitions>
168
- <clause id="_" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="_" inline-header="false" obligation="normative">
169
- <title>Introduction</title>
170
- </clause>
171
- <clause id="_" inline-header="false" obligation="normative">
172
- <title>Clause 4.2</title>
173
- </clause></clause>
174
- <clause id="_" inline-header="false" obligation="normative">
175
- <title>Terms and Definitions</title>
176
- </clause>
177
- </sections><annex id="_" inline-header="false" obligation="normative">
178
- <title>Annex</title>
179
- <clause id="_" inline-header="false" obligation="normative">
180
- <title>Annex A.1</title>
181
- </clause>
182
- </annex><bibliography><references id="_" obligation="informative" normative="true">
183
- <title>Normative references</title>
184
- <p id="_">There are no normative references in this document.</p>
185
- </references><clause id="_" obligation="informative">
186
- <title>Bibliography</title>
187
- <references id="_" obligation="informative" normative="false">
188
- <title>Bibliography Subsection</title>
189
- </references>
190
- </clause></bibliography>
191
- <indexsect id='_'>
192
- <title>Index</title>
193
- <p id='_'>This is an index</p>
194
- </indexsect>
195
- <indexsect id='_' type='thematic'>
196
- <title>Thematic Index</title>
197
- </indexsect>
198
- </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>
199
200
  OUTPUT
201
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
202
+ .to be_equivalent_to xmlpp(output)
200
203
  end
201
204
 
202
205
  it "processes sections with number attributes" do
203
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
206
+ input = <<~INPUT
204
207
  #{ASCIIDOC_BLANK_HDR}
205
208
  [number=1bis]
206
209
  == Scope
@@ -264,6 +267,7 @@ RSpec.describe Asciidoctor::Standoc do
264
267
  [number=20bis]
265
268
  === Bibliography Subsection
266
269
  INPUT
270
+ output = <<~OUTPUT
267
271
  #{BLANK_HDR}
268
272
  <sections>
269
273
  <clause id='_' number='1bis' type='scope' inline-header='false' obligation='normative'>
@@ -335,10 +339,12 @@ RSpec.describe Asciidoctor::Standoc do
335
339
  </bibliography>
336
340
  </standard-document>
337
341
  OUTPUT
342
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
343
+ .to be_equivalent_to xmlpp(output)
338
344
  end
339
345
 
340
346
  it "processes sections with language and script attributes" do
341
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
347
+ input = <<~INPUT
342
348
  #{ASCIIDOC_BLANK_HDR}
343
349
  [language=en,script=Latn]
344
350
  == Foreword
@@ -442,105 +448,108 @@ RSpec.describe Asciidoctor::Standoc do
442
448
  [language=en,script=Latn]
443
449
  === Bibliography Subsection
444
450
  INPUT
445
- #{BLANK_HDR.sub(/<status>/, '<abstract> <p>Text</p> </abstract><status>')}
446
- <preface><abstract id="_" language="en" script="Latn">
447
- <title>Abstract</title>
448
- <p id="_">Text</p>
449
- </abstract><foreword id='_' language='en' script='Latn' obligation='informative'>
450
- <title>Foreword</title>
451
- <p id="_">Text</p>
452
- </foreword><introduction id="_" language="en" script="Latn" obligation="informative">
453
- <title>Introduction</title>
454
- <clause id="_" language="en" script="Latn" inline-header="false" obligation="informative">
455
- <title>Introduction Subsection</title>
456
- </clause>
457
- </introduction>
458
- <clause id='_' language='en' script='Latn' inline-header='false' obligation='informative'>
459
- <title>Dedication</title>
460
- </clause>
461
- <acknowledgements id='_' language='en' script='Latn' obligation='informative'>
462
- <title>Acknowledgements</title>
463
- </acknowledgements>
464
- </preface><sections>
465
- <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative" type="scope">
466
- <title>Scope</title>
467
- <p id="_">Text</p>
468
- </clause>
469
- <terms id="_" language="en" script="Latn" obligation="normative">
470
- <title>Terms and definitions</title>
471
- <p id="_">For the purposes of this document,
472
- the following terms and definitions apply.</p>
473
- <term id="term-term1" language="en" script="Latn">
474
- <preferred>Term1</preferred>
475
- </term>
476
- </terms>
477
- <clause id="_" language="en" script="Latn" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title>
478
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
479
- <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
480
- <title>Introduction</title>
481
- <clause id="_" inline-header="false" obligation="normative">
482
- <title>Intro 1</title>
483
- </clause>
484
- </clause>
485
- <terms id="_" language="en" script="Latn" obligation="normative">
486
- <title>Intro 2</title>
487
- <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
488
- <title>Intro 3</title>
489
- </clause>
490
- </terms>
491
- <clause id="_" language="en" script="Latn" obligation="normative">
492
- <title>Intro 4</title>
493
- <terms id="_" language="en" script="Latn" obligation="normative">
494
- <title>Intro 5</title>
495
- <term id="term-term1-1">
496
- <preferred>Term1</preferred>
497
- </term>
498
- </terms>
499
- </clause>
500
- <terms id="_" language="en" script="Latn" obligation="normative">
501
- <title>Normal Terms</title>
502
- <term id="term-term2">
503
- <preferred>Term2</preferred>
504
- </term>
505
- </terms>
506
- <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">
507
- <title>General</title>
508
- </clause>
509
- <definitions id="_" obligation="normative" type="symbols">
510
- <title>Symbols</title>
511
- </definitions></definitions></clause>
512
- <definitions id="_" language="en" script="Latn" obligation="normative" type="abbreviated_terms">
513
- <title>Abbreviated terms</title>
514
- </definitions>
515
- <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">
516
- <title>Introduction</title>
517
- </clause>
518
- <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
519
- <title>Clause 4.2</title>
520
- </clause></clause>
521
- <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
522
- <title>Terms and Definitions</title>
523
- </clause>
524
- </sections><annex id="_" language="en" script="Latn" inline-header="false" obligation="normative">
525
- <title>Annex</title>
526
- <clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
527
- <title>Annex A.1</title>
528
- </clause>
529
- </annex><bibliography><references id="_" language="en" script="Latn" obligation="informative" normative="true">
530
- <title>Normative references</title>
531
- <p id="_">There are no normative references in this document.</p>
532
- </references><clause id="_" language="en" script="Latn" obligation="informative">
533
- <title>Bibliography</title>
534
- <references id="_" language="en" script="Latn" obligation="informative" normative="false">
535
- <title>Bibliography Subsection</title>
536
- </references>
537
- </clause></bibliography>
538
- </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>
539
546
  OUTPUT
547
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
548
+ .to be_equivalent_to xmlpp(output)
540
549
  end
541
550
 
542
551
  it "processes sections with title and type attributes" do
543
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
552
+ input = <<~INPUT
544
553
  #{ASCIIDOC_BLANK_HDR}
545
554
  .Foreword
546
555
 
@@ -598,6 +607,7 @@ RSpec.describe Asciidoctor::Standoc do
598
607
 
599
608
  === Bibliography Subsection
600
609
  INPUT
610
+ output = <<~OUTPUT
601
611
  #{BLANK_HDR.sub(/<status>/, '<abstract> <p>Text</p> </abstract><status>')}
602
612
  <preface>
603
613
  <abstract id='_'>
@@ -672,10 +682,12 @@ RSpec.describe Asciidoctor::Standoc do
672
682
  </bibliography>
673
683
  </standard-document>
674
684
  OUTPUT
685
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
686
+ .to be_equivalent_to xmlpp(output)
675
687
  end
676
688
 
677
689
  it "varies terms & symbols title" do
678
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
690
+ input = <<~INPUT
679
691
  #{ASCIIDOC_BLANK_HDR}
680
692
  [heading="terms, definitions, symbols and abbreviated terms"]
681
693
  == Terms, Definitions, Symbols Section
@@ -685,8 +697,9 @@ RSpec.describe Asciidoctor::Standoc do
685
697
  === Symbols
686
698
 
687
699
  INPUT
688
- #{BLANK_HDR}
689
- <sections>
700
+ output = <<~OUTPUT
701
+ #{BLANK_HDR}
702
+ <sections>
690
703
  <terms id='_' obligation='normative'>
691
704
  <title>Terms, definitions and symbols</title>
692
705
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
@@ -700,20 +713,23 @@ RSpec.describe Asciidoctor::Standoc do
700
713
  </sections>
701
714
  </standard-document>
702
715
  OUTPUT
716
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
717
+ .to be_equivalent_to xmlpp(output)
703
718
  end
704
719
 
705
720
  it "varies terms & abbreviated terms title" do
706
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
707
- #{ASCIIDOC_BLANK_HDR}
708
- [heading="terms, definitions, symbols and abbreviated terms"]
709
- == Terms, Definitions, Abbreviated Terms Section
721
+ input = <<~INPUT
722
+ #{ASCIIDOC_BLANK_HDR}
723
+ [heading="terms, definitions, symbols and abbreviated terms"]
724
+ == Terms, Definitions, Abbreviated Terms Section
710
725
 
711
- === Term
726
+ === Term
712
727
 
713
- [heading="abbreviated terms"]
714
- === Symbols
728
+ [heading="abbreviated terms"]
729
+ === Symbols
715
730
 
716
731
  INPUT
732
+ output = <<~OUTPUT
717
733
  #{BLANK_HDR}
718
734
  <sections>
719
735
  <terms id='_' obligation='normative'>
@@ -729,10 +745,48 @@ RSpec.describe Asciidoctor::Standoc do
729
745
  </sections>
730
746
  </standard-document>
731
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
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)
732
786
  end
733
787
 
734
788
  it "processes section obligations" do
735
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
789
+ input = <<~INPUT
736
790
  #{ASCIIDOC_BLANK_HDR}
737
791
  [obligation=informative]
738
792
  == Clause 1
@@ -745,6 +799,7 @@ RSpec.describe Asciidoctor::Standoc do
745
799
  [appendix,obligation=informative]
746
800
  == Annex
747
801
  INPUT
802
+ output = <<~OUTPUT
748
803
  #{BLANK_HDR}
749
804
  <sections><clause id="_" inline-header="false" obligation="informative">
750
805
  <title>Clause 1</title>
@@ -760,10 +815,12 @@ RSpec.describe Asciidoctor::Standoc do
760
815
  </annex>
761
816
  </standard-document>
762
817
  OUTPUT
818
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
819
+ .to be_equivalent_to xmlpp(output)
763
820
  end
764
821
 
765
822
  it "processes inline headers" do
766
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
823
+ input = <<~INPUT
767
824
  #{ASCIIDOC_BLANK_HDR}
768
825
  == Clause 1
769
826
 
@@ -776,6 +833,7 @@ RSpec.describe Asciidoctor::Standoc do
776
833
  [%inline-header]
777
834
  === Clause Aa
778
835
  INPUT
836
+ output = <<~OUTPUT
779
837
  #{BLANK_HDR}
780
838
  <sections><clause id="_" inline-header="false" obligation="normative">
781
839
  <title>Clause 1</title>
@@ -791,16 +849,19 @@ RSpec.describe Asciidoctor::Standoc do
791
849
  </annex>
792
850
  </standard-document>
793
851
  OUTPUT
852
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
853
+ .to be_equivalent_to xmlpp(output)
794
854
  end
795
855
 
796
856
  it "processes blank headers" do
797
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
857
+ input = <<~INPUT
798
858
  #{ASCIIDOC_BLANK_HDR}
799
859
  == Clause 1
800
860
 
801
861
  === {blank}
802
862
 
803
863
  INPUT
864
+ output = <<~OUTPUT
804
865
  #{BLANK_HDR}
805
866
  <sections>
806
867
  <clause id="_" inline-header="false" obligation="normative">
@@ -811,10 +872,12 @@ RSpec.describe Asciidoctor::Standoc do
811
872
  </sections>
812
873
  </standard-document>
813
874
  OUTPUT
875
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
876
+ .to be_equivalent_to xmlpp(output)
814
877
  end
815
878
 
816
879
  it "processes terminal nodes in terms with term subsection names" do
817
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
880
+ input = <<~INPUT
818
881
  #{ASCIIDOC_BLANK_HDR}
819
882
 
820
883
  == Terms, definitions, symbols and abbreviated terms
@@ -824,6 +887,7 @@ RSpec.describe Asciidoctor::Standoc do
824
887
  === Symbols
825
888
 
826
889
  INPUT
890
+ output = <<~OUTPUT
827
891
  #{BLANK_HDR}
828
892
  <sections>
829
893
  <terms id='_' obligation='normative'>
@@ -839,10 +903,12 @@ RSpec.describe Asciidoctor::Standoc do
839
903
  </sections>
840
904
  </standard-document>
841
905
  OUTPUT
906
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
907
+ .to be_equivalent_to xmlpp(output)
842
908
  end
843
909
 
844
910
  it "processes terms & definitions with external source" do
845
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
911
+ input = <<~INPUT
846
912
  #{ASCIIDOC_BLANK_HDR}
847
913
 
848
914
  Foreword
@@ -853,25 +919,28 @@ RSpec.describe Asciidoctor::Standoc do
853
919
  === Term1
854
920
 
855
921
  INPUT
856
- #{BLANK_HDR}
857
- <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/>
858
- <preface><foreword id='_' obligation="informative">
859
- <title>Foreword</title>
860
- <p id="_">Foreword</p>
861
- </foreword></preface><sections>
862
- <terms id="_" obligation="normative">
863
- <title>Terms and definitions</title><p id="_">For the purposes of this document, the terms and definitions
864
- given in <eref bibitemid="iso1234"/> and <eref bibitemid="iso5678"/> and the following apply.</p>
865
- <term id="term-term1">
866
- <preferred>Term1</preferred>
867
- </term>
868
- </terms></sections>
869
- </standard-document>
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>
870
937
  OUTPUT
938
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
939
+ .to be_equivalent_to xmlpp(output)
871
940
  end
872
941
 
873
942
  it "processes empty terms & definitions" do
874
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
943
+ input = <<~INPUT
875
944
  #{ASCIIDOC_BLANK_HDR}
876
945
 
877
946
  Foreword
@@ -880,6 +949,7 @@ RSpec.describe Asciidoctor::Standoc do
880
949
 
881
950
 
882
951
  INPUT
952
+ output = <<~OUTPUT
883
953
  #{BLANK_HDR}
884
954
  <preface><foreword id='_' obligation="informative">
885
955
  <title>Foreword</title>
@@ -891,10 +961,12 @@ RSpec.describe Asciidoctor::Standoc do
891
961
  </standard-document>
892
962
 
893
963
  OUTPUT
964
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
965
+ .to be_equivalent_to xmlpp(output)
894
966
  end
895
967
 
896
968
  it "processes empty terms & definitions with external source" do
897
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
969
+ input = <<~INPUT
898
970
  #{ASCIIDOC_BLANK_HDR}
899
971
 
900
972
  Foreword
@@ -903,6 +975,7 @@ RSpec.describe Asciidoctor::Standoc do
903
975
  == Terms and Definitions
904
976
 
905
977
  INPUT
978
+ output = <<~OUTPUT
906
979
  #{BLANK_HDR}
907
980
  <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/>
908
981
  <preface><foreword id='_' obligation="informative">
@@ -913,16 +986,15 @@ RSpec.describe Asciidoctor::Standoc do
913
986
  <title>Terms and definitions</title>
914
987
  <p id="_">For the purposes of this document,
915
988
  the terms and definitions given in <eref bibitemid="iso1234"/> and <eref bibitemid="iso5678"/> apply.</p>
916
-
917
-
918
989
  </terms></sections>
919
990
  </standard-document>
920
-
921
991
  OUTPUT
992
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
993
+ .to be_equivalent_to xmlpp(output)
922
994
  end
923
995
 
924
996
  it "processes term document sources in French" do
925
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
997
+ input = <<~INPUT
926
998
  = Document title
927
999
  Author
928
1000
  :docfile: test.adoc
@@ -937,6 +1009,7 @@ RSpec.describe Asciidoctor::Standoc do
937
1009
  == Terms and Definitions
938
1010
 
939
1011
  INPUT
1012
+ output = <<~OUTPUT
940
1013
  #{BLANK_HDR.sub(%r{<language>en</language>}, '<language>fr</language>')}
941
1014
  <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/>
942
1015
  <preface><foreword id='_' obligation="informative">
@@ -946,16 +1019,15 @@ RSpec.describe Asciidoctor::Standoc do
946
1019
  <terms id="_" obligation="normative">
947
1020
  <title>Terms et définitions</title>
948
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>
949
-
950
-
951
1022
  </terms></sections>
952
1023
  </standard-document>
953
-
954
1024
  OUTPUT
1025
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1026
+ .to be_equivalent_to xmlpp(output)
955
1027
  end
956
1028
 
957
1029
  it "processes term document sources in Chinese" do
958
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1030
+ input = <<~INPUT
959
1031
  = Document title
960
1032
  Author
961
1033
  :docfile: test.adoc
@@ -971,77 +1043,86 @@ RSpec.describe Asciidoctor::Standoc do
971
1043
  == Terms and Definitions
972
1044
 
973
1045
  INPUT
974
- #{BLANK_HDR.sub(%r{<language>en</language>}, '<language>zh</language>').sub(%r{<script>Latn</script>}, '<script>Hans</script>')}
975
- <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/><preface><foreword id='_' obligation="informative">
976
- <title>前言</title>
977
- <p id="_">Foreword</p>
978
- </foreword></preface><sections>
979
- <terms id="_" obligation="normative">
980
- <title>术语和定义</title><p id="_"><eref bibitemid="iso1234"/>和<eref bibitemid="iso5678"/>界定的术语和定义适用于本文件。</p>
981
- </terms></sections>
982
- </standard-document>
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>
983
1056
  OUTPUT
1057
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1058
+ .to be_equivalent_to xmlpp(output)
984
1059
  end
985
1060
 
986
1061
  it "warn about external source for terms & definitions that does not point anywhere" do
987
- expect { Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true) }.to output(/not referenced/).to_stderr
988
- #{ASCIIDOC_BLANK_HDR}
1062
+ input = <<~INPUT
1063
+ #{ASCIIDOC_BLANK_HDR}
989
1064
 
990
- [source="iso712"]
991
- == Terms and Definitions
992
- === Term2
1065
+ [source="iso712"]
1066
+ == Terms and Definitions
1067
+ === Term2
993
1068
  INPUT
1069
+ expect { Asciidoctor.convert(input, *OPTIONS) }
1070
+ .to output(/not referenced/).to_stderr
994
1071
  end
995
1072
 
996
1073
  it "treats terminal terms subclause named as terms clause as a normal clause" do
997
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
998
- #{ASCIIDOC_BLANK_HDR}
999
- [[tda]]
1000
- == Terms, definitions, symbols and abbreviations
1074
+ input = <<~INPUT
1075
+ #{ASCIIDOC_BLANK_HDR}
1076
+ [[tda]]
1077
+ == Terms, definitions, symbols and abbreviations
1001
1078
 
1002
- [[terms]]
1003
- === Terms and definitions
1079
+ [[terms]]
1080
+ === Terms and definitions
1004
1081
 
1005
- === Symbols
1082
+ === Symbols
1006
1083
 
1007
1084
  INPUT
1008
- #{BLANK_HDR}
1009
- <sections>
1010
- <terms id='tda' obligation='normative'>
1011
- <title>Terms, definitions and symbols</title>
1012
- <p id='_'>No terms and definitions are listed in this document.</p>
1013
- <clause id='terms' inline-header='false' obligation='normative'>
1014
- <title>Terms and definitions</title>
1015
- </clause>
1016
- <definitions id='_' obligation="normative" type="symbols">
1017
- <title>Symbols</title>
1018
- </definitions>
1019
- </terms>
1020
- </sections>
1021
- </standard-document>
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>
1022
1100
  OUTPUT
1101
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1102
+ .to be_equivalent_to xmlpp(output)
1023
1103
  end
1024
1104
 
1025
1105
  it "treats non-terminal terms subclause named as terms clause as a terms clause" do
1026
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1027
- #{ASCIIDOC_BLANK_HDR}
1028
- == Scope
1106
+ input = <<~INPUT
1107
+ #{ASCIIDOC_BLANK_HDR}
1108
+ == Scope
1029
1109
 
1030
- [[tda]]
1031
- == Terms, definitions, symbols and abbreviations
1110
+ [[tda]]
1111
+ == Terms, definitions, symbols and abbreviations
1032
1112
 
1033
- [[terms]]
1034
- === Terms and definitions
1113
+ [[terms]]
1114
+ === Terms and definitions
1035
1115
 
1036
- [[terms-concepts]]
1037
- ==== Basic concepts
1116
+ [[terms-concepts]]
1117
+ ==== Basic concepts
1038
1118
 
1039
- [[term-date]]
1040
- ===== date
1119
+ [[term-date]]
1120
+ ===== date
1041
1121
 
1042
- _time_ (<<term-time>>) on the _calendar_ (<<term-calendar>>) _time scale_ (<<term-time-scale>>)
1122
+ _time_ (<<term-time>>) on the _calendar_ (<<term-calendar>>) _time scale_ (<<term-time-scale>>)
1043
1123
 
1044
1124
  INPUT
1125
+ output = <<~OUTPUT
1045
1126
  #{BLANK_HDR}
1046
1127
  <sections>
1047
1128
  <clause id='_' inline-header='false' obligation='normative' type="scope">
@@ -1079,28 +1160,31 @@ RSpec.describe Asciidoctor::Standoc do
1079
1160
  </sections>
1080
1161
  </standard-document>
1081
1162
  OUTPUT
1163
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1164
+ .to be_equivalent_to xmlpp(output)
1082
1165
  end
1083
1166
 
1084
1167
  it "leaves alone special titles in preface or appendix" do
1085
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(strip_guid(<<~"OUTPUT"))
1086
- #{ASCIIDOC_BLANK_HDR}
1168
+ input = <<~INPUT
1169
+ #{ASCIIDOC_BLANK_HDR}
1087
1170
 
1088
- [.preface]
1089
- [[t1]]
1090
- == Terms and definitions
1171
+ [.preface]
1172
+ [[t1]]
1173
+ == Terms and definitions
1091
1174
 
1092
- [[t2]]
1093
- === Term1
1175
+ [[t2]]
1176
+ === Term1
1094
1177
 
1095
- [appendix,language=fr]
1096
- [[sym]]
1097
- == Symbols and abbreviated terms
1178
+ [appendix,language=fr]
1179
+ [[sym]]
1180
+ == Symbols and abbreviated terms
1098
1181
 
1099
- [.appendix]
1100
- [[app]]
1101
- [bibliography]
1102
- == Normative Reference
1182
+ [.appendix]
1183
+ [[app]]
1184
+ [bibliography]
1185
+ == Normative Reference
1103
1186
  INPUT
1187
+ output = <<~OUTPUT
1104
1188
  #{BLANK_HDR}
1105
1189
  <preface>
1106
1190
  <terms id='t1' obligation='normative'>
@@ -1123,5 +1207,27 @@ RSpec.describe Asciidoctor::Standoc do
1123
1207
  </annex>
1124
1208
  </standard-document>
1125
1209
  OUTPUT
1210
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1211
+ .to be_equivalent_to xmlpp(output)
1126
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
1232
+
1127
1233
  end