metanorma-standoc 1.9.1 → 1.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -2
  3. data/lib/asciidoctor/standoc/blocks.rb +18 -3
  4. data/lib/asciidoctor/standoc/blocks_notes.rb +29 -18
  5. data/lib/asciidoctor/standoc/cleanup.rb +1 -0
  6. data/lib/asciidoctor/standoc/cleanup_block.rb +30 -12
  7. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +23 -12
  8. data/lib/asciidoctor/standoc/cleanup_ref.rb +3 -2
  9. data/lib/asciidoctor/standoc/converter.rb +7 -2
  10. data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +67 -66
  11. data/lib/asciidoctor/standoc/isodoc.rng +174 -0
  12. data/lib/asciidoctor/standoc/macros.rb +11 -11
  13. data/lib/asciidoctor/standoc/macros_form.rb +63 -0
  14. data/lib/asciidoctor/standoc/ref_sect.rb +20 -17
  15. data/lib/asciidoctor/standoc/section.rb +3 -1
  16. data/lib/asciidoctor/standoc/terms.rb +24 -17
  17. data/lib/asciidoctor/standoc/utils.rb +3 -3
  18. data/lib/asciidoctor/standoc/validate.rb +18 -16
  19. data/lib/metanorma-standoc.rb +0 -1
  20. data/lib/metanorma/standoc/version.rb +1 -1
  21. data/metanorma-standoc.gemspec +1 -1
  22. data/spec/asciidoctor/blocks_spec.rb +829 -734
  23. data/spec/asciidoctor/cleanup_sections_spec.rb +38 -1
  24. data/spec/asciidoctor/isobib_cache_spec.rb +406 -358
  25. data/spec/asciidoctor/macros_spec.rb +537 -441
  26. data/spec/asciidoctor/macros_yaml2text_spec.rb +1 -1
  27. data/spec/asciidoctor/section_spec.rb +367 -297
  28. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +50 -50
  29. data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
  30. data/spec/vcr_cassettes/isobib_get_123_1.yml +24 -24
  31. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +33 -33
  32. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  33. data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
  34. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  35. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
  36. metadata +5 -4
@@ -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)
@@ -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, backend: :standoc, header_footer: true))))
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, backend: :standoc, header_footer: true))))
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, backend: :standoc, header_footer: true))))
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, backend: :standoc, header_footer: true))))
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,6 +697,7 @@ RSpec.describe Asciidoctor::Standoc do
685
697
  === Symbols
686
698
 
687
699
  INPUT
700
+ output = <<~OUTPUT
688
701
  #{BLANK_HDR}
689
702
  <sections>
690
703
  <terms id='_' obligation='normative'>
@@ -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, backend: :standoc, header_footer: true))))
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,12 @@ RSpec.describe Asciidoctor::Standoc do
729
745
  </sections>
730
746
  </standard-document>
731
747
  OUTPUT
748
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
749
+ .to be_equivalent_to xmlpp(output)
732
750
  end
733
751
 
734
752
  it "processes section obligations" do
735
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
753
+ input = <<~INPUT
736
754
  #{ASCIIDOC_BLANK_HDR}
737
755
  [obligation=informative]
738
756
  == Clause 1
@@ -745,6 +763,7 @@ RSpec.describe Asciidoctor::Standoc do
745
763
  [appendix,obligation=informative]
746
764
  == Annex
747
765
  INPUT
766
+ output = <<~OUTPUT
748
767
  #{BLANK_HDR}
749
768
  <sections><clause id="_" inline-header="false" obligation="informative">
750
769
  <title>Clause 1</title>
@@ -760,10 +779,12 @@ RSpec.describe Asciidoctor::Standoc do
760
779
  </annex>
761
780
  </standard-document>
762
781
  OUTPUT
782
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
783
+ .to be_equivalent_to xmlpp(output)
763
784
  end
764
785
 
765
786
  it "processes inline headers" do
766
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
787
+ input = <<~INPUT
767
788
  #{ASCIIDOC_BLANK_HDR}
768
789
  == Clause 1
769
790
 
@@ -776,6 +797,7 @@ RSpec.describe Asciidoctor::Standoc do
776
797
  [%inline-header]
777
798
  === Clause Aa
778
799
  INPUT
800
+ output = <<~OUTPUT
779
801
  #{BLANK_HDR}
