metanorma-iso 1.5.14 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +17 -0
  3. data/.rubocop.yml +0 -4
  4. data/lib/asciidoctor/iso/base.rb +13 -13
  5. data/lib/asciidoctor/iso/basicdoc.rng +20 -3
  6. data/lib/asciidoctor/iso/cleanup.rb +1 -1
  7. data/lib/asciidoctor/iso/front.rb +5 -5
  8. data/lib/asciidoctor/iso/isodoc.rng +118 -4
  9. data/lib/asciidoctor/iso/isostandard-amd.rng +11 -4
  10. data/lib/asciidoctor/iso/isostandard.rng +22 -10
  11. data/lib/asciidoctor/iso/validate.rb +78 -0
  12. data/lib/asciidoctor/iso/validate_section.rb +12 -9
  13. data/lib/isodoc/iso/html/header.html +12 -12
  14. data/lib/isodoc/iso/html/html_iso_intro.html +1 -1
  15. data/lib/isodoc/iso/html/html_iso_titlepage.html +1 -1
  16. data/lib/isodoc/iso/html/word_iso_intro.html +1 -1
  17. data/lib/isodoc/iso/html/word_iso_titlepage.html +1 -1
  18. data/lib/isodoc/iso/html_convert.rb +2 -2
  19. data/lib/isodoc/iso/i18n-en.yaml +2 -0
  20. data/lib/isodoc/iso/i18n-fr.yaml +1 -1
  21. data/lib/isodoc/iso/i18n-zh-Hans.yaml +1 -1
  22. data/lib/isodoc/iso/iso.amendment.xsl +451 -208
  23. data/lib/isodoc/iso/iso.international-standard.xsl +451 -208
  24. data/lib/isodoc/iso/sections.rb +1 -1
  25. data/lib/isodoc/iso/word_convert.rb +2 -2
  26. data/lib/isodoc/iso/xref.rb +28 -12
  27. data/lib/metanorma/iso/processor.rb +11 -0
  28. data/lib/metanorma/iso/version.rb +1 -1
  29. data/metanorma-iso.gemspec +2 -2
  30. data/spec/asciidoctor-iso/amd_spec.rb +575 -573
  31. data/spec/asciidoctor-iso/base_spec.rb +449 -458
  32. data/spec/asciidoctor-iso/blocks_spec.rb +333 -288
  33. data/spec/asciidoctor-iso/cleanup_spec.rb +814 -699
  34. data/spec/asciidoctor-iso/inline_spec.rb +116 -91
  35. data/spec/asciidoctor-iso/lists_spec.rb +128 -121
  36. data/spec/asciidoctor-iso/refs_spec.rb +308 -250
  37. data/spec/asciidoctor-iso/section_spec.rb +273 -242
  38. data/spec/asciidoctor-iso/table_spec.rb +258 -242
  39. data/spec/asciidoctor-iso/validate_spec.rb +1223 -919
  40. data/spec/isodoc/amd_spec.rb +967 -946
  41. data/spec/isodoc/blocks_spec.rb +530 -507
  42. data/spec/isodoc/i18n_spec.rb +953 -911
  43. data/spec/isodoc/inline_spec.rb +355 -293
  44. data/spec/isodoc/iso_spec.rb +340 -316
  45. data/spec/isodoc/metadata_spec.rb +392 -382
  46. data/spec/isodoc/postproc_spec.rb +834 -656
  47. data/spec/isodoc/ref_spec.rb +374 -331
  48. data/spec/isodoc/section_spec.rb +608 -525
  49. data/spec/isodoc/table_spec.rb +472 -411
  50. data/spec/isodoc/terms_spec.rb +209 -185
  51. data/spec/isodoc/xref_spec.rb +1370 -1236
  52. data/spec/metanorma/processor_spec.rb +28 -26
  53. data/spec/spec_helper.rb +184 -189
  54. metadata +7 -10
  55. data/.rubocop.ribose.yml +0 -66
  56. data/lib/metanorma/iso/fonts_manifest.yaml +0 -6
  57. data/spec/assets/xref_error.adoc +0 -7
@@ -1,5 +1,4 @@
1
1
  require "spec_helper"
2
- require "fileutils"
3
2
 
4
3
  RSpec.describe Asciidoctor::ISO do
5
4
  it "has a version number" do
@@ -7,30 +6,26 @@ RSpec.describe Asciidoctor::ISO do
7
6
  end
8
7
 
9
8
  it "processes a blank document" do
10
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
11
- #{ASCIIDOC_BLANK_HDR}
9
+ expect(xmlpp(Asciidoctor.convert(<<~"INPUT", *OPTIONS))).to be_equivalent_to xmlpp(<<~"OUTPUT")
10
+ #{ASCIIDOC_BLANK_HDR}
12
11
  INPUT
13
- #{BLANK_HDR}
14
- <sections/>
15
- </iso-standard>
12
+ #{BLANK_HDR}
13
+ <sections/>
14
+ </iso-standard>
16
15
  OUTPUT
17
16
  end
18
17
 
19
18
  it "converts a blank document" do
