metanorma-iso 1.5.6 → 1.5.11

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +9 -1
  3. data/.github/workflows/ubuntu.yml +8 -0
  4. data/.github/workflows/windows.yml +7 -0
  5. data/lib/asciidoctor/iso/basicdoc.rng +4 -11
  6. data/lib/asciidoctor/iso/boilerplate-fr.xml +40 -0
  7. data/lib/asciidoctor/iso/boilerplate.xml +1 -0
  8. data/lib/asciidoctor/iso/cleanup.rb +5 -0
  9. data/lib/asciidoctor/iso/front.rb +9 -15
  10. data/lib/asciidoctor/iso/isodoc.rng +14 -50
  11. data/lib/asciidoctor/iso/isostandard.rng +8 -1
  12. data/lib/isodoc/iso/html/header.html +8 -16
  13. data/lib/isodoc/iso/html/style-human.css +5 -1
  14. data/lib/isodoc/iso/html/style-iso.css +5 -1
  15. data/lib/isodoc/iso/i18n-en.yaml +3 -0
  16. data/lib/isodoc/iso/i18n-fr.yaml +3 -0
  17. data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
  18. data/lib/isodoc/iso/iso.amendment.xsl +543 -94
  19. data/lib/isodoc/iso/iso.international-standard.xsl +543 -94
  20. data/lib/isodoc/iso/isosts_convert.rb +31 -0
  21. data/lib/isodoc/iso/metadata.rb +19 -19
  22. data/lib/metanorma-iso.rb +1 -0
  23. data/lib/metanorma/iso/processor.rb +1 -1
  24. data/lib/metanorma/iso/version.rb +1 -1
  25. data/metanorma-iso.gemspec +1 -1
  26. data/spec/asciidoctor-iso/amd_spec.rb +7 -7
  27. data/spec/asciidoctor-iso/base_spec.rb +144 -18
  28. data/spec/asciidoctor-iso/validate_spec.rb +35 -15
  29. data/spec/assets/xref_error.adoc +7 -0
  30. data/spec/isodoc/amd_spec.rb +191 -17
  31. data/spec/isodoc/blocks_spec.rb +1 -1
  32. data/spec/isodoc/i18n_spec.rb +13 -13
  33. data/spec/isodoc/inline_spec.rb +2 -2
  34. data/spec/isodoc/iso_spec.rb +2 -2
  35. data/spec/isodoc/metadata_spec.rb +170 -19
  36. data/spec/isodoc/postproc_spec.rb +3 -3
  37. data/spec/isodoc/ref_spec.rb +3 -3
  38. data/spec/isodoc/section_spec.rb +2 -2
  39. data/spec/isodoc/table_spec.rb +1 -1
  40. data/spec/isodoc/terms_spec.rb +1 -1
  41. data/spec/isodoc/xref_spec.rb +11 -11
  42. data/spec/metanorma/processor_spec.rb +1 -1
  43. data/spec/spec_helper.rb +22 -2
  44. metadata +7 -4
@@ -0,0 +1,31 @@
1
+ require "isodoc"
2
+ require "mn2sts"
3
+
4
+ module IsoDoc
5
+ module Iso
6
+
7
+ # A {Converter} implementation that generates HTML output, and a document
8
+ # schema encapsulation of the document for validation
9
+ #
10
+ class IsoStsConvert < IsoDoc::XslfoPdfConvert
11
+ def initialize(options)
12
+ @libdir = File.dirname(__FILE__)
13
+ @format = :isosts
14
+ @suffix = "isosts.xml"
15
+ end
16
+
17
+ def convert(input_filename, file = nil, debug = false, output_filename = nil)
18
+ file = File.read(input_filename, encoding: "utf-8") if file.nil?
19
+ docxml, filename, dir = convert_init(file, input_filename, debug)
20
+ /\.xml$/.match(input_filename) or
21
+ input_filename = Tempfile.open([filename, ".xml"], encoding: "utf-8") do |f|
22
+ f.write file
23
+ f.path
24
+ end
25
+ FileUtils.rm_rf dir
26
+ Mn2sts.convert(input_filename, output_filename || "#{filename}.#{@suffix}", iso: true)
27
+ end
28
+ end
29
+ end
30
+ end
31
+
@@ -5,15 +5,13 @@ module IsoDoc
5
5
  class Metadata < IsoDoc::Metadata
6
6
  def initialize(lang, script, i18n)