780
802
  <sections><clause id="_" inline-header="false" obligation="normative">
781
803
  <title>Clause 1</title>
@@ -791,16 +813,19 @@ RSpec.describe Asciidoctor::Standoc do
791
813
  </annex>
792
814
  </standard-document>
793
815
  OUTPUT
816
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
817
+ .to be_equivalent_to xmlpp(output)
794
818
  end
795
819
 
796
820
  it "processes blank headers" do
797
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
821
+ input = <<~INPUT
798
822
  #{ASCIIDOC_BLANK_HDR}
799
823
  == Clause 1
800
824
 
801
825
  === {blank}
802
826
 
803
827
  INPUT
828
+ output = <<~OUTPUT
804
829
  #{BLANK_HDR}
805
830
  <sections>
806
831
  <clause id="_" inline-header="false" obligation="normative">
@@ -811,10 +836,12 @@ RSpec.describe Asciidoctor::Standoc do
811
836
  </sections>
812
837
  </standard-document>
813
838
  OUTPUT
839
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
840
+ .to be_equivalent_to xmlpp(output)
814
841
  end
815
842
 
816
843
  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")
844
+ input = <<~INPUT
818
845
  #{ASCIIDOC_BLANK_HDR}
819
846
 
820
847
  == Terms, definitions, symbols and abbreviated terms
@@ -824,6 +851,7 @@ RSpec.describe Asciidoctor::Standoc do
824
851
  === Symbols
825
852
 
826
853
  INPUT
854
+ output = <<~OUTPUT
827
855
  #{BLANK_HDR}
828
856
  <sections>
829
857
  <terms id='_' obligation='normative'>
@@ -839,10 +867,12 @@ RSpec.describe Asciidoctor::Standoc do
839
867
  </sections>
840
868
  </standard-document>
841
869
  OUTPUT
870
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
871
+ .to be_equivalent_to xmlpp(output)
842
872
  end
843
873
 
844
874
  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")
875
+ input = <<~INPUT
846
876
  #{ASCIIDOC_BLANK_HDR}
847
877
 
848
878
  Foreword
@@ -853,25 +883,28 @@ RSpec.describe Asciidoctor::Standoc do
853
883
  === Term1
854
884
 
855
885
  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>
886
+ output = <<~OUTPUT
887
+ #{BLANK_HDR}
888
+ <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/>
889
+ <preface><foreword id='_' obligation="informative">
890
+ <title>Foreword</title>
891
+ <p id="_">Foreword</p>
892
+ </foreword></preface><sections>
893
+ <terms id="_" obligation="normative">
894
+ <title>Terms and definitions</title><p id="_">For the purposes of this document, the terms and definitions
895
+ given in <eref bibitemid="iso1234"/> and <eref bibitemid="iso5678"/> and the following apply.</p>
896
+ <term id="term-term1">
897
+ <preferred>Term1</preferred>
898
+ </term>
899
+ </terms></sections>
900
+ </standard-document>
870
901
  OUTPUT
902
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
903
+ .to be_equivalent_to xmlpp(output)
871
904
  end
872
905
 
873
906
  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")
907
+ input = <<~INPUT
875
908
  #{ASCIIDOC_BLANK_HDR}
876
909
 
877
910
  Foreword
@@ -880,6 +913,7 @@ RSpec.describe Asciidoctor::Standoc do
880
913
 
881
914
 
882
915
  INPUT
916
+ output = <<~OUTPUT
883
917
  #{BLANK_HDR}
884
918
  <preface><foreword id='_' obligation="informative">
885
919
  <title>Foreword</title>
@@ -891,10 +925,12 @@ RSpec.describe Asciidoctor::Standoc do
891
925
  </standard-document>
892
926
 
893
927
  OUTPUT
928
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
929
+ .to be_equivalent_to xmlpp(output)
894
930
  end
895
931
 
896
932
  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")
933
+ input = <<~INPUT
898
934
  #{ASCIIDOC_BLANK_HDR}
899
935
 
900
936
  Foreword
@@ -903,6 +939,7 @@ RSpec.describe Asciidoctor::Standoc do
903
939
  == Terms and Definitions
904
940
 
905
941
  INPUT
942
+ output = <<~OUTPUT
906
943
  #{BLANK_HDR}