20
- FileUtils.rm_f "test.doc"
21
- FileUtils.rm_f "test.html"
22
- FileUtils.rm_f "test.pdf"
23
- FileUtils.rm_f "test_alt.html"
24
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
19
+ expect(xmlpp(Asciidoctor.convert(<<~"INPUT", *OPTIONS))).to be_equivalent_to xmlpp(<<~"OUTPUT")
25
20
  = Document title
26
21
  Author
27
22
  :docfile: test.adoc
28
23
  :novalid:
29
24
  :no-isobib:
30
25
  INPUT
31
- #{BLANK_HDR}
32
- <sections/>
33
- </iso-standard>
26
+ #{BLANK_HDR}
27
+ <sections/>
28
+ </iso-standard>
34
29
  OUTPUT
35
30
  expect(File.exist?("test_alt.html")).to be true
36
31
  expect(File.exist?("test.html")).to be true
@@ -39,8 +34,8 @@ RSpec.describe Asciidoctor::ISO do
39
34
  expect(File.exist?("htmlstyle.css")).to be false
40
35
  end
41
36
 
42
- it "converts a blank document in French" do
43
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
37
+ it "converts a blank document in French" do
38
+ expect(xmlpp(Asciidoctor.convert(<<~"INPUT", *OPTIONS))).to be_equivalent_to xmlpp(<<~"OUTPUT")
44
39
  = Document title
45
40
  Author
46
41
  :docfile: test.adoc
@@ -49,14 +44,14 @@ RSpec.describe Asciidoctor::ISO do
49
44
  :no-pdf:
50
45
  :language: fr
51
46
  INPUT
52
- #{BLANK_HDR_FR}
53
- <sections/>
54
- </iso-standard>
47
+ #{BLANK_HDR_FR}
48
+ <sections/>
49
+ </iso-standard>
55
50
  OUTPUT
56
51
  end
57
52
 
58
53
  it "processes default metadata" do
59
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
54
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
60
55
  = Document title
61
56
  Author
62
57
  :docfile: test.adoc
@@ -101,91 +96,91 @@ RSpec.describe Asciidoctor::ISO do
101
96
  :copyright-year: 2000
102
97
  :horizontal: true
103
98
  INPUT
