metanorma-standoc 1.3.13 → 1.3.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +5 -1
- data/.github/workflows/ubuntu.yml +5 -1
- data/.github/workflows/windows.yml +5 -1
- data/lib/asciidoctor/standoc/base.rb +1 -0
- data/lib/asciidoctor/standoc/basicdoc.rng +20 -6
- data/lib/asciidoctor/standoc/cleanup.rb +13 -110
- data/lib/asciidoctor/standoc/cleanup_block.rb +5 -108
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +1 -1
- data/lib/asciidoctor/standoc/cleanup_inline.rb +125 -0
- data/lib/asciidoctor/standoc/cleanup_ref.rb +2 -73
- data/lib/asciidoctor/standoc/cleanup_section.rb +195 -0
- data/lib/asciidoctor/standoc/front.rb +1 -88
- data/lib/asciidoctor/standoc/front_contributor.rb +99 -0
- data/lib/asciidoctor/standoc/isodoc.rng +532 -18
- data/lib/asciidoctor/standoc/macros.rb +79 -45
- data/lib/asciidoctor/standoc/reqt.rb +3 -1
- data/lib/asciidoctor/standoc/reqt.rng +2 -2
- data/lib/asciidoctor/standoc/validate.rb +4 -4
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +1 -1
- data/spec/asciidoctor-standoc/base_spec.rb +2 -2
- data/spec/asciidoctor-standoc/blocks_spec.rb +10 -9
- data/spec/asciidoctor-standoc/cleanup_spec.rb +13 -11
- data/spec/asciidoctor-standoc/inline_spec.rb +1 -1
- data/spec/asciidoctor-standoc/isobib_cache_spec.rb +4 -2
- data/spec/asciidoctor-standoc/macros_spec.rb +140 -2
- data/spec/asciidoctor-standoc/refs_spec.rb +4 -0
- data/spec/asciidoctor-standoc/section_spec.rb +14 -14
- data/spec/asciidoctor-standoc/validate_spec.rb +9 -0
- data/spec/spec_helper.rb +1 -1
- metadata +7 -4
@@ -18,6 +18,144 @@ RSpec.describe Asciidoctor::Standoc do
|
|
18
18
|
OUTPUT
|
19
19
|
end
|
20
20
|
|
21
|
+
it "processes the Asciidoctor::Standoc concept macros" do
|
22
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
23
|
+
#{ASCIIDOC_BLANK_HDR}
|
24
|
+
{{clause1}}
|
25
|
+
{{clause1,w\[o\]rd}}
|
26
|
+
{{clause1,w\[o\]rd,term}}
|
27
|
+
{{blah}}
|
28
|
+
{{blah,word}}
|
29
|
+
{{blah,word,term}}
|
30
|
+
{{blah,clause=3.1}}
|
31
|
+
{{blah,clause=3.1,word}}
|
32
|
+
{{blah,clause=3.1,word,term}}
|
33
|
+
{{blah,clause=3.1,figure=a}}
|
34
|
+
{{blah,clause=3.1,figure=a,word}}
|
35
|
+
{{blah,clause=3.1,figure=a,word,term}}
|
36
|
+
{{IEV:135-13-13}}
|
37
|
+
{{IEV:135-13-13,word}}
|
38
|
+
{{IEV:135-13-13,word,term}}
|
39
|
+
|
40
|
+
[[clause1]]
|
41
|
+
== Clause
|
42
|
+
Terms are defined here
|
43
|
+
|
44
|
+
[bibliography]
|
45
|
+
== Bibliography
|
46
|
+
* [[[blah,blah]]] _Blah_
|
47
|
+
INPUT
|
48
|
+
#{BLANK_HDR}
|
49
|
+
<preface>
|
50
|
+
<foreword obligation='informative'>
|
51
|
+
<title>Foreword</title>
|
52
|
+
<p id='_'>
|
53
|
+
<concept>
|
54
|
+
<xref target='clause1'/>
|
55
|
+
</concept>
|
56
|
+
<concept>
|
57
|
+
<xref target='clause1'>w[o]rd</xref>
|
58
|
+
</concept>
|
59
|
+
<concept term='term'>
|
60
|
+
<xref target='clause1'>w[o]rd</xref>
|
61
|
+
</concept>
|
62
|
+
<concept>
|
63
|
+
<eref/>
|
64
|
+
</concept>
|
65
|
+
<concept>
|
66
|
+
<eref>word</eref>
|
67
|
+
</concept>
|
68
|
+
<concept term='term'>
|
69
|
+
<eref>word</eref>
|
70
|
+
</concept>
|
71
|
+
<concept>
|
72
|
+
<eref>
|
73
|
+
<locality type='clause'>
|
74
|
+
<referenceFrom>3.1</referenceFrom>
|
75
|
+
</locality>
|
76
|
+
</eref>
|
77
|
+
</concept>
|
78
|
+
<concept>
|
79
|
+
<eref>
|
80
|
+
<locality type='clause'>
|
81
|
+
<referenceFrom>3.1</referenceFrom>
|
82
|
+
</locality>
|
83
|
+
word
|
84
|
+
</eref>
|
85
|
+
</concept>
|
86
|
+
<concept term='term'>
|
87
|
+
<eref>
|
88
|
+
<locality type='clause'>
|
89
|
+
<referenceFrom>3.1</referenceFrom>
|
90
|
+
</locality>
|
91
|
+
word
|
92
|
+
</eref>
|
93
|
+
</concept>
|
94
|
+
<concept>
|
95
|
+
<eref>
|
96
|
+
<locality type='clause'>
|
97
|
+
<referenceFrom>3.1</referenceFrom>
|
98
|
+
</locality>
|
99
|
+
<locality type='figure'>
|
100
|
+
<referenceFrom>a</referenceFrom>
|
101
|
+
</locality>
|
102
|
+
</eref>
|
103
|
+
</concept>
|
104
|
+
<concept>
|
105
|
+
<eref>
|
106
|
+
<locality type='clause'>
|
107
|
+
<referenceFrom>3.1</referenceFrom>
|
108
|
+
</locality>
|
109
|
+
<locality type='figure'>
|
110
|
+
<referenceFrom>a</referenceFrom>
|
111
|
+
</locality>
|
112
|
+
word
|
113
|
+
</eref>
|
114
|
+
</concept>
|
115
|
+
<concept term='term'>
|
116
|
+
<eref>
|
117
|
+
<locality type='clause'>
|
118
|
+
<referenceFrom>3.1</referenceFrom>
|
119
|
+
</locality>
|
120
|
+
<locality type='figure'>
|
121
|
+
<referenceFrom>a</referenceFrom>
|
122
|
+
</locality>
|
123
|
+
word
|
124
|
+
</eref>
|
125
|
+
</concept>
|
126
|
+
<concept>
|
127
|
+
<termref base='IEV' target='135-13-13'/>
|
128
|
+
</concept>
|
129
|
+
<concept>
|
130
|
+
<termref base='IEV' target='135-13-13'>word</termref>
|
131
|
+
</concept>
|
132
|
+
<concept term='term'>
|
133
|
+
<termref base='IEV' target='135-13-13'>word</termref>
|
134
|
+
</concept>
|
135
|
+
</p>
|
136
|
+
</foreword>
|
137
|
+
</preface>
|
138
|
+
<sections>
|
139
|
+
<clause id='clause1' inline-header='false' obligation='normative'>
|
140
|
+
<title>Clause</title>
|
141
|
+
<p id='_'>Terms are defined here</p>
|
142
|
+
</clause>
|
143
|
+
</sections>
|
144
|
+
<bibliography>
|
145
|
+
<references id='_' obligation='informative'>
|
146
|
+
<title>Bibliography</title>
|
147
|
+
<bibitem id='blah'>
|
148
|
+
<formattedref format='application/x-isodoc+xml'>
|
149
|
+
<em>Blah</em>
|
150
|
+
</formattedref>
|
151
|
+
<docidentifier>blah</docidentifier>
|
152
|
+
</bibitem>
|
153
|
+
</references>
|
154
|
+
</bibliography>
|
155
|
+
</standard-document>
|
156
|
+
OUTPUT
|
157
|
+
end
|
158
|
+
|
21
159
|
it "processes the TODO custom admonition" do
|
22
160
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
23
161
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -114,9 +252,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
114
252
|
</standard-document>
|
115
253
|
OUTPUT
|
116
254
|
end
|
117
|
-
|
255
|
+
|
118
256
|
it "processes the PlantUML macro" do
|
119
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)).gsub(%r{plantuml/[^.]
|
257
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)).gsub(%r{plantuml/plantuml[^.]+\.}, "plantuml/_."))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
120
258
|
#{ASCIIDOC_BLANK_HDR}
|
121
259
|
|
122
260
|
[plantuml]
|
@@ -188,6 +188,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
188
188
|
<formattedref format="text/plain">ISO 123:1985</formattedref>
|
189
189
|
</bibitem>
|
190
190
|
</relation>
|
191
|
+
<place>Geneva</place>
|
191
192
|
</bibitem> </references></bibliography>
|
192
193
|
</standard-document>
|
193
194
|
OUTPUT
|
@@ -339,6 +340,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
339
340
|
</organization>
|
340
341
|
</owner>
|
341
342
|
</copyright>
|
343
|
+
<place>Geneva</place>
|
342
344
|
</bibitem>
|
343
345
|
<bibitem type="standard" id="iso124">
|
344
346
|
<fetched>#{Date.today}</fetched>
|
@@ -387,6 +389,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
387
389
|
<formattedref format="text/plain">ISO 124:2011</formattedref>
|
388
390
|
</bibitem>
|
389
391
|
</relation>
|
392
|
+
<place>Geneva</place>
|
390
393
|
</bibitem>
|
391
394
|
</references></bibliography>
|
392
395
|
</standard-document>
|
@@ -464,6 +467,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
464
467
|
<formattedref format='text/plain'>ISO 124:2011</formattedref>
|
465
468
|
</bibitem>
|
466
469
|
</relation>
|
470
|
+
<place>Geneva</place>
|
467
471
|
</bibitem>
|
468
472
|
</references></bibliography></standard-document>
|
469
473
|
OUTPUT
|
@@ -75,7 +75,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
75
75
|
|
76
76
|
=== Bibliography Subsection
|
77
77
|
INPUT
|
78
|
-
#{BLANK_HDR.sub(/<status>/, "<abstract> <p
|
78
|
+
#{BLANK_HDR.sub(/<status>/, "<abstract> <p>Text</p> </abstract><status>")}
|
79
79
|
<preface><abstract id="_">
|
80
80
|
<p id="_">Text</p>
|
81
81
|
</abstract><foreword obligation="informative">
|
@@ -96,7 +96,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
96
96
|
|
97
97
|
<terms id="_" obligation="normative">
|
98
98
|
<title>Terms and definitions</title>
|
99
|
-
<p>For the purposes of this document,
|
99
|
+
<p id="_">For the purposes of this document,
|
100
100
|
the following terms and definitions apply.</p>
|
101
101
|
<term id="_">
|
102
102
|
<preferred>Term1</preferred>
|
@@ -155,7 +155,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
155
155
|
</clause>
|
156
156
|
</annex><bibliography><references id="_" obligation="informative">
|
157
157
|
<title>Normative References</title>
|
158
|
-
<p>There are no normative references in this document.</p>
|
158
|
+
<p id="_">There are no normative references in this document.</p>
|
159
159
|
</references><clause id="_" obligation="informative">
|
160
160
|
<title>Bibliography</title>
|
161
161
|
<references id="_" obligation="informative">
|
@@ -263,7 +263,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
263
263
|
[language=en,script=Latn]
|
264
264
|
=== Bibliography Subsection
|
265
265
|
INPUT
|
266
|
-
#{BLANK_HDR.sub(/<status>/, "<abstract> <p
|
266
|
+
#{BLANK_HDR.sub(/<status>/, "<abstract> <p>Text</p> </abstract><status>")}
|
267
267
|
<preface><abstract id="_" language="en" script="Latn">
|
268
268
|
<p id="_">Text</p>
|
269
269
|
</abstract><foreword obligation="informative">
|
@@ -284,7 +284,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
284
284
|
|
285
285
|
<terms id="_" language="en" script="Latn" obligation="normative">
|
286
286
|
<title>Terms and definitions</title>
|
287
|
-
<p>For the purposes of this document,
|
287
|
+
<p id="_">For the purposes of this document,
|
288
288
|
the following terms and definitions apply.</p>
|
289
289
|
<term id="_" language="en" script="Latn">
|
290
290
|
<preferred>Term1</preferred>
|
@@ -343,7 +343,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
343
343
|
</clause>
|
344
344
|
</annex><bibliography><references id="_" language="en" script="Latn" obligation="informative">
|
345
345
|
<title>Normative References</title>
|
346
|
-
<p>There are no normative references in this document.</p>
|
346
|
+
<p id="_">There are no normative references in this document.</p>
|
347
347
|
</references><clause id="_" language="en" script="Latn" obligation="informative">
|
348
348
|
<title>Bibliography</title>
|
349
349
|
<references id="_" language="en" script="Latn" obligation="informative">
|
@@ -408,7 +408,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
408
408
|
|
409
409
|
=== Bibliography Subsection
|
410
410
|
INPUT
|
411
|
-
#{BLANK_HDR.sub(/<status>/, "<abstract> <p
|
411
|
+
#{BLANK_HDR.sub(/<status>/, "<abstract> <p>Text</p> </abstract><status>")}
|
412
412
|
<preface>
|
413
413
|
<abstract id='_'>
|
414
414
|
<p id='_'>Text</p>
|
@@ -427,7 +427,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
427
427
|
<sections>
|
428
428
|
<terms id='_' obligation='normative'>
|
429
429
|
<title>Terms and definitions</title>
|
430
|
-
<p>For the purposes of this document, the following terms and definitions apply.</p>
|
430
|
+
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
431
431
|
<term id='_'>
|
432
432
|
<preferred>Term1</preferred>
|
433
433
|
</term>
|
@@ -466,7 +466,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
466
466
|
<bibliography>
|
467
467
|
<references id='_' obligation='informative'>
|
468
468
|
<title>Normative References</title>
|
469
|
-
<p>There are no normative references in this document.</p>
|
469
|
+
<p id="_">There are no normative references in this document.</p>
|
470
470
|
</references>
|
471
471
|
<clause id='_' obligation='informative'>
|
472
472
|
<title>Bibliography</title>
|
@@ -580,7 +580,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
580
580
|
<p id="_">Foreword</p>
|
581
581
|
</foreword></preface><sections>
|
582
582
|
<terms id="_" obligation="normative">
|
583
|
-
<title>Terms and definitions</title><p>For the purposes of this document, the terms and definitions
|
583
|
+
<title>Terms and definitions</title><p id="_">For the purposes of this document, the terms and definitions
|
584
584
|
given in <eref bibitemid="iso1234"/> and <eref bibitemid="iso5678"/> and the following apply.</p>
|
585
585
|
<term id="_">
|
586
586
|
<preferred>Term1</preferred>
|
@@ -607,7 +607,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
607
607
|
<p id="_">Foreword</p>
|
608
608
|
</foreword></preface><sections>
|
609
609
|
<terms id="_" obligation="normative">
|
610
|
-
<title>Terms and definitions</title><p>No terms and definitions are listed in this document.</p>
|
610
|
+
<title>Terms and definitions</title><p id="_">No terms and definitions are listed in this document.</p>
|
611
611
|
</terms></sections>
|
612
612
|
</standard-document>
|
613
613
|
|
@@ -633,7 +633,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
633
633
|
</foreword></preface><sections>
|
634
634
|
<terms id="_" obligation="normative">
|
635
635
|
<title>Terms and definitions</title>
|
636
|
-
<p>For the purposes of this document,
|
636
|
+
<p id="_">For the purposes of this document,
|
637
637
|
the terms and definitions given in <eref bibitemid="iso1234"/> and <eref bibitemid="iso5678"/> apply.</p>
|
638
638
|
|
639
639
|
|
@@ -667,7 +667,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
667
667
|
</foreword></preface><sections>
|
668
668
|
<terms id="_" obligation="normative">
|
669
669
|
<title>Terms and definitions</title>
|
670
|
-
<p>Pour les besoins du présent document, les termes et définitions de <eref bibitemid="iso1234"/> et <eref bibitemid="iso5678"/> s'appliquent.</p>
|
670
|
+
<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>
|
671
671
|
|
672
672
|
|
673
673
|
</terms></sections>
|
@@ -699,7 +699,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
699
699
|
<p id="_">Foreword</p>
|
700
700
|
</foreword></preface><sections>
|
701
701
|
<terms id="_" obligation="normative">
|
702
|
-
<title>Terms and definitions</title><p><eref bibitemid="iso1234"/>和<eref bibitemid="iso5678"/>界定的术语和定义适用于本文件。</p>
|
702
|
+
<title>Terms and definitions</title><p id="_"><eref bibitemid="iso1234"/>和<eref bibitemid="iso5678"/>界定的术语和定义适用于本文件。</p>
|
703
703
|
|
704
704
|
|
705
705
|
|
@@ -140,4 +140,13 @@ it "No warning if French term matches IEV" do
|
|
140
140
|
FileUtils.mv File.expand_path("~/.iev.pstore1"), File.expand_path("~/.iev/cache"), force: true
|
141
141
|
end
|
142
142
|
|
143
|
+
it "No warning if attributes on formatted strong or stem extraneous to Metanomra XML" do
|
144
|
+
expect { Asciidoctor::Standoc::Converter.new(nil,nil).validate(Nokogiri::XML(<<~INPUT)) }.not_to output('found attribute "close", but no attributes allowed here').to_stderr
|
145
|
+
<standard-document>
|
146
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfenced open="(" close=")"><mi>r</mi></mfenced></stem>
|
147
|
+
</standard-document>
|
148
|
+
INPUT
|
149
|
+
|
150
|
+
end
|
151
|
+
|
143
152
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -123,7 +123,7 @@ VALIDATING_BLANK_HDR = <<~"HDR"
|
|
123
123
|
HDR
|
124
124
|
|
125
125
|
NORM_REF_BOILERPLATE = <<~"HDR"
|
126
|
-
<p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
126
|
+
<p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
127
127
|
HDR
|
128
128
|
|
129
129
|
BLANK_HDR = <<~"HDR"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-standoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.7.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.7.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: relaton-iev
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -372,9 +372,12 @@ files:
|
|
372
372
|
- lib/asciidoctor/standoc/cleanup_block.rb
|
373
373
|
- lib/asciidoctor/standoc/cleanup_boilerplate.rb
|
374
374
|
- lib/asciidoctor/standoc/cleanup_footnotes.rb
|
375
|
+
- lib/asciidoctor/standoc/cleanup_inline.rb
|
375
376
|
- lib/asciidoctor/standoc/cleanup_ref.rb
|
377
|
+
- lib/asciidoctor/standoc/cleanup_section.rb
|
376
378
|
- lib/asciidoctor/standoc/converter.rb
|
377
379
|
- lib/asciidoctor/standoc/front.rb
|
380
|
+
- lib/asciidoctor/standoc/front_contributor.rb
|
378
381
|
- lib/asciidoctor/standoc/i18n.rb
|
379
382
|
- lib/asciidoctor/standoc/inline.rb
|
380
383
|
- lib/asciidoctor/standoc/isodoc.rng
|