7
7
  super
8
- @metadata = {
9
- tc: "XXXX",
10
- sc: "XXXX",
11
- wg: "XXXX",
12
- editorialgroup: [],
13
- secretariat: "XXXX",
14
- obsoletes: nil,
15
- obsoletes_part: nil
16
- }
8
+ set(:tc, "XXXX")
9
+ set(:sc, "XXXX")
10
+ set(:wg, "XXXX")
11
+ set(:editorialgroup, [])
12
+ set(:secretariat, "XXX")
13
+ set(:obsoletes, nil)
14
+ set(:obsoletes_part, nil)
17
15
  end
18
16
 
19
17
  def status_abbrev(stage, substage, iter, draft, doctype)
@@ -133,33 +131,35 @@ module IsoDoc
133
131
  end
134
132
 
135
133
  def title(isoxml, _out)
136
- intro, main, part, amd = title_parts(isoxml, "en")
134
+ lang = @lang == "fr" ? "fr" : "en"
135
+ intro, main, part, amd = title_parts(isoxml, lang)
137
136
  partnumber, subpartnumber, amdnumber, corrnumber = title_nums(isoxml)
138
137
 
139
138
  set(:doctitlemain, @c.encode(main ? main.text : "", :hexadecimal))
140
- main = compose_title(main, intro, part, partnumber, subpartnumber, "en")
139
+ main = compose_title(main, intro, part, partnumber, subpartnumber, lang)
141
140
  set(:doctitle, main)
142
141
  set(:doctitleintro, @c.encode(intro ? intro.text : "", :hexadecimal)) if intro
143
- set(:doctitlepartlabel, part_prefix(partnumber, subpartnumber, "en"))
142
+ set(:doctitlepartlabel, part_prefix(partnumber, subpartnumber, lang))
144
143
  set(:doctitlepart, @c.encode(part.text, :hexadecimal)) if part
145
- set(:doctitleamdlabel, amd_prefix(amdnumber, "en")) if amdnumber
144
+ set(:doctitleamdlabel, amd_prefix(amdnumber, lang)) if amdnumber
146
145
  set(:doctitleamd, @c.encode(amd.text, :hexadecimal)) if amd
147
- set(:doctitlecorrlabel, corr_prefix(corrnumber, "en")) if corrnumber
146
+ set(:doctitlecorrlabel, corr_prefix(corrnumber, lang)) if corrnumber
148
147
  end
149
148
 
150
149
  def subtitle(isoxml, _out)
151
- intro, main, part, amd = title_parts(isoxml, "fr")
150
+ lang = @lang == "fr" ? "en" : "fr"
151
+ intro, main, part, amd = title_parts(isoxml, lang)
152
152
  partnumber, subpartnumber, amdnumber, corrnumber = title_nums(isoxml)
153
153
 
154
154
  set(:docsubtitlemain, @c.encode(main ? main.text : "", :hexadecimal))
155
- main = compose_title(main, intro, part, partnumber, subpartnumber, "fr")
155
+ main = compose_title(main, intro, part, partnumber, subpartnumber, lang)
156
156
  set(:docsubtitle, main)
157
157
  set(:docsubtitleintro, @c.encode(intro ? intro.text : "", :hexadecimal)) if intro
158
- set(:docsubtitlepartlabel, part_prefix(partnumber, subpartnumber, "fr"))
158
+ set(:docsubtitlepartlabel, part_prefix(partnumber, subpartnumber, lang))
159
159
  set(:docsubtitlepart, @c.encode(part.text, :hexadecimal)) if part
160
- set(:docsubtitleamdlabel, amd_prefix(amdnumber, "fr")) if amdnumber
160
+ set(:docsubtitleamdlabel, amd_prefix(amdnumber, lang)) if amdnumber
161
161
  set(:docsubtitleamd, @c.encode(amd.text, :hexadecimal)) if amd
162
- set(:docsubtitlecorrlabel, corr_prefix(corrnumber, "fr")) if corrnumber
162
+ set(:docsubtitlecorrlabel, corr_prefix(corrnumber, lang)) if corrnumber
163
163
  end
164
164
 
165
165
  def author(xml, _out)
@@ -5,6 +5,7 @@ require_relative "isodoc/iso/html_convert"
5
5
  require_relative "isodoc/iso/word_convert"
6
6
  require_relative "isodoc/iso/pdf_convert"