907
944
  <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/>
908
945
  <preface><foreword id='_' obligation="informative">
@@ -913,16 +950,15 @@ RSpec.describe Asciidoctor::Standoc do
913
950
  <title>Terms and definitions</title>
914
951
  <p id="_">For the purposes of this document,
915
952
  the terms and definitions given in <eref bibitemid="iso1234"/> and <eref bibitemid="iso5678"/> apply.</p>
916
-
917
-
918
953
  </terms></sections>
919
954
  </standard-document>
920
-
921
955
  OUTPUT
956
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
957
+ .to be_equivalent_to xmlpp(output)
922
958
  end
923
959
 
924
960
  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")
961
+ input = <<~INPUT
926
962
  = Document title
927
963
  Author
928
964
  :docfile: test.adoc
@@ -937,6 +973,7 @@ RSpec.describe Asciidoctor::Standoc do
937
973
  == Terms and Definitions
938
974
 
939
975
  INPUT
976
+ output = <<~OUTPUT
940
977
  #{BLANK_HDR.sub(%r{<language>en</language>}, '<language>fr</language>')}
941
978
  <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/>
942
979
  <preface><foreword id='_' obligation="informative">
@@ -946,16 +983,15 @@ RSpec.describe Asciidoctor::Standoc do
946
983
  <terms id="_" obligation="normative">
947
984
  <title>Terms et définitions</title>
948
985
  <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
986
  </terms></sections>
952
987
  </standard-document>
953
-
954
988
  OUTPUT
989
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
990
+ .to be_equivalent_to xmlpp(output)
955
991
  end
956
992
 
957
993
  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")
994
+ input = <<~INPUT
959
995
  = Document title
960
996
  Author
961
997
  :docfile: test.adoc
@@ -971,77 +1007,86 @@ RSpec.describe Asciidoctor::Standoc do
971
1007
  == Terms and Definitions
972
1008
 
973
1009
  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>
1010
+ output = <<~OUTPUT
1011
+ #{BLANK_HDR.sub(%r{<language>en</language>}, '<language>zh</language>').sub(%r{<script>Latn</script>}, '<script>Hans</script>')}
1012
+ <termdocsource bibitemid="iso1234"/><termdocsource bibitemid="iso5678"/><preface><foreword id='_' obligation="informative">
1013
+ <title>前言</title>
1014
+ <p id="_">Foreword</p>
1015
+ </foreword></preface><sections>
1016
+ <terms id="_" obligation="normative">
1017
+ <title>术语和定义</title><p id="_"><eref bibitemid="iso1234"/>和<eref bibitemid="iso5678"/>界定的术语和定义适用于本文件。</p>
1018
+ </terms></sections>
1019
+ </standard-document>
983
1020
  OUTPUT
1021
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
1022
+ .to be_equivalent_to xmlpp(output)
984
1023
  end
985
1024
 
986
1025
  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}
1026
+ input = <<~INPUT
1027
+ #{ASCIIDOC_BLANK_HDR}
989
1028
 
990
- [source="iso712"]
991
- == Terms and Definitions
992
- === Term2
1029
+ [source="iso712"]
1030
+ == Terms and Definitions
1031
+ === Term2
993
1032
  INPUT
1033
+ expect { Asciidoctor.convert(input, backend: :standoc, header_footer: true) }
1034
+ .to output(/not referenced/).to_stderr
994
1035
  end
995
1036
 
996
1037
  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
1038
+ input = <<~INPUT
1039
+ #{ASCIIDOC_BLANK_HDR}
1040
+ [[tda]]
1041
+ == Terms, definitions, symbols and abbreviations
1001
1042
 
1002
- [[terms]]
1003
- === Terms and definitions
1043
+ [[terms]]
1044
+ === Terms and definitions
1004
1045
 
1005
- === Symbols
1046
+ === Symbols
1006
1047
 
1007
1048
  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>
1049
+ output = <<~OUTPUT
1050
+ #{BLANK_HDR}
1051
+ <sections>
1052
+ <terms id='tda' obligation='normative'>
1053
+ <title>Terms, definitions and symbols</title>
1054
+ <p id='_'>No terms and definitions are listed in this document.</p>
1055
+ <clause id='terms' inline-header='false' obligation='normative'>
1056
+ <title>Terms and definitions</title>
1057
+ </clause>
1058
+ <definitions id='_' obligation="normative" type="symbols">
1059
+ <title>Symbols</title>
1060
+ </definitions>
1061
+ </terms>
1062
+ </sections>
1063
+ </standard-document>
1022
1064
  OUTPUT
