metanorma-iso 1.5.7 → 1.5.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +9 -1
  3. data/.github/workflows/rake.yml +66 -0
  4. data/.github/workflows/ubuntu.yml +8 -0
  5. data/.github/workflows/windows.yml +7 -0
  6. data/README.adoc +5 -6
  7. data/lib/asciidoctor/iso/basicdoc.rng +4 -11
  8. data/lib/asciidoctor/iso/boilerplate-fr.xml +40 -0
  9. data/lib/asciidoctor/iso/boilerplate.xml +1 -0
  10. data/lib/asciidoctor/iso/cleanup.rb +38 -0
  11. data/lib/asciidoctor/iso/front.rb +9 -15
  12. data/lib/asciidoctor/iso/isodoc.rng +27 -50
  13. data/lib/asciidoctor/iso/isostandard.rng +8 -1
  14. data/lib/asciidoctor/iso/validate.rb +1 -1
  15. data/lib/asciidoctor/iso/validate_section.rb +9 -0
  16. data/lib/isodoc/iso/html/header.html +12 -24
  17. data/lib/isodoc/iso/html/style-human.css +5 -1
  18. data/lib/isodoc/iso/html/style-iso.css +5 -1
  19. data/lib/isodoc/iso/i18n-en.yaml +4 -0
  20. data/lib/isodoc/iso/i18n-fr.yaml +5 -0
  21. data/lib/isodoc/iso/i18n-zh-Hans.yaml +5 -0
  22. data/lib/isodoc/iso/i18n.rb +10 -11
  23. data/lib/isodoc/iso/iso.amendment.xsl +732 -138
  24. data/lib/isodoc/iso/iso.international-standard.xsl +732 -138
  25. data/lib/isodoc/iso/metadata.rb +19 -19
  26. data/lib/metanorma-iso.rb +1 -0
  27. data/lib/metanorma/iso/processor.rb +1 -1
  28. data/lib/metanorma/iso/version.rb +1 -1
  29. data/metanorma-iso.gemspec +1 -1
  30. data/spec/asciidoctor-iso/amd_spec.rb +7 -7
  31. data/spec/asciidoctor-iso/base_spec.rb +144 -18
  32. data/spec/asciidoctor-iso/cleanup_spec.rb +4 -4
  33. data/spec/asciidoctor-iso/refs_spec.rb +174 -143
  34. data/spec/asciidoctor-iso/validate_spec.rb +52 -15
  35. data/spec/assets/xref_error.adoc +7 -0
  36. data/spec/isodoc/amd_spec.rb +191 -17
  37. data/spec/isodoc/blocks_spec.rb +2 -1
  38. data/spec/isodoc/i18n_spec.rb +13 -13
  39. data/spec/isodoc/inline_spec.rb +2 -2
  40. data/spec/isodoc/iso_spec.rb +2 -2
  41. data/spec/isodoc/metadata_spec.rb +170 -19
  42. data/spec/isodoc/postproc_spec.rb +3 -3
  43. data/spec/isodoc/ref_spec.rb +5 -5
  44. data/spec/isodoc/section_spec.rb +2 -2
  45. data/spec/isodoc/table_spec.rb +1 -1
  46. data/spec/isodoc/terms_spec.rb +1 -1
  47. data/spec/isodoc/xref_spec.rb +11 -11
  48. data/spec/metanorma/processor_spec.rb +1 -1
  49. data/spec/spec_helper.rb +22 -2
  50. metadata +7 -4
@@ -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.7".freeze
3
+ VERSION = "1.5.12".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>
@@ -430,7 +430,7 @@ RSpec.describe Asciidoctor::ISO do
430
430
  <td valign="top" align="left">c</td>
431
431
  </tr>
432
432
  </tbody>
433
- <dl id="_">
433
+ <dl id="_" key="true">
434
434
  <dt>a</dt>
435
435
  <dd>
436
436
  <p id="_">b</p>
@@ -572,7 +572,7 @@ RSpec.describe Asciidoctor::ISO do
572
572
  #{BLANK_HDR}
573
573
  <sections><formula id="_">
574
574
  <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>F</mi><mi>or</mi><mi>μ</mi><mi>l</mi><mi>a</mi></math></stem>