104
- <?xml version="1.0" encoding="UTF-8"?>
105
- <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
106
- <bibdata type="standard">
107
- <title language="en" format="text/plain" type="main">Introduction — Main Title — Title — Title Part</title>
108
- <title language="en" format="text/plain" type="title-intro">Introduction</title>
109
- <title language="en" format="text/plain" type="title-main">Main Title — Title</title>
110
- <title language="en" format="text/plain" type="title-part">Title Part</title>
111
- <title language="fr" format="text/plain" type="main">Introduction Française — Titre Principal — Part du Titre</title>
112
- <title language="fr" format="text/plain" type="title-intro">Introduction Française</title>
113
- <title language="fr" format="text/plain" type="title-main">Titre Principal</title>
114
- <title language="fr" format="text/plain" type="title-part">Part du Titre</title>
115
- <docidentifier type="ISO">ISO/PreWD3 1000-1</docidentifier>
116
- <docidentifier type='iso-with-lang'>ISO/PreWD3 1000-1(E)</docidentifier>
117
- <docidentifier type='iso-reference'>ISO/PreWD3 1000-1:2000(E)</docidentifier>
118
- <docnumber>1000</docnumber>
119
- <contributor>
120
- <role type="author"/>
121
- <organization>
122
- <name>International Organization for Standardization</name>
123
- <abbreviation>ISO</abbreviation>
124
- </organization>
125
- </contributor>
126
- <contributor>
127
- <role type="publisher"/>
128
- <organization>
129
- <name>International Organization for Standardization</name>
130
- <abbreviation>ISO</abbreviation>
131
- </organization>
132
- </contributor>
133
- <edition>2</edition>
134
- <version>
135
- <revision-date>2000-01-01</revision-date>
136
- <draft>0.3.4</draft>
137
- </version>
138
- <language>en</language>
139
- <script>Latn</script>
140
- <status>
141
- <stage abbreviation="WD">20</stage>
142
- <substage>20</substage>
143
- <iteration>3</iteration>
144
- </status>
145
- <copyright>
146
- <from>2000</from>
147
- <owner>
148
- <organization>
149
- <name>International Organization for Standardization</name>
150
- <abbreviation>ISO</abbreviation>
151
- </organization>
152
- </owner>
153
- </copyright>
154
- <ext>
155
- <doctype>article</doctype>
156
- <horizontal>true</horizontal>
157
- <editorialgroup>
158
- <technical-committee number="1" type="A">TC</technical-committee>
159
- <technical-committee number="11" type="A1">TC1</technical-committee>
160
- <subcommittee number="2" type="B">SC</subcommittee>
161
- <subcommittee number="21" type="B1">SC1</subcommittee>
162
- <workgroup number="3" type="C">WG</workgroup>
163
- <workgroup number="31" type="C1">WG1</workgroup>
164
- <secretariat>SECRETARIAT</secretariat>
165
- </editorialgroup>
166
- <ics>
167
- <code>1</code>
168
- </ics>
169
- <ics>
170
- <code>2</code>
171
- </ics>
172
- <ics>
173
- <code>3</code>
174
- </ics>
175
- <structuredidentifier>
176
- <project-number part="1">ISO 1000</project-number>
177
- </structuredidentifier>
178
- <stagename>Third working draft</stagename>
179
- </ext>
180
- </bibdata>
181
- <sections/>
182
- </iso-standard>
99
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
100
+ <?xml version="1.0" encoding="UTF-8"?>
101
+ <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
102
+ <bibdata type="standard">
103
+ <title format="text/plain" language="en" type="main">Introduction — Main Title — Title — Title Part</title>
104
+ <title format="text/plain" language="en" type="title-intro">Introduction</title>
105
+ <title format="text/plain" language="en" type="title-main">Main Title — Title</title>
106
+ <title format="text/plain" language="en" type="title-part">Title Part</title>
107
+ <title format="text/plain" language="fr" type="main">Introduction Française — Titre Principal — Part du Titre</title>
108
+ <title format="text/plain" language="fr" type="title-intro">Introduction Française</title>
109
+ <title format="text/plain" language="fr" type="title-main">Titre Principal</title>
110
+ <title format="text/plain" language="fr" type="title-part">Part du Titre</title>
111
+ <docidentifier type="ISO">ISO/PreWD3 1000-1</docidentifier>
112
+ <docidentifier type="iso-with-lang">ISO/PreWD3 1000-1(E)</docidentifier>
113
+ <docidentifier type="iso-reference">ISO/PreWD3 1000-1:2000(E)</docidentifier>
114
+ <docnumber>1000</docnumber>
115
+ <contributor>
116
+ <role type="author"/>
117
+ <organization>
118
+ <name>International Organization for Standardization</name>
119
+ <abbreviation>ISO</abbreviation>
120
+ </organization>
121
+ </contributor>
122
+ <contributor>
123
+ <role type="publisher"/>
124
+ <organization>
125
+ <name>International Organization for Standardization</name>
126
+ <abbreviation>ISO</abbreviation>
127
+ </organization>
128
+ </contributor>
129
+ <edition>2</edition>
130
+ <version>
131
+ <revision-date>2000-01-01</revision-date>
132
+ <draft>0.3.4</draft>
133
+ </version>
134
+ <language>en</language>
135
+ <script>Latn</script>
136
+ <status>
137
+ <stage abbreviation="WD">20</stage>
138
+ <substage>20</substage>
139
+ <iteration>3</iteration>
140
+ </status>
141
+ <copyright>
142
+ <from>2000</from>
143
+ <owner>
144
+ <organization>
145
+ <name>International Organization for Standardization</name>
146
+ <abbreviation>ISO</abbreviation>
147
+ </organization>
148
+ </owner>
149
+ </copyright>
150
+ <ext>
151
+ <doctype>article</doctype>
152
+ <horizontal>true</horizontal>
153
+ <editorialgroup>
154
+ <technical-committee number="1" type="A">TC</technical-committee>
155
+ <technical-committee number="11" type="A1">TC1</technical-committee>
156
+ <subcommittee number="2" type="B">SC</subcommittee>
157
+ <subcommittee number="21" type="B1">SC1</subcommittee>
158
+ <workgroup number="3" type="C">WG</workgroup>
159
+ <workgroup number="31" type="C1">WG1</workgroup>
160
+ <secretariat>SECRETARIAT</secretariat>
161
+ </editorialgroup>
162
+ <ics>
163
+ <code>1</code>
164
+ </ics>
165
+ <ics>
166
+ <code>2</code>
167
+ </ics>
168
+ <ics>
169
+ <code>3</code>
170
+ </ics>
171
+ <structuredidentifier>
172
+ <project-number part="1">ISO 1000</project-number>
173
+ </structuredidentifier>
174
+ <stagename>Third working draft</stagename>
175
+ </ext>
176
+ </bibdata>
177
+ <sections/>
178
+ </iso-standard>
183
179
  OUTPUT
184
180
  end
185
181
 
186
-
187
182
  it "processes complex metadata" do
188
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
183
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
189
184
  = Document title
190
185
  Author
191
186
  :docfile: test.adoc
@@ -197,8 +192,8 @@ RSpec.describe Asciidoctor::ISO do
197
192
  :tc-docnumber: 2000, 2003
198
193
  :language: el
199
194
  :script: Grek
200
- :publisher: IEC,IETF,ISO
201
- :copyright-holder: ISO,IETF
195
+ :publisher: IEC;IETF;ISO
196
+ :copyright-holder: ISO;IETF
202
197
  :copyright-year: 2001
203
198
  :doctype: technical-report
204
199
  :pub-address: 1 Infinity Loop + \
@@ -208,98 +203,99 @@ RSpec.describe Asciidoctor::ISO do
208
203
  :pub-email: x@example.com
209
204
  :pub-uri: http://www.example.com
210
205
  INPUT