7
7
  require_relative "isodoc/iso/sts_convert"
8
+ require_relative "isodoc/iso/isosts_convert"
8
9
  require_relative "isodoc/iso/presentation_xml_convert"
9
10
  require "asciidoctor/extensions"
10
11
 
@@ -26,7 +26,7 @@ module Metanorma
26
26
  doc: "doc",
27
27
  pdf: "pdf",
28
28
  sts: "sts.xml",
29
- isosts: "sts.xml"
29
+ isosts: "iso.sts.xml"
30
30
  )
31
31
  end
32
32
 
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "1.5.6".freeze
3
+ VERSION = "1.5.11".freeze
4
4
  end
5
5
  end
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  spec.add_dependency "ruby-jing"
33
33
  spec.add_dependency "isodoc", "~> 1.2.0"
34
- spec.add_dependency "metanorma-standoc", "~> 1.5.0"
34
+ spec.add_dependency "metanorma-standoc", "~> 1.6.0"
35
35
  spec.add_dependency "tokenizer", "~> 0.3.0"
36
36
  spec.add_dependency "twitter_cldr"
37
37
  spec.add_dependency "mn2sts", "~> 1.5.0"
@@ -183,7 +183,7 @@ OUTPUT
183
183
  :doctype: amendment
184
184
  :updates-document-type: international-standard
185
185
  INPUT
186
- <iso-standard xmlns='https://www.metanorma.org/ns/iso'>
186
+ <iso-standard xmlns='https://www.metanorma.org/ns/iso' type="semantic" version="#{Metanorma::ISO::VERSION}">
187
187
  <bibdata type='standard'>
188
188
  <title language='en' format='text/plain' type='main'>Introduction — Main Title — Title — Title Part — Mass fraction of
189
189
  extraneous matter, milled rice (nonglutinous), sample dividers and
@@ -298,7 +298,7 @@ Author
298
298
  :updates: ISO 17301-1:2030
299
299
  :amendment-number: 1
300
300
  INPUT
301
- <iso-standard xmlns='https://www.metanorma.org/ns/iso'>
301
+ <iso-standard xmlns='https://www.metanorma.org/ns/iso' type="semantic" version="#{Metanorma::ISO::VERSION}">
302
302
  <bibdata type='standard'>
303
303
  <docidentifier type='ISO'>ISO 17301-1:2030/CD Amd 1</docidentifier>
304
304
  <docidentifier type='iso-with-lang'>ISO 17301-1:2030/CD Amd 1(E)</docidentifier>
@@ -366,7 +366,7 @@ Author
366
366
  :updates: ISO 17301-1:2030
367
367
  :amendment-number: 1
368
368
  INPUT
369
- <iso-standard xmlns='https://www.metanorma.org/ns/iso'>
369
+ <iso-standard xmlns='https://www.metanorma.org/ns/iso' type="semantic" version="#{Metanorma::ISO::VERSION}">
370
370
  <bibdata type='standard'>
371
371
  <docidentifier type='ISO'>ISO 17301-1:2030/DAmd 1</docidentifier>
372
372
  <docidentifier type='iso-with-lang'>ISO 17301-1:2030/DAmd 1(E)</docidentifier>
@@ -433,7 +433,7 @@ Author
433
433
  :updates: ISO 17301-1:2030
434
434
  :amendment-number: 1
435
435
  INPUT
436
- <iso-standard xmlns='https://www.metanorma.org/ns/iso'>
436
+ <iso-standard xmlns='https://www.metanorma.org/ns/iso' type="semantic" version="#{Metanorma::ISO::VERSION}">
437
437
  <bibdata type='standard'>
438
438
  <docidentifier type='ISO'>ISO 17301-1:2030/Amd 1</docidentifier>
439
439
  <docidentifier type='iso-with-lang'>ISO 17301-1:2030/Amd 1(E)</docidentifier>
@@ -501,7 +501,7 @@ Author
501
501
  :updates: ISO 17301-1:2030
502
502
  :corrigendum-number: 3
503
503
  INPUT
504
- <iso-standard xmlns='https://www.metanorma.org/ns/iso'>
504
+ <iso-standard xmlns='https://www.metanorma.org/ns/iso' type="semantic" version="#{Metanorma::ISO::VERSION}">
505
505
  <bibdata type='standard'>
506
506
  <docidentifier type='ISO'>ISO 17301-1:2030/CD Cor.3</docidentifier>
