metanorma-iso 1.7.1 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -4
  3. data/lib/asciidoctor/iso/base.rb +12 -12
  4. data/lib/asciidoctor/iso/cleanup.rb +1 -1
  5. data/lib/asciidoctor/iso/isodoc.rng +19 -1
  6. data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
  7. data/lib/asciidoctor/iso/isostandard.rng +6 -0
  8. data/lib/metanorma/iso/version.rb +1 -1
  9. data/spec/asciidoctor-iso/amd_spec.rb +575 -573
  10. data/spec/asciidoctor-iso/base_spec.rb +445 -454
  11. data/spec/asciidoctor-iso/blocks_spec.rb +333 -288
  12. data/spec/asciidoctor-iso/cleanup_spec.rb +813 -704
  13. data/spec/asciidoctor-iso/inline_spec.rb +116 -91
  14. data/spec/asciidoctor-iso/lists_spec.rb +128 -121
  15. data/spec/asciidoctor-iso/refs_spec.rb +308 -250
  16. data/spec/asciidoctor-iso/section_spec.rb +273 -242
  17. data/spec/asciidoctor-iso/table_spec.rb +258 -242
  18. data/spec/asciidoctor-iso/validate_spec.rb +1099 -1165
  19. data/spec/isodoc/amd_spec.rb +967 -946
  20. data/spec/isodoc/blocks_spec.rb +530 -507
  21. data/spec/isodoc/i18n_spec.rb +953 -911
  22. data/spec/isodoc/inline_spec.rb +355 -293
  23. data/spec/isodoc/iso_spec.rb +338 -314
  24. data/spec/isodoc/metadata_spec.rb +392 -382
  25. data/spec/isodoc/postproc_spec.rb +833 -656
  26. data/spec/isodoc/ref_spec.rb +374 -331
  27. data/spec/isodoc/section_spec.rb +608 -525
  28. data/spec/isodoc/table_spec.rb +472 -411
  29. data/spec/isodoc/terms_spec.rb +209 -185
  30. data/spec/isodoc/xref_spec.rb +1370 -1236
  31. data/spec/metanorma/processor_spec.rb +28 -26
  32. data/spec/spec_helper.rb +176 -193
  33. metadata +2 -4
  34. data/.rubocop.ribose.yml +0 -66
  35. data/spec/assets/xref_error.adoc +0 -7
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe Asciidoctor::ISO do
4
4
  it "processes inline_quoted formatting" do
5
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
5
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
6
  #{ASCIIDOC_BLANK_HDR}
7
7
  _emphasis_
8
8
  *strong*
@@ -19,35 +19,55 @@ RSpec.describe Asciidoctor::ISO do
19
19
  [strike]#strike#
20
20
  [smallcap]#smallcap#
21
21
  INPUT
22
- #{BLANK_HDR}
23
- <sections>
24
- <em>emphasis</em>
25
- <strong>strong</strong>
26
- <tt>monospace</tt>
27
- “double quote
28
- ‘single quote’
29
- super<sup>script</sup>
30
- sub<sub>script</sub>
31
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
32
- <mi>a</mi>
33
- </mrow>
34
- <mrow>
35
- <mn>90</mn>
36
- </mrow>
37
- </msub></math></stem>
38
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub> <mrow> <mrow> <mi mathvariant="bold-italic">F</mi> </mrow> </mrow> <mrow> <mrow> <mi mathvariant="bold-italic">Α</mi> </mrow> </mrow> </msub> </math></stem>
39
- <admitted>alt</admitted>
40
- <deprecates>deprecated</deprecates>
41
- <domain>domain</domain>
42
- <strike>strike</strike>
43
- <smallcap>smallcap</smallcap>
44
- </sections>
45
- </iso-standard>
22
+ #{BLANK_HDR}
23
+ <sections>
24
+ <em>emphasis</em>
25
+ <strong>strong</strong>
26
+ <tt>monospace</tt>“double quote”
27
+ ‘single quote
28
+ super
29
+ <sup>script</sup>
30
+ sub
31
+ <sub>script</sub>
32
+ <stem type="MathML">
33
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
34
+ <msub>
35
+ <mrow>
36
+ <mi>a</mi></mrow>
37
+ <mrow>
38
+ <mn>90</mn>
39
+ </mrow>
40
+ </msub>
41
+ </math>
42
+ </stem>
43
+ <stem type="MathML">
44
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
45
+ <msub>
46
+ <mrow>
47
+ <mrow>
48
+ <mi mathvariant="bold-italic">F</mi>
49
+ </mrow>
50
+ </mrow>
51
+ <mrow>
52
+ <mrow>
53
+ <mi mathvariant="bold-italic">Α</mi>
54
+ </mrow>
55
+ </mrow>
56
+ </msub>
57
+ </math>
58
+ </stem>
59
+ <admitted>alt</admitted>
60
+ <deprecates>deprecated</deprecates>
61
+ <domain>domain</domain>
62
+ <strike>strike</strike>
63
+ <smallcap>smallcap</smallcap>
64
+ </sections>
65
+ </iso-standard>
46
66
  OUTPUT