211
- <?xml version="1.0" encoding="UTF-8"?>
212
- <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
213
- <bibdata type="standard">
214
- <docidentifier type="ISO">ISO/IEC/IETF/TR 1000-1-1:2001</docidentifier>
215
- <docidentifier type='iso-with-lang'>ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
216
- <docidentifier type='iso-reference'>ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
217
- <docidentifier type="iso-tc">2000</docidentifier>
218
- <docidentifier type="iso-tc">2003</docidentifier>
219
- <docnumber>1000</docnumber>
220
- <contributor>
221
- <role type="author"/>
222
- <organization>
223
- <name>International Electrotechnical Commission</name>
224
- <abbreviation>IEC</abbreviation>
225
- </organization>
226
- </contributor>
227
- <contributor>
228
- <role type="author"/>
229
- <organization>
230
- <name>IETF</name>
231
- </organization>
232
- </contributor>
233
- <contributor>
234
- <role type="author"/>
235
- <organization>
236
- <name>International Organization for Standardization</name>
237
- <abbreviation>ISO</abbreviation>
238
- </organization>
239
- </contributor>
240
- <contributor>
241
- <role type="publisher"/>
242
- <organization>
243
- <name>International Electrotechnical Commission</name>
244
- <abbreviation>IEC</abbreviation>
245
- </organization>
246
- </contributor>
247
- <contributor>
248
- <role type="publisher"/>
249
- <organization>
250
- <name>IETF</name>
251
- </organization>
252
- </contributor>
253
- <contributor>
254
- <role type="publisher"/>
255
- <organization>
256
- <name>International Organization for Standardization</name>
257
- <abbreviation>ISO</abbreviation>
258
- </organization>
259
- </contributor>
260
- <language>el</language>
261
- <script>Grek</script>
262
- <status>
263
- <stage abbreviation="IS">60</stage>
264
- <substage>60</substage>
265
- </status>
266
- <copyright>
267
- <from>2001</from>
268
- <owner>
269
- <organization>
270
- <name>International Organization for Standardization</name>
271
- <abbreviation>ISO</abbreviation>
272
- </organization>
273
- </owner>
274
- </copyright>
275
- <copyright>
276
- <from>2001</from>
277
- <owner>
278
- <organization>
279
- <name>IETF</name>
280
- </organization>
281
- </owner>
282
- </copyright>
283
- <ext>
284
- <doctype>technical-report</doctype>
285
- <editorialgroup>
286
- <technical-committee/>
287
- <subcommittee/>
288
- <workgroup/>
289
- </editorialgroup>
290
- <structuredidentifier>
291
- <project-number part="1" subpart="1">ISO/IEC/IETF 1000</project-number>
292
- </structuredidentifier>
293
- <stagename>International standard</stagename>
294
- </ext>
295
- </bibdata>
296
- <sections/>
297
- </iso-standard>
206
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
207
+ <?xml version="1.0" encoding="UTF-8"?>
208
+ <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
209
+ <bibdata type="standard">
210
+ <docidentifier type="ISO">ISO/IEC/IETF/TR 1000-1-1:2001</docidentifier>
211
+ <docidentifier type="iso-with-lang">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
212
+ <docidentifier type="iso-reference">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
213
+ <docidentifier type="iso-tc">2000</docidentifier>
214
+ <docidentifier type="iso-tc">2003</docidentifier>
215
+ <docnumber>1000</docnumber>
216
+ <contributor>
217
+ <role type="author"/>
218
+ <organization>
219
+ <name>International Electrotechnical Commission</name>
220
+ <abbreviation>IEC</abbreviation>
221
+ </organization>
222
+ </contributor>
223
+ <contributor>
224
+ <role type="author"/>
225
+ <organization>
226
+ <name>IETF</name>
227
+ </organization>
228
+ </contributor>
229
+ <contributor>
230
+ <role type="author"/>
231
+ <organization>
232
+ <name>International Organization for Standardization</name>
233
+ <abbreviation>ISO</abbreviation>
234
+ </organization>
235
+ </contributor>
236
+ <contributor>
237
+ <role type="publisher"/>
238
+ <organization>
239
+ <name>International Electrotechnical Commission</name>
240
+ <abbreviation>IEC</abbreviation>
241
+ </organization>
242
+ </contributor>
243
+ <contributor>
244
+ <role type="publisher"/>
245
+ <organization>
246
+ <name>IETF</name>
247
+ </organization>
248
+ </contributor>
249
+ <contributor>
250
+ <role type="publisher"/>
251
+ <organization>
252
+ <name>International Organization for Standardization</name>
253
+ <abbreviation>ISO</abbreviation>
254
+ </organization>
255
+ </contributor>
256
+ <language>el</language>
257
+ <script>Grek</script>
258
+ <status>
259
+ <stage abbreviation="IS">60</stage>
260
+ <substage>60</substage>
261
+ </status>
262
+ <copyright>
263
+ <from>2001</from>
264
+ <owner>
265
+ <organization>
266
+ <name>International Organization for Standardization</name>
267
+ <abbreviation>ISO</abbreviation>
268
+ </organization>
269
+ </owner>
270
+ </copyright>
271
+ <copyright>
272
+ <from>2001</from>
273
+ <owner>
274
+ <organization>
275
+ <name>IETF</name>
276
+ </organization>
277
+ </owner>
278
+ </copyright>
279
+ <ext>
280
+ <doctype>technical-report</doctype>
281
+ <editorialgroup>
282
+ <technical-committee/>
283
+ <subcommittee/>
284
+ <workgroup/>
285
+ </editorialgroup>
286
+ <structuredidentifier>
287
+ <project-number part="1" subpart="1">ISO/IEC/IETF 1000</project-number>
288
+ </structuredidentifier>
289
+ <stagename>International standard</stagename>
290
+ </ext>
291
+ </bibdata>
292
+ <sections/>
293
+ </iso-standard>
298
294
  OUTPUT