507
507
  <docidentifier type='iso-with-lang'>ISO 17301-1:2030/CD Cor.3(E)</docidentifier>
@@ -569,7 +569,7 @@ Author
569
569
  :updates: ISO 17301-1:2030
570
570
  :corrigendum-number: 3
571
571
  INPUT
572
- <iso-standard xmlns='https://www.metanorma.org/ns/iso'>
572
+ <iso-standard xmlns='https://www.metanorma.org/ns/iso' type="semantic" version="#{Metanorma::ISO::VERSION}">
573
573
  <bibdata type='standard'>
574
574
  <docidentifier type='ISO'>ISO 17301-1:2030/FDCor.3</docidentifier>
575
575
  <docidentifier type='iso-with-lang'>ISO 17301-1:2030/FDCor.3(E)</docidentifier>
@@ -636,7 +636,7 @@ Author
636
636
  :updates: ISO 17301-1:2030
637
637
  :corrigendum-number: 3
638
638
  INPUT
639
- <iso-standard xmlns='https://www.metanorma.org/ns/iso'>
639
+ <iso-standard xmlns='https://www.metanorma.org/ns/iso' type="semantic" version="#{Metanorma::ISO::VERSION}">
640
640
  <bibdata type='standard'>
641
641
  <docidentifier type='ISO'>ISO 17301-1:2030/Cor.3</docidentifier>
642
642
  <docidentifier type='iso-with-lang'>ISO 17301-1:2030/Cor.3(E)</docidentifier>
@@ -6,17 +6,6 @@ RSpec.describe Asciidoctor::ISO do
6
6
  expect(Metanorma::ISO::VERSION).not_to be nil
7
7
  end
8
8
 
9
- #it "generates output for the Rice document" do
10
- #FileUtils.rm_f %w(spec/examples/rice.xml spec/examples/rice.doc spec/examples/rice.html spec/examples/rice_alt.html)
11
- #FileUtils.cd "spec/examples"
12
- #Asciidoctor.convert_file "rice.adoc", {:attributes=>{"backend"=>"iso"}, :safe=>0, :header_footer=>true, :requires=>["metanorma-iso"], :failure_level=>4, :mkdirs=>true, :to_file=>nil}
13
- #FileUtils.cd "../.."
14
- #expect(File.exist?("spec/examples/rice.xml"))).to be true
15
- #expect(File.exist?("spec/examples/rice.doc"))).to be true
16
- #expect(File.exist?("spec/examples/rice.html"))).to be true
17
- #expect(File.exist?("spec/examples/rice_alt.html"))).to be true
18
- #end
19
-
20
9
  it "processes a blank document" do
21
10
  expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
22
11
  #{ASCIIDOC_BLANK_HDR}
@@ -29,22 +18,43 @@ RSpec.describe Asciidoctor::ISO do
29
18
 
30
19
  it "converts a blank document" do
31
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"
32
24
  expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
33
25
  = Document title
34
26
  Author
35
27
  :docfile: test.adoc
36
28
  :novalid:
37
29
  :no-isobib:
38
- :no-pdf:
39
30
  INPUT
40
31
  #{BLANK_HDR}
41
32
  <sections/>
42
33
  </iso-standard>
43
34
  OUTPUT
35
+ expect(File.exist?("test_alt.html")).to be true
36
+ expect(File.exist?("test.html")).to be true
44
37
  expect(File.exist?("test.doc")).to be true
38
+ expect(File.exist?("test.pdf")).to be true
45
39
  expect(File.exist?("htmlstyle.css")).to be false
46
40
  end
47
41
 
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")
44
+ = Document title
45
+ Author
46
+ :docfile: test.adoc
47
+ :novalid:
48
+ :no-isobib:
49
+ :no-pdf:
50
+ :language: fr
51
+ INPUT
52
+ #{BLANK_HDR_FR}
53
+ <sections/>
54
+ </iso-standard>
55
+ OUTPUT
56
+ end
57
+
48
58
  it "processes default metadata" do
49
59
  expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
50
60
  = Document title
@@ -91,7 +101,7 @@ RSpec.describe Asciidoctor::ISO do
91
101
  :copyright-year: 2000
92
102
  INPUT
93
103
  <?xml version="1.0" encoding="UTF-8"?>
94
- <iso-standard xmlns="https://www.metanorma.org/ns/iso">
104
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
95
105
  <bibdata type="standard">