575
- <dl id="_">
575
+ <dl id="_" key="true">
576
576
  <dt>a</dt>
577
577
  <dd>
578
578
  <p id="_">b</p>
@@ -620,7 +620,7 @@ RSpec.describe Asciidoctor::ISO do
620
620
  #{BLANK_HDR}
621
621
  <sections><figure id="_">
622
622
  <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
623
- <dl id="_">
623
+ <dl id="_" key="true">
624
624
  <dt>a</dt>
625
625
  <dd>
626
626
  <p id="_">b</p>
@@ -678,7 +678,7 @@ RSpec.describe Asciidoctor::ISO do
678
678
  <abbreviation>ISO</abbreviation>
679
679
  </organization>
680
680
  </contributor>
681
- <note format="text/plain" type="ISO DATE">The standard is in press</note>
681
+ <note format="text/plain" type="Unpublished-Status">The standard is in press</note>
682
682
  </bibitem>
683
683
  </references>
684
684
  </bibliography>
@@ -4,38 +4,177 @@ require "relaton_ietf"
4
4
 
5
5
  RSpec.describe Asciidoctor::ISO do
6
6
  it "processes draft ISO reference" do
7
- #stub_fetch_ref no_year: true, note: "The standard is in press"
8
-
7
+ mock_fdis
8
+ #mock_isobib_get_123
9
9
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
10
- #{ASCIIDOC_BLANK_HDR}
10
+ #{ISOBIB_BLANK_HDR}
11
+ == Clause
12
+ <<iso123>>
13
+ <<iso123>>
14
+ A.footnote:[a footnote]
15
+ <<fdis>>
16
+ <<fdis>>
17
+
11
18
  [bibliography]
12
19
  == Normative References
13
20
 
14
21
  * [[[iso123,ISO 123:--]]] footnote:[The standard is in press] _Standard_
22
+ * [[[fdis,ISO/FDIS 17664-1]]] Title
15
23
  INPUT
16
24
  #{BLANK_HDR}