299
295
  end
300
296
 
301
- it "processes subdivisions" do
302
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, "")))).to be_equivalent_to xmlpp(<<~"OUTPUT")
297
+ it "processes subdivisions" do
298
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
303
299
  = Document title
304
300
  Author
305
301
  :docfile: test.adoc
@@ -321,95 +317,97 @@ RSpec.describe Asciidoctor::ISO do
321
317
  :pub-fax: 4444444
322
318
  :pub-email: x@example.com
323
319
  :pub-uri: http://www.example.com
324
-
325
320
  INPUT
326
- <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
327
- <bibdata type='standard'>
328
- <docidentifier type='ISO'>SD 1000-1-1</docidentifier>
329
- <docidentifier type='iso-with-lang'>SD 1000-1-1(X)</docidentifier>
330
- <docidentifier type='iso-reference'>SD 1000-1-1(X)</docidentifier>
331
- <docidentifier type='iso-tc'>2000</docidentifier>
332
- <docnumber>1000</docnumber>
333
- <date type='published'>
334
- <on>1000-01</on>
335
- </date>
336
- <contributor>
337
- <role type='author'/>
338
- <organization>
339
- <name>International Organization for Standardization</name>
340
- <subdivision>Subdivision</subdivision>
341
- <abbreviation>SD</abbreviation>
342
- <address>
343
- <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
344
- </address>
345
- <phone>3333333</phone>
346
- <phone type='fax'>4444444</phone>
347
- <email>x@example.com</email>
348
- <uri>http://www.example.com</uri>
349
- </organization>
350
- </contributor>
351
- <contributor>
352
- <role type='publisher'/>
353
- <organization>
354
- <name>International Organization for Standardization</name>
355
- <subdivision>Subdivision</subdivision>
356
- <abbreviation>SD</abbreviation>
357
- <address>
358
- <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
359
- </address>
360
- <phone>3333333</phone>
361
- <phone type='fax'>4444444</phone>
362
- <email>x@example.com</email>
363
- <uri>http://www.example.com</uri>
364
- </organization>
365
- </contributor>
366
- <version>
367
- <revision-date>2000-01</revision-date>
368
- </version>
369
- <language>el</language>
370
- <script>Grek</script>
371
- <status>
372
- <stage abbreviation='IS'>60</stage>
373
- <substage>60</substage>
374
- </status>
375
- <copyright>
376
- <from>2020</from>
377
- <owner>
378
- <organization>
379
- <name>International Organization for Standardization</name>
380
- <subdivision>Subdivision</subdivision>
381
- <abbreviation>SD</abbreviation>
382
- <address>
383
- <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
384
- </address>
385
- <phone>3333333</phone>
386
- <phone type='fax'>4444444</phone>
387
- <email>x@example.com</email>
388
- <uri>http://www.example.com</uri>
389
- </organization>
390
- </owner>
391
- </copyright>
392
- <ext>
393
- <doctype>this-is-a-doctype</doctype>
394
- <editorialgroup>
395
- <technical-committee/>
396
- <subcommittee/>
397
- <workgroup/>
398
- </editorialgroup>
399
- <structuredidentifier>
400
- <project-number part='1' subpart='1'>SD 1000</project-number>
401
- </structuredidentifier>
402
- <stagename>International standard</stagename>
403
- </ext>
404
- </bibdata>
405
- <sections> </sections>
406
- </iso-standard>
407
-
408
- OUTPUT
409
- end
321
+ expect(xmlpp(strip_guid(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))))
322
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
323
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
324
+ <bibdata type='standard'>
325
+ <docidentifier type='ISO'>SD 1000-1-1</docidentifier>
326
+ <docidentifier type='iso-with-lang'>SD 1000-1-1(X)</docidentifier>
327
+ <docidentifier type='iso-reference'>SD 1000-1-1(X)</docidentifier>
328
+ <docidentifier type='iso-tc'>2000</docidentifier>
329
+ <docnumber>1000</docnumber>
330
+ <date type='published'>
331
+ <on>1000-01</on>
332
+ </date>
333
+ <contributor>
334
+ <role type='author'/>
335
+ <organization>
336
+ <name>International Organization for Standardization</name>
337
+ <subdivision>Subdivision</subdivision>
338
+ <abbreviation>SD</abbreviation>
339
+ <address>
340
+ <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
341
+ </address>
342
+ <phone>3333333</phone>
343
+ <phone type='fax'>4444444</phone>
344
+ <email>x@example.com</email>
345
+ <uri>http://www.example.com</uri>
346
+ </organization>
347
+ </contributor>
348
+ <contributor>
349
+ <role type='publisher'/>
350
+ <organization>
351
+ <name>International Organization for Standardization</name>
352
+ <subdivision>Subdivision</subdivision>
353
+ <abbreviation>SD</abbreviation>
354
+ <address>
355
+ <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
356
+ </address>
357
+ <phone>3333333</phone>
358
+ <phone type='fax'>4444444</phone>
359
+ <email>x@example.com</email>
360
+ <uri>http://www.example.com</uri>
361
+ </organization>
362
+ </contributor>
363
+ <version>
364
+ <revision-date>2000-01</revision-date>
365
+ </version>
366
+ <language>el</language>
367
+ <script>Grek</script>
368
+ <status>
369
+ <stage abbreviation='IS'>60</stage>
370
+ <substage>60</substage>
371
+ </status>
372
+ <copyright>
373
+ <from>#{Time.now.year}</from>
374
+ <owner>
375
+ <organization>
376
+ <name>International Organization for Standardization</name>
377
+ <subdivision>Subdivision</subdivision>
378
+ <abbreviation>SD</abbreviation>
379
+ <address>
380
+ <formattedAddress>1 Infinity Loop
381
+ <br/>
382
+ California</formattedAddress>
383
+ </address>
384
+ <phone>3333333</phone>
385
+ <phone type="fax">4444444</phone>
386
+ <email>x@example.com</email>
387
+ <uri>http://www.example.com</uri>
388
+ </organization>
389
+ </owner>
390
+ </copyright>
391
+ <ext>
392
+ <doctype>this-is-a-doctype</doctype>
393
+ <editorialgroup>
394
+ <technical-committee/>
395
+ <subcommittee/>
396
+ <workgroup/>
397
+ </editorialgroup>
398
+ <structuredidentifier>
399
+ <project-number part="1" subpart="1">SD 1000</project-number>
400
+ </structuredidentifier>
401
+ <stagename>International standard</stagename>
402
+ </ext>
403
+ </bibdata>
404
+ <sections> </sections>
405
+ </iso-standard>
406
+ OUTPUT
407
+ end
410
408
 
