metanorma-standoc 1.9.1 → 1.9.2
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -2
- data/lib/asciidoctor/standoc/blocks.rb +18 -3
- data/lib/asciidoctor/standoc/blocks_notes.rb +29 -18
- data/lib/asciidoctor/standoc/cleanup.rb +1 -0
- data/lib/asciidoctor/standoc/cleanup_block.rb +30 -12
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +23 -12
- data/lib/asciidoctor/standoc/cleanup_ref.rb +3 -2
- data/lib/asciidoctor/standoc/converter.rb +7 -2
- data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +67 -66
- data/lib/asciidoctor/standoc/isodoc.rng +174 -0
- data/lib/asciidoctor/standoc/macros.rb +11 -11
- data/lib/asciidoctor/standoc/macros_form.rb +63 -0
- data/lib/asciidoctor/standoc/ref_sect.rb +20 -17
- data/lib/asciidoctor/standoc/section.rb +3 -1
- data/lib/asciidoctor/standoc/terms.rb +24 -17
- data/lib/asciidoctor/standoc/utils.rb +3 -3
- data/lib/asciidoctor/standoc/validate.rb +18 -16
- data/lib/metanorma-standoc.rb +0 -1
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +1 -1
- data/spec/asciidoctor/blocks_spec.rb +829 -734
- data/spec/asciidoctor/cleanup_sections_spec.rb +38 -1
- data/spec/asciidoctor/isobib_cache_spec.rb +406 -358
- data/spec/asciidoctor/macros_spec.rb +537 -441
- data/spec/asciidoctor/macros_yaml2text_spec.rb +1 -1
- data/spec/asciidoctor/section_spec.rb +367 -297
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +50 -50
- data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_123_1.yml +24 -24
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +33 -33
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
- metadata +5 -4
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe Asciidoctor::Standoc do
|
4
4
|
it "processes sections" do
|
5
|
-
|
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
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
721
|
+
input = <<~INPUT
|
722
|
+
#{ASCIIDOC_BLANK_HDR}
|
723
|
+
[heading="terms, definitions, symbols and abbreviated terms"]
|
724
|
+
== Terms, Definitions, Abbreviated Terms Section
|
710
725
|
|
711
|
-
|
726
|
+
=== Term
|
712
727
|
|
713
|
-
|
714
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
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
|
-
|
988
|
-
|
1026
|
+
input = <<~INPUT
|
1027
|
+
#{ASCIIDOC_BLANK_HDR}
|
989
1028
|
|
990
|
-
|
991
|
-
|
992
|
-
|
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
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1038
|
+
input = <<~INPUT
|
1039
|
+
#{ASCIIDOC_BLANK_HDR}
|
1040
|
+
[[tda]]
|
1041
|
+
== Terms, definitions, symbols and abbreviations
|
1001
1042
|
|
1002
|
-
|
1003
|
-
|
1043
|
+
[[terms]]
|
1044
|
+
=== Terms and definitions
|
1004
1045
|
|
1005
|
-
|
1046
|
+
=== Symbols
|
1006
1047
|
|
1007
1048
|
INPUT
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
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
|
-
|
1027
|
-
|
1028
|
-
|
1070
|
+
input = <<~INPUT
|
1071
|
+
#{ASCIIDOC_BLANK_HDR}
|
1072
|
+
== Scope
|
1029
1073
|
|
1030
|
-
|
1031
|
-
|
1074
|
+
[[tda]]
|
1075
|
+
== Terms, definitions, symbols and abbreviations
|
1032
1076
|
|
1033
|
-
|
1034
|
-
|
1077
|
+
[[terms]]
|
1078
|
+
=== Terms and definitions
|
1035
1079
|
|
1036
|
-
|
1037
|
-
|
1080
|
+
[[terms-concepts]]
|
1081
|
+
==== Basic concepts
|
1038
1082
|
|
1039
|
-
|
1040
|
-
|
1083
|
+
[[term-date]]
|
1084
|
+
===== date
|
1041
1085
|
|
1042
|
-
|
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
|
-
|
1086
|
-
|
1132
|
+
input = <<~INPUT
|
1133
|
+
#{ASCIIDOC_BLANK_HDR}
|
1087
1134
|
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1135
|
+
[.preface]
|
1136
|
+
[[t1]]
|
1137
|
+
== Terms and definitions
|
1091
1138
|
|
1092
|
-
|
1093
|
-
|
1139
|
+
[[t2]]
|
1140
|
+
=== Term1
|
1094
1141
|
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1142
|
+
[appendix,language=fr]
|
1143
|
+
[[sym]]
|
1144
|
+
== Symbols and abbreviated terms
|
1098
1145
|
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
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
|