47
67
  end
48
68
 
49
69
  it "processes breaks" do
50
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
70
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
51
71
  #{ASCIIDOC_BLANK_HDR}
52
72
  Line break +
53
73
  line break
@@ -56,47 +76,51 @@ RSpec.describe Asciidoctor::ISO do
56
76
 
57
77
  <<<
58
78
  INPUT
59
- #{BLANK_HDR}
60
- <sections><p id="_">Line break<br/>
61
- line break</p>
62
- <hr/>
63
- <pagebreak/></sections>
64
- </iso-standard>
79
+ #{BLANK_HDR}
80
+ <sections>
81
+ <p id="_">Line break
82
+ <br/>
83
+ line break</p>
84
+ <hr/>
85
+ <pagebreak/>
86
+ </sections>
87
+ </iso-standard>
65
88
  OUTPUT
66
89
  end
67
90
 
68
91
  it "processes links" do
69
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
92
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
70
93
  #{ASCIIDOC_BLANK_HDR}
71
94
  mailto:fred@example.com
72
95
  http://example.com[]
73
96
  http://example.com[Link]
74
97
  INPUT
75
- #{BLANK_HDR}
76
- <sections>
77
- <p id="_">mailto:fred@example.com
78
- <link target="http://example.com"/>
79
- <link target="http://example.com">Link</link></p>
80
- </sections>
81
- </iso-standard>
98
+ #{BLANK_HDR}
99
+ <sections>
100
+ <p id="_">mailto:fred@example.com
101
+
102
+ <link target="http://example.com"/>
103
+ <link target="http://example.com">Link</link></p>
104
+ </sections>
105
+ </iso-standard>
82
106
  OUTPUT
83
107
  end
84
108
 
85
- it "processes bookmarks" do
86
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
109
+ it "processes bookmarks" do
110
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
87
111
  #{ASCIIDOC_BLANK_HDR}
88
112
  Text [[bookmark]] Text
89
113
  INPUT
90
- #{BLANK_HDR}
91
- <sections>
92
- <p id="_">Text <bookmark id="bookmark"/> Text</p>
93
- </sections>
94
- </iso-standard>
114
+ #{BLANK_HDR}
115
+ <sections>
116
+ <p id="_">Text <bookmark id="bookmark"/> Text</p>
117
+ </sections>
118
+ </iso-standard>
95
119
  OUTPUT
96
- end
120
+ end
97
121
 
98
- it "processes crossreferences" do
99
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
122
+ it "processes crossreferences" do
123
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
100
124
  #{ASCIIDOC_BLANK_HDR}
101
125
  [[reference]]
102
126
  == Section
@@ -106,22 +130,22 @@ RSpec.describe Asciidoctor::ISO do
106
130
  Inline Reference with Text to <<reference,text>>