411
- it "defaults substage, defines iteration on stage 50, gives stage 50 on technical specification" do
412
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
409
+ it "defaults substage, defines iteration on stage 50, gives stage 50 on technical specification" do
410
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
413
411
  = Document title
414
412
  Author
415
413
  :docfile: test.adoc
@@ -422,63 +420,63 @@ OUTPUT
422
420
  :doctype: technical-specification
423
421
  :iteration: 2
424
422
  INPUT
425
- <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
426
- <bibdata type="standard">
427
- <docidentifier type="ISO">ISO/DTS 1000.2</docidentifier>
428
- <docidentifier type='iso-with-lang'>ISO/DTS 1000.2(F)</docidentifier>
429
- <docidentifier type='iso-reference'>ISO/DTS 1000.2(F)</docidentifier>
430
- <docnumber>1000</docnumber>
431
- <contributor>
432
- <role type="author"/>
433
- <organization>
434
- <name>International Organization for Standardization</name>
435
- <abbreviation>ISO</abbreviation>
436
- </organization>
437
- </contributor>
438
- <contributor>
439
- <role type="publisher"/>
440
- <organization>
441
- <name>International Organization for Standardization</name>
442
- <abbreviation>ISO</abbreviation>
443
- </organization>
444
- </contributor>
445
-
446
- <language>fr</language>
447
- <script>Latn</script>
448
- <status>
449
- <stage abbreviation="D">50</stage>
450
- <substage>00</substage>
451
- <iteration>2</iteration>
452
- </status>
453
- <copyright>
454
- <from>#{Date.today.year}</from>
455
- <owner>
456
- <organization>
457
- <name>International Organization for Standardization</name>
458
- <abbreviation>ISO</abbreviation>
459
- </organization>
460
- </owner>
461
- </copyright>
462
- <ext>
463
- <doctype>technical-specification</doctype>
464
- <editorialgroup>
465
- <technical-committee/>
466
- <subcommittee/>
467
- <workgroup/>
468
- </editorialgroup>
469
- <structuredidentifier>
470
- <project-number>ISO 1000</project-number>
471
- </structuredidentifier>
472
- <stagename>Final draft</stagename>
473
- </ext>
474
- </bibdata>
475
- <sections/>
476
- </iso-standard>
477
- OUTPUT
478
- end
423
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
424
+ <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
425
+ <bibdata type="standard">
426
+ <docidentifier type="ISO">ISO/DTS 1000.2</docidentifier>
427
+ <docidentifier type="iso-with-lang">ISO/DTS 1000.2(F)</docidentifier>
428
+ <docidentifier type="iso-reference">ISO/DTS 1000.2(F)</docidentifier>
429
+ <docnumber>1000</docnumber>
430
+ <contributor>
431
+ <role type="author"/>
432
+ <organization>
433
+ <name>International Organization for Standardization</name>
434
+ <abbreviation>ISO</abbreviation>
435
+ </organization>
436
+ </contributor>
437
+ <contributor>
438
+ <role type="publisher"/>
439
+ <organization>
440
+ <name>International Organization for Standardization</name>
441
+ <abbreviation>ISO</abbreviation>
442
+ </organization>
443
+ </contributor>
444
+ <language>fr</language>
445
+ <script>Latn</script>
446
+ <status>
447
+ <stage abbreviation="D">50</stage>
448
+ <substage>00</substage>
449
+ <iteration>2</iteration>
450
+ </status>
451
+ <copyright>
452
+ <from>#{Date.today.year}</from>
453
+ <owner>
454
+ <organization>
455
+ <name>International Organization for Standardization</name>
456
+ <abbreviation>ISO</abbreviation>
457
+ </organization>
458
+ </owner>
459
+ </copyright>
460
+ <ext>
461
+ <doctype>technical-specification</doctype>
462
+ <editorialgroup>
463
+ <technical-committee/>
464
+ <subcommittee/>
465
+ <workgroup/>
466
+ </editorialgroup>
467
+ <structuredidentifier>
468
+ <project-number>ISO 1000</project-number>
469
+ </structuredidentifier>
470
+ <stagename>Final draft</stagename>
471
+ </ext>
472
+ </bibdata>
473
+ <sections/>
474
+ </iso-standard>
475
+ OUTPUT
476
+ end
479
477
 