96
106
  <title language="en" format="text/plain" type="main">Introduction — Main Title — Title — Title Part</title>
97
107
  <title language="en" format="text/plain" type="title-intro">Introduction</title>
@@ -173,7 +183,7 @@ RSpec.describe Asciidoctor::ISO do
173
183
 
174
184
 
175
185
  it "processes complex metadata" do
176
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~'OUTPUT')
186
+ expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
177
187
  = Document title
178
188
  Author
179
189
  :docfile: test.adoc
@@ -189,9 +199,15 @@ RSpec.describe Asciidoctor::ISO do
189
199
  :copyright-holder: ISO,IETF
190
200
  :copyright-year: 2001
191
201
  :doctype: technical-report
202
+ :pub-address: 1 Infinity Loop + \
203
+ California
204
+ :pub-phone: 3333333
205
+ :pub-fax: 4444444
206
+ :pub-email: x@example.com
207
+ :pub-uri: http://www.example.com
192
208
  INPUT
193
209
  <?xml version="1.0" encoding="UTF-8"?>
194
- <iso-standard xmlns="https://www.metanorma.org/ns/iso">
210
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
195
211
  <bibdata type="standard">
196
212
  <docidentifier type="ISO">ISO/IEC/IETF/TR 1000-1-1:2001</docidentifier>
197
213
  <docidentifier type='iso-with-lang'>ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
@@ -280,6 +296,116 @@ RSpec.describe Asciidoctor::ISO do
280
296
  OUTPUT
281
297
  end
282
298
 
299
+ it "processes subdivisions" do
300
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, "")))).to be_equivalent_to xmlpp(<<~"OUTPUT")
301
+ = Document title
302
+ Author
303
+ :docfile: test.adoc
304
+ :nodoc:
305
+ :novalid:
306
+ :revdate: 2000-01
307
+ :published-date: 1000-01
308
+ :docnumber: 1000
309
+ :partnumber: 1-1
310
+ :tc-docnumber: 2000
311
+ :language: el
312
+ :script: Grek
313
+ :subdivision: Subdivision
314
+ :subdivision-abbr: SD
315
+ :doctype: This is a DocType
316
+ :pub-address: 1 Infinity Loop + \\
317
+ California
318
+ :pub-phone: 3333333
319
+ :pub-fax: 4444444
320
+ :pub-email: x@example.com
321
+ :pub-uri: http://www.example.com
322
+
323
+ INPUT
324
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
325
+ <bibdata type='standard'>
326
+ <docidentifier type='ISO'>SD 1000-1-1</docidentifier>
327
+ <docidentifier type='iso-with-lang'>SD 1000-1-1(X)</docidentifier>
328
+ <docidentifier type='iso-reference'>SD 1000-1-1(X)</docidentifier>
329
+ <docidentifier type='iso-tc'>2000</docidentifier>
330
+ <docnumber>1000</docnumber>
331
+ <date type='published'>
332
+ <on>1000-01</on>
333
+ </date>
334
+ <contributor>
335
+ <role type='author'/>
336
+ <organization>
337
+ <name>International Organization for Standardization</name>
338
+ <subdivision>Subdivision</subdivision>
339
+ <abbreviation>SD</abbreviation>
340
+ <address>
341
+ <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
342
+ </address>
343
+ <phone>3333333</phone>
344
+ <phone type='fax'>4444444</phone>
345
+ <email>x@example.com</email>
346
+ <uri>http://www.example.com</uri>
347
+ </organization>
348
+ </contributor>
349
+ <contributor>
350
+ <role type='publisher'/>
351
+ <organization>
352
+ <name>International Organization for Standardization</name>
353
+ <subdivision>Subdivision</subdivision>
354
+ <abbreviation>SD</abbreviation>
355
+ <address>
356
+ <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
357
+ </address>
358
+ <phone>3333333</phone>
359
+ <phone type='fax'>4444444</phone>
360
+ <email>x@example.com</email>
361
+ <uri>http://www.example.com</uri>
362
+ </organization>
363
+ </contributor>
364
+ <version>
365
+ <revision-date>2000-01</revision-date>
366
+ </version>
367
+ <language>el</language>
368
+ <script>Grek</script>
369
+ <status>
370
+ <stage abbreviation='IS'>60</stage>
371
+ <substage>60</substage>
372
+ </status>
373
+ <copyright>
374
+ <from>2020</from>
375
+ <owner>
376
+ <organization>
377
+ <name>International Organization for Standardization</name>
378
+ <subdivision>Subdivision</subdivision>
379
+ <abbreviation>SD</abbreviation>
380
+ <address>
381
+ <formattedAddress>1 Infinity Loop <br/>California</formattedAddress>
382
+ </address>
383
+ <phone>3333333</phone>
384
+ <phone type='fax'>4444444</phone>
385
+ <email>x@example.com</email>
386
+ <uri>http://www.example.com</uri>
387
+ </organization>
388
+ </owner>
389
+ </copyright>
390
+ <ext>
391
+ <doctype>this-is-a-doctype</doctype>
392
+ <editorialgroup>
393
+ <technical-committee/>
394
+ <subcommittee/>
395
+ <workgroup/>
396
+ </editorialgroup>
397
+ <structuredidentifier>
398
+ <project-number part='1' subpart='1'>SD 1000</project-number>
399
+ </structuredidentifier>
400
+ <stagename>International standard</stagename>
401
+ </ext>
402
+ </bibdata>
403
+ <sections> </sections>
404
+ </iso-standard>
405
+
406
+ OUTPUT
407
+ end
408
+
283
409
  it "defaults substage, defines iteration on stage 50, gives stage 50 on technical specification" do