1065
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
1066
+ .to be_equivalent_to xmlpp(output)
1023
1067
  end
1024
1068
 
1025
1069
  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
1070
+ input = <<~INPUT
1071
+ #{ASCIIDOC_BLANK_HDR}
1072
+ == Scope
1029
1073
 
1030
- [[tda]]
1031
- == Terms, definitions, symbols and abbreviations
1074
+ [[tda]]
1075
+ == Terms, definitions, symbols and abbreviations
1032
1076
 
1033
- [[terms]]
1034
- === Terms and definitions
1077
+ [[terms]]
1078
+ === Terms and definitions
1035
1079
 
1036
- [[terms-concepts]]
1037
- ==== Basic concepts
1080
+ [[terms-concepts]]
1081
+ ==== Basic concepts
1038
1082
 
1039
- [[term-date]]
1040
- ===== date
1083
+ [[term-date]]
1084
+ ===== date
1041
1085
 
1042
- _time_ (<<term-time>>) on the _calendar_ (<<term-calendar>>) _time scale_ (<<term-time-scale>>)
1086
+ _time_ (<<term-time>>) on the _calendar_ (<<term-calendar>>) _time scale_ (<<term-time-scale>>)
1043
1087
 
1044
1088
  INPUT
1089
+ output = <<~OUTPUT
1045
1090
  #{BLANK_HDR}
1046
1091
  <sections>
1047
1092
  <clause id='_' inline-header='false' obligation='normative' type="scope">
@@ -1079,28 +1124,31 @@ RSpec.describe Asciidoctor::Standoc do
1079
1124
  </sections>
1080
1125
  </standard-document>
1081
1126
  OUTPUT
1127
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
1128
+ .to be_equivalent_to xmlpp(output)
1082
1129
  end
1083
1130
 
1084
1131
  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}
1132
+ input = <<~INPUT
1133
+ #{ASCIIDOC_BLANK_HDR}
1087
1134
 
1088
- [.preface]
1089
- [[t1]]
1090
- == Terms and definitions
1135
+ [.preface]
1136
+ [[t1]]
1137
+ == Terms and definitions
1091
1138
 
1092
- [[t2]]
1093
- === Term1
1139
+ [[t2]]
1140
+ === Term1
1094
1141
 
1095
- [appendix,language=fr]
1096
- [[sym]]
1097
- == Symbols and abbreviated terms
1142
+ [appendix,language=fr]
1143
+ [[sym]]
1144
+ == Symbols and abbreviated terms
1098
1145
 
1099
- [.appendix]
1100
- [[app]]
1101
- [bibliography]
1102
- == Normative Reference
1146
+ [.appendix]
1147
+ [[app]]
1148
+ [bibliography]
1149
+ == Normative Reference
1103
1150
  INPUT
1151
+ output = <<~OUTPUT
1104
1152
  #{BLANK_HDR}
1105
1153
  <preface>
1106
1154
  <terms id='t1' obligation='normative'>
@@ -1123,5 +1171,27 @@ RSpec.describe Asciidoctor::Standoc do
1123
1171
  </annex>
1124
1172
  </standard-document>
1125
1173
  OUTPUT
1174
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
1175
+ .to be_equivalent_to xmlpp(output)
1126
1176
  end
1177
+
1178
+ it "recognises special titles despite following indexterms" do
1179
+ input = <<~INPUT
1180
+ #{ASCIIDOC_BLANK_HDR}
1181
+
1182
+ == Scope (((indexterm)))
1183
+ INPUT
1184
+ output = <<~OUTPUT
1185
+ #{BLANK_HDR}
1186
+ <sections>
1187
+ <clause id='_' type='scope' inline-header='false' obligation='normative'>
1188
+ <title>Scope</title>
1189
+ </clause>
1190
+ </sections>
1191
+ </standard-document>
1192
+ OUTPUT
1193
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true))))
1194
+ .to be_equivalent_to xmlpp(output)
1195
+ end
1196
+
1127
1197
  end