480
- it "defaults substage for stage 60" do
481
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
478
+ it "defaults substage for stage 60" do
479
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
482
480
  = Document title
483
481
  Author
484
482
  :docfile: test.adoc
@@ -488,62 +486,64 @@ OUTPUT
488
486
  :docnumber: 1000
489
487
  :docstage: 60
490
488
  INPUT
491
- <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
492
- <bibdata type="standard">
493
- <docidentifier type="ISO">ISO 1000</docidentifier>
494
- <docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
495
- <docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
496
- <docnumber>1000</docnumber>
497
- <contributor>
498
- <role type="author"/>
499
- <organization>
500
- <name>International Organization for Standardization</name>
501
- <abbreviation>ISO</abbreviation>
502
- </organization>
503
- </contributor>
504
- <contributor>
505
- <role type="publisher"/>
506
- <organization>
507
- <name>International Organization for Standardization</name>
508
- <abbreviation>ISO</abbreviation>
509
- </organization>
510
- </contributor>
511
489
 
512
- <language>en</language>
513
- <script>Latn</script>
514
- <status>
515
- <stage abbreviation="IS">60</stage>
516
- <substage>60</substage>
517
- </status>
518
- <copyright>
519
- <from>#{Date.today.year}</from>
520
- <owner>
521
- <organization>
522
- <name>International Organization for Standardization</name>
523
- <abbreviation>ISO</abbreviation>
524
- </organization>
525
- </owner>
526
- </copyright>
527
- <ext>
528
- <doctype>article</doctype>
529
- <editorialgroup>
530
- <technical-committee/>
531
- <subcommittee/>
532
- <workgroup/>
533
- </editorialgroup>
534
- <structuredidentifier>
535
- <project-number>ISO 1000</project-number>
536
- </structuredidentifier>
537
- <stagename>International standard</stagename>
538
- </ext>
539
- </bibdata>
540
- <sections/>
541
- </iso-standard>
542
- OUTPUT
543
- end
490
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
491
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
492
+ <bibdata type="standard">
493
+ <docidentifier type="ISO">ISO 1000</docidentifier>
494
+ <docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
495
+ <docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
496
+ <docnumber>1000</docnumber>
497
+ <contributor>
498
+ <role type="author"/>
499
+ <organization>
500
+ <name>International Organization for Standardization</name>
501
+ <abbreviation>ISO</abbreviation>
502
+ </organization>
503
+ </contributor>
504
+ <contributor>
505
+ <role type="publisher"/>
506
+ <organization>
507
+ <name>International Organization for Standardization</name>
508
+ <abbreviation>ISO</abbreviation>
509
+ </organization>
510
+ </contributor>
511
+
512
+ <language>en</language>
513
+ <script>Latn</script>
514
+ <status>
515
+ <stage abbreviation="IS">60</stage>
516
+ <substage>60</substage>
517
+ </status>
518
+ <copyright>
519
+ <from>#{Date.today.year}</from>
520
+ <owner>
521
+ <organization>
522
+ <name>International Organization for Standardization</name>
523
+ <abbreviation>ISO</abbreviation>
524
+ </organization>
525
+ </owner>
526
+ </copyright>
527
+ <ext>
528
+ <doctype>article</doctype>
529
+ <editorialgroup>
530
+ <technical-committee/>
531
+ <subcommittee/>
532
+ <workgroup/>
533
+ </editorialgroup>
534
+ <structuredidentifier>
535
+ <project-number>ISO 1000</project-number>
536
+ </structuredidentifier>
537
+ <stagename>International standard</stagename>
538
+ </ext>
539
+ </bibdata>
540
+ <sections/>
541
+ </iso-standard>
542
+ OUTPUT
543
+ end
544
544
 
545
545
  it "populates metadata for PRF" do
546
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
546
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
547
547
  = Document title
548
548
  Author
549
549
  :docfile: test.adoc
@@ -554,64 +554,63 @@ OUTPUT
554
554
  :docstage: 60
555
555
  :docsubstage: 00
556
556
  INPUT