17
- <sections>
18
- </sections><bibliography><references id="_" obligation="informative" normative="true">
19
- <title>Normative references</title>
20
- <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>
21
- <bibitem id="iso123" type="standard">
22
- <title format="text/plain">Standard</title>
23
- <docidentifier>ISO 123:—</docidentifier>
24
- <docnumber>123</docnumber>
25
- <date type="published">
26
- <on>–</on>
27
- </date>
28
- <contributor>
29
- <role type="publisher"/>
30
- <organization>
31
- <name>International Organization for Standardization</name>
32
- <abbreviation>ISO</abbreviation>
33
- </organization>
34
- </contributor>
35
- <note format="text/plain" type="ISO DATE">The standard is in press</note>
36
- </bibitem>
37
- </references>
38
- </bibliography>
25
+ <sections>
26
+ <clause id='_' inline-header='false' obligation='normative'>
27
+ <title>Clause</title>
28
+ <p id='_'>
29
+ <eref type='inline' bibitemid='iso123' citeas='ISO 123:--'/>
30
+ <fn reference='1'>The standard is in press</fn>
31
+ <eref type='inline' bibitemid='iso123' citeas='ISO 123:--'/>
32
+ A.
33
+ <fn reference='2'>
34
+ <p id='_'>a footnote</p>
35
+ </fn>
36
+ <eref type='inline' bibitemid='fdis' citeas='ISO/FDIS 17664-1'/>
37
+ <fn reference='3'>
38
+ <p id='_'>Under preparation. (Stage at the time of publication ISO/FDIS 17664-1).</p>
39
+ </fn>
40
+ <eref type='inline' bibitemid='fdis' citeas='ISO/FDIS 17664-1'/>
41
+ </p>
42
+ </clause>
43
+ </sections>
44
+ <bibliography>
45
+ <references id='_' normative='true' obligation='informative'>
46
+ <title>Normative references</title>
47
+ <p id='_'>
48
+ The following documents are referred to in the text in such a way that
49
+ some or all of their content constitutes requirements of this document.
50
+ For dated references, only the edition cited applies. For undated
51
+ references, the latest edition of the referenced document (including any
52
+ amendments) applies.
53
+ </p>
54
+ <bibitem id='iso123' type='standard'>
55
+ <title format='text/plain'>Standard</title>
56
+ <docidentifier type='ISO'>ISO 123:—</docidentifier>
57
+ <docnumber>123</docnumber>
58
+ <date type='published'>
59
+ <on>–</on>
60
+ </date>
61
+ <contributor>
62
+ <role type='publisher'/>
63
+ <organization>
64
+ <name>International Organization for Standardization</name>
65
+ <abbreviation>ISO</abbreviation>
66
+ </organization>
67
+ </contributor>
68
+ <note format='text/plain' type='Unpublished-Status'>The standard is in press</note>
69
+ </bibitem>
70
+ <bibitem id='fdis' type='standard'>
71
+ <fetched>2020-11-09</fetched>
72
+ <title type='title-intro' format='text/plain' language='fr' script='Latn'>Traitement de produits de soins de santé</title>
73
+ <title type='title-main' format='text/plain' language='fr' script='Latn'>
74
+ Informations relatives au traitement des dispositifs médicaux à
75
+ fournir par le fabricant du dispositif
76
+ </title>
77
+ <title type='title-part' format='text/plain' language='fr' script='Latn'>Partie 1: Titre manque</title>
78
+ <title type='main' format='text/plain' language='fr' script='Latn'>
79
+ Traitement de produits de soins de santé — Informations relatives au
80
+ traitement des dispositifs médicaux à fournir par le fabricant du
81
+ dispositif — Partie 1: Titre manque
82
+ </title>
83
+ <uri type='src'>https://www.iso.org/standard/81720.html</uri>
84
+ <uri type='rss'>https://www.iso.org/contents/data/standard/08/17/81720.detail.rss</uri>
85
+ <docidentifier type='ISO'>ISO/FDIS 17664-1</docidentifier>
86
+ <docidentifier type='URN'>urn:iso:std:iso-fdis:17664:-1:stage-50.00:ed-1:fr</docidentifier>
87
+ <docnumber>17664</docnumber>
88
+ <contributor>
89
+ <role type='publisher'/>
90
+ <organization>
91
+ <name>International Organization for Standardization</name>
92
+ <abbreviation>ISO</abbreviation>
93
+ <uri>www.iso.org</uri>
94
+ </organization>
95
+ </contributor>
96
+ <edition>1</edition>
97
+ <note type='Unpublished-Status'>
98
+ <p id='_'>Under preparation. (Stage at the time of publication ISO/FDIS 17664-1).</p>
99
+ </note>
100
+ <language>en</language>
101
+ <language>fr</language>
102
+ <script>Latn</script>
103
+ <status>
104
+ <stage>50</stage>
105
+ <substage>00</substage>
106
+ </status>
107
+ <copyright>
108
+ <from>unknown</from>
109
+ <owner>
110
+ <organization>
111
+ <name>ISO/FDIS</name>
112
+ </organization>
113
+ </owner>
114
+ </copyright>
115
+ <relation type='obsoletes'>
116
+ <bibitem type='standard'>
117
+ <formattedref format='text/plain'>ISO 17664:2017</formattedref>
118
+ </bibitem>
119
+ </relation>
120
+ <relation type='instance'>
121
+ <bibitem type='standard'>
122
+ <fetched>2020-11-03</fetched>
123
+ <title type='title-intro' format='text/plain' language='fr' script='Latn'>Traitement de produits de soins de santé</title>
124
+ <title type='title-main' format='text/plain' language='fr' script='Latn'>
125
+ Informations relatives au traitement des dispositifs médicaux à
126
+ fournir par le fabricant du dispositif
127
+ </title>
128
+ <title type='title-part' format='text/plain' language='fr' script='Latn'>Partie 1: Titre manque</title>
129
+ <title type='main' format='text/plain' language='fr' script='Latn'>
130
+ Traitement de produits de soins de santé — Informations relatives
131
+ au traitement des dispositifs médicaux à fournir par le fabricant
132
+ du dispositif — Partie 1: Titre manque
133
+ </title>
134
+ <uri type='src'>https://www.iso.org/standard/81720.html</uri>
135
+ <uri type='rss'>https://www.iso.org/contents/data/standard/08/17/81720.detail.rss</uri>
136
+ <docidentifier type='ISO'>ISO/FDIS 17664-1</docidentifier>
137
+ <docidentifier type='URN'>urn:iso:std:iso-fdis:17664:-1:stage-50.00:ed-1:fr</docidentifier>
138
+ <docnumber>17664</docnumber>
139
+ <contributor>
140
+ <role type='publisher'/>
141
+ <organization>
142
+ <name>International Organization for Standardization</name>
143
+ <abbreviation>ISO</abbreviation>
144
+ <uri>www.iso.org</uri>
145
+ </organization>
146
+ </contributor>
147
+ <edition>1</edition>
148
+ <note type='Unpublished-Status'>
149
+ <p id='_'>Under preparation. (Stage at the time of publication ISO/FDIS 17664-1).</p>
150
+ </note>
151
+ <language>en</language>
152
+ <language>fr</language>
153
+ <script>Latn</script>
154
+ <status>
155
+ <stage>50</stage>
156
+ <substage>00</substage>
157
+ </status>
158
+ <copyright>
159
+ <from>unknown</from>
160
+ <owner>
161
+ <organization>
162
+ <name>ISO/FDIS</name>
163
+ </organization>
164
+ </owner>
165
+ </copyright>
166
+ <relation type='obsoletes'>
167
+ <bibitem type='standard'>
168
+ <formattedref format='text/plain'>ISO 17664:2017</formattedref>
169
+ </bibitem>
170
+ </relation>
171
+ <place>Geneva</place>
172
+ </bibitem>
173
+ </relation>
174
+ <place>Geneva</place>
175
+ </bibitem>
176
+ </references>
177
+ </bibliography>
39
178
  </iso-standard>