284
410
  expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
285
411
  = Document title
@@ -294,7 +420,7 @@ RSpec.describe Asciidoctor::ISO do
294
420
  :doctype: technical-specification
295
421
  :iteration: 2
296
422
  INPUT
297
- <iso-standard xmlns="https://www.metanorma.org/ns/iso">
423
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
298
424
  <bibdata type="standard">
299
425
  <docidentifier type="ISO">ISO/DTS 1000.2</docidentifier>
300
426
  <docidentifier type='iso-with-lang'>ISO/DTS 1000.2(F)</docidentifier>
@@ -360,7 +486,7 @@ OUTPUT
360
486
  :docnumber: 1000
361
487
  :docstage: 60
362
488
  INPUT
363
- <iso-standard xmlns="https://www.metanorma.org/ns/iso">
489
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
364
490
  <bibdata type="standard">
365
491
  <docidentifier type="ISO">ISO 1000</docidentifier>
366
492
  <docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
@@ -426,7 +552,7 @@ OUTPUT
426
552
  :docstage: 60
427
553
  :docsubstage: 00
428
554
  INPUT
429
- <iso-standard xmlns="https://www.metanorma.org/ns/iso">
555
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
430
556
  <bibdata type="standard">
431
557
  <docidentifier type="ISO">ISO 1000</docidentifier>
432
558
  <docidentifier type='iso-with-lang'>ISO 1000(E)</docidentifier>
@@ -2,6 +2,26 @@ require "spec_helper"
2
2
  require "fileutils"
3
3
 
4
4
  RSpec.describe Asciidoctor::ISO do
5
+ context "when xref_error.adoc compilation" do
6
+ around do |example|
7
+ FileUtils.rm_f "spec/assets/xref_error.err"
8
+ example.run
9
+ Dir["spec/assets/xref_error*"].each do |file|
10
+ next if file.match?(/adoc$/)
11
+
12
+ FileUtils.rm_f(file)
13
+ end
14
+ end
15
+
16
+ it "generates error file" do
17
+ expect do
18
+ Metanorma::Compile
19
+ .new
20
+ .compile("spec/assets/xref_error.adoc", type: "iso")
21
+ end.to(change { File.exist?("spec/assets/xref_error.err") }
22
+ .from(false).to(true))
23
+ end
24
+ end
5
25
 
6
26
  it "Warns of missing scope" do
7
27
  FileUtils.rm_f "test.err"
@@ -332,7 +352,7 @@ it "warns that undated reference has locality" do
332
352
  FileUtils.rm_f "test.err"
333
353
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
334
354
  #{VALIDATING_BLANK_HDR}
335
-
355
+
336
356
  == Scope
337
357
  <<iso123,clause=1>>
338
358
 
@@ -417,7 +437,7 @@ it "warns that Scope contains subclauses" do
417
437
  #{VALIDATING_BLANK_HDR}
418
438
 
419
439
  == Scope
420
-
440
+
421
441
  === Scope subclause
422
442
  INPUT
423
443
  expect(File.read("test.err")).to include "Scope contains subclauses: should be succinct"