557
- <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
558
- <bibdata type="standard">
559
- <docidentifier type="ISO">ISO 1000</docidentifier>
560
- <docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
561
- <docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
562
- <docnumber>1000</docnumber>
563
- <contributor>
564
- <role type="author"/>
565
- <organization>
566
- <name>International Organization for Standardization</name>
567
- <abbreviation>ISO</abbreviation>
568
- </organization>
569
- </contributor>
570
- <contributor>
571
- <role type="publisher"/>
572
- <organization>
573
- <name>International Organization for Standardization</name>
574
- <abbreviation>ISO</abbreviation>
575
- </organization>
576
- </contributor>
577
-
578
- <language>en</language>
579
- <script>Latn</script>
580
- <status>
581
- <stage abbreviation="PRF">60</stage>
582
- <substage>00</substage>
583
- </status>
584
- <copyright>
585
- <from>#{Date.today.year}</from>
586
- <owner>
587
- <organization>
588
- <name>International Organization for Standardization</name>
589
- <abbreviation>ISO</abbreviation>
590
- </organization>
591
- </owner>
592
- </copyright>
593
- <ext>
594
- <doctype>article</doctype>
595
- <editorialgroup>
596
- <technical-committee/>
597
- <subcommittee/>
598
- <workgroup/>
599
- </editorialgroup>
600
- <structuredidentifier>
601
- <project-number>ISO 1000</project-number>
602
- </structuredidentifier>
603
- <stagename>Proof</stagename>
604
- </ext>
605
- </bibdata>
606
- <sections/>
607
- </iso-standard>
608
- OUTPUT
609
- end
557
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
558
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
559
+ <bibdata type="standard">
560
+ <docidentifier type="ISO">ISO 1000</docidentifier>
561
+ <docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
562
+ <docidentifier type='iso-reference'>ISO 1000(E)</docidentifier>
563
+ <docnumber>1000</docnumber>
564
+ <contributor>
565
+ <role type="author"/>
566
+ <organization>
567
+ <name>International Organization for Standardization</name>
568
+ <abbreviation>ISO</abbreviation>
569
+ </organization>
570
+ </contributor>
571
+ <contributor>
572
+ <role type="publisher"/>
573
+ <organization>
574
+ <name>International Organization for Standardization</name>
575
+ <abbreviation>ISO</abbreviation>
576
+ </organization>
577
+ </contributor>
610
578
 
579
+ <language>en</language>
580
+ <script>Latn</script>
581
+ <status>
582
+ <stage abbreviation="PRF">60</stage>
583
+ <substage>00</substage>
584
+ </status>
585
+ <copyright>
586
+ <from>#{Date.today.year}</from>
587
+ <owner>
588
+ <organization>
589
+ <name>International Organization for Standardization</name>
590
+ <abbreviation>ISO</abbreviation>
591
+ </organization>
592
+ </owner>
593
+ </copyright>
594
+ <ext>
595
+ <doctype>article</doctype>
596
+ <editorialgroup>
597
+ <technical-committee/>
598
+ <subcommittee/>
599
+ <workgroup/>
600
+ </editorialgroup>
601
+ <structuredidentifier>
602
+ <project-number>ISO 1000</project-number>
603
+ </structuredidentifier>
604
+ <stagename>Proof</stagename>
605
+ </ext>
606
+ </bibdata>
607
+ <sections/>
608
+ </iso-standard>
609
+ OUTPUT
610
+ end
611
611
 
612
612
  it "reads scripts into blank HTML document" do
613
- FileUtils.rm_f "test.html"
614
- Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
613
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
615
614
  = Document title
616
615
  Author
617
616
  :docfile: test.adoc
@@ -624,8 +623,7 @@ OUTPUT
624
623
  end
625
624
 
626
625
  it "uses default fonts" do
627
- FileUtils.rm_f "test.html"
628
- Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
626
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
629
627
  = Document title
630
628
  Author
631
629
  :docfile: test.adoc
@@ -640,8 +638,7 @@ OUTPUT
640
638
  end
641
639
 
642
640
  it "uses default fonts for alt doc" do
643
- FileUtils.rm_f "test_alt.html"
644
- Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
641
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
645
642
  = Document title
646
643
  Author
647
644
  :docfile: test.adoc
@@ -656,8 +653,7 @@ OUTPUT
656
653
  end
657
654
 
658
655
  it "uses Chinese fonts" do
659
- FileUtils.rm_f "test.html"
660
- Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
656
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
661
657
  = Document title
662
658
  Author
663
659
  :docfile: test.adoc
@@ -668,13 +664,12 @@ OUTPUT
668
664
  INPUT
669
665
  html = File.read("test.html", encoding: "utf-8")
670
666
  expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
671
- expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "SimSun", serif;]m)
672
- expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "SimHei", sans-serif;]m)
667
+ expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Source Han Sans", serif;]m)
668
+ expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Source Han Sans", sans-serif;]m)
673
669
  end
674
670
 
675
671
  it "uses specified fonts" do
676
- FileUtils.rm_f "test.html"
677
- Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
672
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
678
673
  = Document title
679
674
  Author
680
675
  :docfile: test.adoc
@@ -693,9 +688,7 @@ OUTPUT
693
688
  end
694
689
 
695
690
  it "strips MS-specific CSS" do
696
- FileUtils.rm_f "test.html"
697
- FileUtils.rm_f "test.doc"
698
- Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
691
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
699
692
  = Document title
700
693
  Author
701
694
  :docfile: test.adoc
@@ -708,6 +701,4 @@ OUTPUT
708
701
  expect(word).to match(%r[mso-style-name: "Intro Title";]m)
709
702
  expect(html).not_to match(%r[mso-style-name: "Intro Title";]m)
710
703
  end
711
-
712
-
713
704
  end