40
179
  OUTPUT
41
180
  end
@@ -141,132 +280,16 @@ RSpec.describe Asciidoctor::ISO do
141
280
  OUTPUT
142
281
  end
143
282
 
144
- private
145
-
146
283
  private
147
284
 
148
285
  def mock_isobib_get_123
149
- expect(Isobib::IsoBibliography).to receive(:get).with("ISO 123", nil, {}) do
150
- IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
286
+ expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 123", nil, {:lang=>"en", :title=>"Title", :usrlbl=>nil}) do
287
+ RelatonIsoBib::XMLParser.from_xml(<<~"OUTPUT")
151
288
  <bibitem type=\"international-standard\" id=\"ISO123\">\n <fetched>#{Date.today}</fetched>\n<title format=\"text/plain\" language=\"en\" script=\"Latn\">Rubber latex -- Sampling</title>\n <title format=\"text/plain\" language=\"fr\" script=\"Latn\">Latex de caoutchouc -- ?chantillonnage</title>\n <uri type=\"src\">https://www.iso.org/standard/23281.html</uri>\n <uri type=\"obp\">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>\n <uri type=\"rss\">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>\n <docidentifier type="ISO">ISO 123:2001</docidentifier>\n <date type=\"published\">\n <on>2001</on>\n </date>\n <contributor>\n <role type=\"publisher\"/>\n <organization>\n <name>International Organization for Standardization</name>\n <abbreviation>ISO</abbreviation>\n <uri>www.iso.org</uri>\n </organization>\n </contributor>\n <edition>3</edition>\n <language>en</language>\n <language>fr</language>\n <script>Latn</script>\n <status>Published</status>\n <copyright>\n <from>2001</from>\n <owner>\n <organization>\n <name>ISO</name>\n <abbreviation></abbreviation>\n </organization>\n </owner>\n </copyright>\n <relation type=\"obsoletes\">\n <bibitem>\n <formattedref>ISO 123:1985</formattedref>\n </bibitem>\n </relation>\n <relation type=\"updates\">\n <bibitem>\n <formattedref>ISO 123:2001</formattedref>\n </bibitem>\n </relation>\n</bibitem>
152
289
  OUTPUT
153
290
  end
154
291
  end
155
292
 