107
131
  Footnoted Reference with Text to <<reference,fn: text>>
108
132
  INPUT
109
- #{BLANK_HDR}
133
+ #{BLANK_HDR}
110
134
  <sections>
111
- <clause id="reference" inline-header="false" obligation="normative">
112
- <title>Section</title>
113
- <p id="_">Inline Reference to <xref target="reference"/>
114
- Footnoted Reference to <xref target="reference"/>
115
- Inline Reference with Text to <xref target="reference">text</xref>
116
- Footnoted Reference with Text to <xref target="reference">text</xref></p>
117
- </clause>
118
- </sections>
119
- </iso-standard>
120
- OUTPUT
121
- end
135
+ <clause id="reference" inline-header="false" obligation="normative">
136
+ <title>Section</title>
137
+ <p id="_">Inline Reference to <xref target="reference"/>
138
+ Footnoted Reference to <xref target="reference"/>
139
+ Inline Reference with Text to <xref target="reference">text</xref>
140
+ Footnoted Reference with Text to <xref target="reference">text</xref></p>
141
+ </clause>
142
+ </sections>
143
+ </iso-standard>
144
+ OUTPUT
145
+ end
122
146
 
123
- it "processes bibliographic anchors" do
124
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
147
+ it "processes bibliographic anchors" do
148
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
125
149
  #{ASCIIDOC_BLANK_HDR}
126
150
  [bibliography]
127
151
  == Normative References
@@ -130,41 +154,42 @@ RSpec.describe Asciidoctor::ISO do
130
154
  * [[[ISO713]]] Reference
131
155
 
132
156
  INPUT
133
- #{BLANK_HDR}
134
- <sections>
157
+ #{BLANK_HDR}
158
+ <sections>
135
159
 
136
- </sections><bibliography><references id="_" obligation="informative" normative="true">
137
- <title>Normative references</title>
138
- <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>
139
- <bibitem id="ISO712">
140
- <formattedref format="application/x-isodoc+xml">Reference</formattedref>
141
- <docidentifier>x</docidentifier>
142
- </bibitem>
143
- <bibitem id="ISO713">
144
- <formattedref format="application/x-isodoc+xml">Reference</formattedref>
145
- <docidentifier>ISO713</docidentifier>
146
- <docnumber>713</docnumber>
147
- </bibitem>
148
- </references>
149
- </bibliography>
150
- </iso-standard>
160
+ </sections>
161
+ <bibliography>
162
+ <references id="_" normative="true" obligation="informative">
163
+ <title>Normative references</title>
164
+ <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>
165
+ <bibitem id="ISO712">
166
+ <formattedref format="application/x-isodoc+xml">Reference</formattedref>
167
+ <docidentifier>x</docidentifier>
168
+ </bibitem>
169
+ <bibitem id="ISO713">
170
+ <formattedref format="application/x-isodoc+xml">Reference</formattedref>
171
+ <docidentifier>ISO713</docidentifier>
172
+ <docnumber>713</docnumber>
173
+ </bibitem>
174
+ </references>
175
+ </bibliography>
176
+ </iso-standard>
151
177
  OUTPUT
152
178
  end
153
179
 
154
180
  it "processes footnotes" do
155
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
181
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
156
182
  #{ASCIIDOC_BLANK_HDR}
157
183
  Hello!footnote:[Footnote text]
158
184
  INPUT
159
- #{BLANK_HDR}
160
- <sections>
161
- <p id="_">Hello!<fn reference="1">
162
- <p id="_">Footnote text</p>
163
- </fn></p>
164
- </sections>
165
- </iso-standard>
185
+ #{BLANK_HDR}
186
+ <sections>
187
+ <p id="_">Hello!
188
+ <fn reference="1">
189
+ <p id="_">Footnote text</p></fn>
190
+ </p>
191
+ </sections>
192
+ </iso-standard>
166
193
  OUTPUT
167
194
  end
168
-
169
-
170
195
  end
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe Asciidoctor::ISO do
4
4
  it "processes simple lists" do