@@ -427,7 +447,7 @@ end
427
447
  it "warns that Table should have title" do
428
448
  FileUtils.rm_f "test.err"
429
449
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
430
- #{VALIDATING_BLANK_HDR}
450
+ #{VALIDATING_BLANK_HDR}
431
451
 
432
452
  |===
433
453
  |a |b |c
@@ -439,7 +459,7 @@ end
439
459
  it "gives Style warning if number not broken up in threes" do
440
460
  FileUtils.rm_f "test.err"
441
461
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
442
- #{VALIDATING_BLANK_HDR}
462
+ #{VALIDATING_BLANK_HDR}
443
463
 
444
464
  == Clause
445
465
  12121
@@ -450,7 +470,7 @@ end
450
470
  it "gives No style warning if number not broken up in threes is ISO reference" do
451
471
  FileUtils.rm_f "test.err"
452
472
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
453
- #{VALIDATING_BLANK_HDR}
473
+ #{VALIDATING_BLANK_HDR}
454
474
 
455
475
  == Clause
456
476
  ISO 12121
@@ -461,7 +481,7 @@ end
461
481
  it "Style warning if decimal point" do
462
482
  FileUtils.rm_f "test.err"
463
483
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
464
- #{VALIDATING_BLANK_HDR}
484
+ #{VALIDATING_BLANK_HDR}
465
485
 
466
486
  == Clause
467
487
  8.1
@@ -472,7 +492,7 @@ end
472
492
  it "Style warning if billion used" do
473
493
  FileUtils.rm_f "test.err"
474
494
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
475
- #{VALIDATING_BLANK_HDR}
495
+ #{VALIDATING_BLANK_HDR}
476
496
 
477
497
  == Clause
478
498
  "Billions" are a term of art.
@@ -483,7 +503,7 @@ end
483
503
  it "Style warning if no space before percent sign" do
484
504
  FileUtils.rm_f "test.err"
485
505
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
486
- #{VALIDATING_BLANK_HDR}
506
+ #{VALIDATING_BLANK_HDR}
487
507
 
488
508
  == Clause
489
509
  95%
@@ -572,7 +592,7 @@ end
572
592
  # it "Style warning if foreword contains subclauses" do
573
593
  # expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{non-standard unit}).to_stderr
574
594
  # #{VALIDATING_BLANK_HDR}
575
- #
595
+ #
576
596
  # INPUT
577
597
  # end
578
598
 
@@ -644,7 +664,7 @@ it "Warning if introduction not followed by scope" do
644
664
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
645
665
  #{VALIDATING_BLANK_HDR}
646
666
 
647
- .Foreword
667
+ .Foreword
648
668
  Foreword
649
669
 
650
670
  == Introduction
@@ -661,7 +681,7 @@ it "Warning if normative references not followed by terms and definitions" do
661
681
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
662
682
  #{VALIDATING_BLANK_HDR}
663
683
 
664
- .Foreword
684
+ .Foreword
665
685
  Foreword
666
686
 
667
687
  == Scope
@@ -681,7 +701,7 @@ it "Warning if there are no clauses in the document" do
681
701
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
682
702
  #{VALIDATING_BLANK_HDR}
683
703
 
684
- .Foreword
704
+ .Foreword
685
705
  Foreword
686
706
 
687
707
  == Scope
@@ -1089,7 +1109,7 @@ it "Warning if term definition starts with article" do
1089
1109
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
1090
1110
  #{VALIDATING_BLANK_HDR}
1091
1111
  == Terms and Definitions
1092
-
1112
+
1093
1113
  === Term
1094
1114
 
1095
1115
  The definition of a term is a part of the specialized vocabulary of a particular field
@@ -1102,7 +1122,7 @@ it "Warning if term definition ends with period" do
1102
1122
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
1103
1123
  #{VALIDATING_BLANK_HDR}
1104
1124
  == Terms and Definitions
1105
-
1125
+
1106
1126
  === Term
1107
1127
 
1108
1128
  Part of the specialized vocabulary of a particular field.
@@ -1202,7 +1222,7 @@ it "Warn if an undated reference has no associated footnote" do
1202
1222
  FileUtils.rm_f "test.err"
1203
1223
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
1204
1224
  #{VALIDATING_BLANK_HDR}
1205
-
1225
+
1206
1226
  [bibliography]
1207
1227
  == Bibliography
1208
1228
  * [[[ISO8,ISO 8:--]]], _Title_