156
- def mock_isobib_get_124
157
- expect(Isobib::IsoBibliography).to receive(:get).with("ISO 124", "2014", {}) do
158
- IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
159
- <bibitem type="international-standard" id="iso124">
160
- <fetched>#{Date.today}</fetched>
161
- <title format="text/plain" language="en" script="Latn">Latex, rubber -- Determination of total solids content</title>
162
- <title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- Détermination des matières solides totales</title>
163
- <uri type="src">https://www.iso.org/standard/61884.html</uri>
164
- <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</uri>
165
- <uri type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri>
166
- <docidentifier type="ISO">ISO 124:2014</docidentifier>
167
- <date type="published">
168
- <on>2014</on>
169
- </date>
170
- <contributor>
171
- <role type="publisher"/>
172
- <organization>
173
- <name>International Organization for Standardization</name>
174
- <abbreviation>ISO</abbreviation>
175
- <uri>www.iso.org</uri>
176
- </organization>
177
- </contributor>
178
- <edition>7</edition>
179
- <language>en</language>
180
- <language>fr</language>
181
- <script>Latn</script>
182
- <abstract format="plain" language="en" script="Latn">ISO 124:2014 specifies methods for the determination of the total solids content of natural rubber field and concentrated latices and synthetic rubber latex. These methods are not necessarily suitable for latex from natural sources other than the Hevea brasiliensis, for vulcanized latex, for compounded latex, or for artificial dispersions of rubber.</abstract>
183
- <status>Published</status>
184
- <copyright>
185
- <from>2014</from>
186
- <owner>
187
- <organization>
188
- <name>ISO</name>
189
- <abbreviation/>
190
- </organization>
191
- </owner>
192
- </copyright>
193
- <relation type="obsoletes">
194
- <bibitem>
195
- <formattedref>ISO 124:2011</formattedref>
196
- </bibitem>
197
- </relation>
198
- <ics>
199
- <code>83.040.10</code>
200
- <text>Latex and raw rubber</text>
201
- </ics>
202
- </bibitem>
203
- OUTPUT
204
- end
205
- end
206
-
207
- def mock_isobib_get_iec12382
208
- expect(Isobib::IsoBibliography).to receive(:get).with("ISO/IEC TR 12382", "1992", {}) do
209
- IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
210
- <bibitem type="international-standard" id="iso123">
211
- <fetched>#{Date.today}</fetched>
212
- <title format="text/plain" language="en" script="Latn">Permuted index of the vocabulary of information technology</title>
213
- <title format="text/plain" language="fr" script="Latn">Index permuté du vocabulaire des technologies de l'information</title>
214
- <uri type="src">https://www.iso.org/standard/21071.html</uri>
215
- <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:21071:en</uri>
216
- <uri type="rss">https://www.iso.org/contents/data/standard/02/10/21071.detail.rss</uri>
217
- <docidentifier type="ISO">ISO/IEC 12382:1992</docidentifier>
218
- <date type="published">
219
- <on>1992</on>
220
- </date>
221
- <contributor>
222
- <role type="publisher"/>
223
- <organization>
224
- <name>International Organization for Standardization</name>
225
- <abbreviation>ISO</abbreviation>
226
- <uri>www.iso.org</uri>
227
- </organization>
228
- </contributor>
229
- <contributor>
230
- <role type="publisher"/>
231
- <organization>
232
- <name>International Electrotechnical Commission</name>
233
- <abbreviation>IEC</abbreviation>
234
- <uri>www.iec.ch</uri>
235
- </organization>
236
- </contributor>
237
- <edition>2</edition>
238
- <language>en</language>
239
- <language>fr</language>
240
- <script>Latn</script>
241
- <abstract format="plain" language="en" script="Latn">Contains a permuted index of all terms included in the parts 1 - 28 of ISO 2382. If any of these parts has been revised, the present TR refers to the revision.</abstract>
242
- <status>Published</status>
243
- <copyright>
244
- <from>1992</from>
245
- <owner>
246
- <organization>
247
- <name>ISO/IEC</name>
248
- <abbreviation/>
249
- </organization>
250
- </owner>
251
- </copyright>
252
- <relation type="updates">
253
- <bibitem>
254
- <formattedref>ISO/IEC TR 12382:1992</formattedref>
255
- </bibitem>
256
- </relation>
257
- <ics>
258
- <code>35.020</code>
259
- <text>Information technology (IT) in general</text>
260
- </ics>
261
- <ics>
262
- <code>01.040.35</code>
263
- <text>Information technology (Vocabularies)</text>
264
- </ics>
265
- </bibitem>
266
- OUTPUT
267
- end
268
- end
269
-
270
293
  def mock_rfcbib_get_rfc8341