5
- output = Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)
5
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
6
6
  #{ASCIIDOC_BLANK_HDR}
7
7
  * List 1
8
8
  * List 2
@@ -17,47 +17,47 @@ RSpec.describe Asciidoctor::ISO do
17
17
 
18
18
  INPUT
19
19
  expect(xmlpp(strip_guid(output))).to be_equivalent_to xmlpp(<<~"OUTPUT")
20
- #{BLANK_HDR}
21
- <sections>
22
- <ul id="_">
23
- <li>
24
- <p id="_">List 1</p>
25
- </li>
26
- <li>
27
- <p id="_">List 2</p>
28
- </li>
29
- <li>
30
- <p id="_">List 3</p>
31
- <ol id="_">
32
- <li>
33
- <p id="_">List A</p>
34
- </li>
35
- <li>
36
- <p id="_">List B</p>
37
- </li>
38
- <li>
39
- <p id="_">List C</p>
40
- <dl id="_">
41
- <dt>List D</dt>
42
- <dd>
43
- <p id="_">List E</p>
44
- </dd>
45
- <dt>List F</dt>
46
- <dd>
47
- <p id="_">List G</p>
48
- </dd>
49
- </dl>
50
- </li>
51
- </ol>
52
- </li>
53
- </ul>
54
- </sections>
55
- </iso-standard>
20
+ #{BLANK_HDR}
21
+ <sections>
22
+ <ul id="_">
23
+ <li>
24
+ <p id="_">List 1</p>
25
+ </li>
26
+ <li>
27
+ <p id="_">List 2</p>
28
+ </li>
29
+ <li>
30
+ <p id="_">List 3</p>
31
+ <ol id="_">
32
+ <li>
33
+ <p id="_">List A</p>
34
+ </li>
35
+ <li>
36
+ <p id="_">List B</p>
37
+ </li>
38
+ <li>
39
+ <p id="_">List C</p>
40
+ <dl id="_">
41
+ <dt>List D</dt>
42
+ <dd>
43
+ <p id="_">List E</p>
44
+ </dd>
45
+ <dt>List F</dt>
46
+ <dd>
47
+ <p id="_">List G</p>
48
+ </dd>
49
+ </dl>
50
+ </li>
51
+ </ol>
52
+ </li>
53
+ </ul>
54
+ </sections>
55
+ </iso-standard>
56
56
  OUTPUT
57
57
  end
58
58
 
59
- it "processes complex lists" do
60
- output = Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)
59
+ it "processes complex lists" do
60
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
61
61
  #{ASCIIDOC_BLANK_HDR}
62
62
  [[id]]
63
63
  * First
@@ -99,92 +99,99 @@ RSpec.describe Asciidoctor::ISO do
99
99
 
100
100
  INPUT
101
101
  expect(xmlpp(strip_guid(output))).to be_equivalent_to xmlpp(<<~"OUTPUT")