271
294
  expect(IETFBib::RfcBibliography).to receive(:get).with("RFC 8341", nil, {}) do
272
295
  IETFBib::XMLParser.from_xml(<<~"OUTPUT")
@@ -283,4 +306,12 @@ OUTPUT
283
306
  end
284
307
  end
285
308
 
309
+ def mock_fdis
310
+ expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO/FDIS 17664-1", nil, {:lang=>"en", :title=>"Title", :usrlbl=>nil}) do
311
+ RelatonIsoBib::XMLParser.from_xml(<<~"OUTPUT")
312
+ <bibitem id="x" type="standard"> <fetched>#{Date.today}</fetched> <title type="title-intro" format="text/plain" language="fr" script="Latn">Traitement de produits de soins de santé</title> <title type="title-main" format="text/plain" language="fr" script="Latn">Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif</title> <title type="title-part" format="text/plain" language="fr" script="Latn">Partie 1: Titre manque</title> <title type="main" format="text/plain" language="fr" script="Latn">Traitement de produits de soins de santé — Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif — Partie 1: Titre manque</title> <uri type="src">https://www.iso.org/standard/81720.html</uri> <uri type="rss">https://www.iso.org/contents/data/standard/08/17/81720.detail.rss</uri> <docidentifier type="ISO">ISO/FDIS 17664-1</docidentifier> <docidentifier type="URN">urn:iso:std:iso-fdis:17664:-1:stage-50.00:ed-1:fr</docidentifier> <docnumber>17664</docnumber> <contributor> <role type="publisher"/> <organization> <name>International Organization for Standardization</name> <abbreviation>ISO</abbreviation> <uri>www.iso.org</uri> </organization> </contributor> <edition>1</edition> <language>en</language> <language>fr</language> <script>Latn</script> <status> <stage>50</stage> <substage>00</substage> </status> <copyright> <from>unknown</from> <owner> <organization> <name>ISO/FDIS</name> </organization> </owner> </copyright> <relation type="obsoletes"> <bibitem type="standard"> <formattedref format="text/plain">ISO 17664:2017</formattedref> </bibitem> </relation> <relation type="instance"> <bibitem type="standard"> <fetched>2020-11-03</fetched> <title type="title-intro" format="text/plain" language="fr" script="Latn">Traitement de produits de soins de santé</title> <title type="title-main" format="text/plain" language="fr" script="Latn">Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif</title> <title type="title-part" format="text/plain" language="fr" script="Latn">Partie 1: Titre manque</title> <title type="main" format="text/plain" language="fr" script="Latn">Traitement de produits de soins de santé — Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif — Partie 1: Titre manque</title> <uri type="src">https://www.iso.org/standard/81720.html</uri> <uri type="rss">https://www.iso.org/contents/data/standard/08/17/81720.detail.rss</uri> <docidentifier type="ISO">ISO/FDIS 17664-1</docidentifier> <docidentifier type="URN">urn:iso:std:iso-fdis:17664:-1:stage-50.00:ed-1:fr</docidentifier> <docnumber>17664</docnumber> <contributor> <role type="publisher"/> <organization> <name>International Organization for Standardization</name> <abbreviation>ISO</abbreviation> <uri>www.iso.org</uri> </organization> </contributor> <edition>1</edition> <language>en</language> <language>fr</language> <script>Latn</script> <status> <stage>50</stage> <substage>00</substage> </status> <copyright> <from>unknown</from> <owner> <organization> <name>ISO/FDIS</name> </organization> </owner> </copyright> <relation type="obsoletes"> <bibitem type="standard"> <formattedref format="text/plain">ISO 17664:2017</formattedref> </bibitem> </relation> <place>Geneva</place> </bibitem> </relation> <place>Geneva</place></bibitem>
313
+ OUTPUT
314
+ end
315
+ end
316
+
286
317
  end