102
- #{BLANK_HDR}
103
- <sections><ul id="id">
104
- <li>
105
- <p id="_">First</p>
106
- </li>
107
- <li><p id="_">Second</p><p id="_">entry1</p>
108
- <p id="_">entry2</p></li>
109
- </ul>
110
- <ol id="id1">
111
- <li>
112
- <p id="_">First</p>
113
- </li>
114
- <li>
115
- <p id="_">Second</p>
116
- <ol id="_">
117
- <li>
118
- <p id="_">Third</p>
119
- </li>
120
- <li>
121
- <p id="_">Fourth</p>
122
- </li>
123
- </ol>
124
- </li>
125
- <li>
126
- <p id="_">Fifth</p>
127
- </li>
128
- <li>
129
- <p id="_">Sixth</p>
130
- </li>
131
- </ol>
132
- <ol id="_">
133
- <li>
134
- <p id="_">A</p>
135
- </li>
136
- <li>
137
- <p id="_">B</p>
138
- <ol id="_">
139
- <li>
140
- <p id="_">C</p>
141
- </li>
142
- <li>
143
- <p id="_">D</p>
144
- <ol id="_">
145
- <li>
146
- <p id="_">E</p>
147
- </li>
148
- <li>
149
- <p id="_">F</p>
150
- <dl id="_">
151
- <dt>Notes1</dt>
152
- <dd/>
153
- <dt>Notes</dt>
154
- <dd><p id="_">Note 1.</p><p id="_">Note 2.</p>
155
- <p id="_">Note 3.</p></dd>
156
- </dl>
157
- </li>
158
- </ol>
159
- </li>
160
- </ol>
161
- </li>
162
- </ol></sections>
163
- </iso-standard>
164
- OUTPUT
165
- end
102
+ #{BLANK_HDR}
103
+ <sections>
104
+ <ul id="id">
105
+ <li>
106
+ <p id="_">First</p>
107
+ </li>
108
+ <li>
109
+ <p id="_">Second</p>
110
+ <p id="_">entry1</p>
111
+ <p id="_">entry2</p>
112
+ </li>
113
+ </ul>
114
+ <ol id="id1">
115
+ <li>
116
+ <p id="_">First</p>
117
+ </li>
118
+ <li>
119
+ <p id="_">Second</p>
120
+ <ol id="_">
121
+ <li>
122
+ <p id="_">Third</p>
123
+ </li>
124
+ <li>
125
+ <p id="_">Fourth</p>
126
+ </li>
127
+ </ol>
128
+ </li>
129
+ <li>
130
+ <p id="_">Fifth</p>
131
+ </li>
132
+ <li>
133
+ <p id="_">Sixth</p>
134
+ </li>
135
+ </ol>
136
+ <ol id="_">
137
+ <li>
138
+ <p id="_">A</p>
139
+ </li>
140
+ <li>
141
+ <p id="_">B</p>
142
+ <ol id="_">
143
+ <li>
144
+ <p id="_">C</p>
145
+ </li>
146
+ <li>
147
+ <p id="_">D</p>
148
+ <ol id="_">
149
+ <li>
150
+ <p id="_">E</p>
151
+ </li>
152
+ <li>
153
+ <p id="_">F</p>
154
+ <dl id="_">
155
+ <dt>Notes1</dt>
156
+ <dd/>
157
+ <dt>Notes</dt>
158
+ <dd>
159
+ <p id="_">Note 1.</p>
160
+ <p id="_">Note 2.</p>
161
+ <p id="_">Note 3.</p>
162
+ </dd>
163
+ </dl>
164
+ </li>
165
+ </ol>
166
+ </li>
167
+ </ol>
168
+ </li>
169
+ </ol>
170
+ </sections>
171
+ </iso-standard>
172
+ OUTPUT
173
+ end
166
174
 
167
- it "anchors lists and list items" do
168
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
175
+ it "anchors lists and list items" do
176
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
169
177
  #{ASCIIDOC_BLANK_HDR}
170
178
  [[id1]]
171
179
  * [[id2]] List item
172
180
  * Hello [[id3]] List item
173
181
 
174
- INPUT
175
- #{BLANK_HDR}
176
- <sections>
177
- <ul id="id1">
178
- <li id="id2">
179
- <p id="_">List item</p>
180
- </li>
181
- <li>
182
- <p id="_">Hello <bookmark id="id3"/> List item</p>
183
- </li>
184
- </ul>
185
- </sections>
186
- </iso-standard>
187
- OUTPUT
188
- end
189
-
182
+ INPUT
183
+ #{BLANK_HDR}
184
+ <sections>
185
+ <ul id="id1">
186
+ <li id="id2">
187
+ <p id="_">List item</p>
188
+ </li>
189
+ <li>
190
+ <p id="_">Hello <bookmark id="id3"/> List item</p>
191
+ </li>
192
+ </ul>
193
+ </sections>
194
+ </iso-standard>
195
+ OUTPUT
196
+ end
190
197
  end