metanorma-iso 1.7.1 → 1.8.1

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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +11 -41
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +6 -2
  5. data/lib/asciidoctor/iso/base.rb +18 -16
  6. data/lib/asciidoctor/iso/biblio.rng +4 -6
  7. data/lib/asciidoctor/iso/cleanup.rb +28 -24
  8. data/lib/asciidoctor/iso/front.rb +26 -16
  9. data/lib/asciidoctor/iso/front_id.rb +30 -25
  10. data/lib/asciidoctor/iso/isodoc.rng +172 -3
  11. data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
  12. data/lib/asciidoctor/iso/isostandard.rng +17 -97
  13. data/lib/asciidoctor/iso/validate.rb +22 -109
  14. data/lib/asciidoctor/iso/validate_image.rb +97 -0
  15. data/lib/asciidoctor/iso/validate_requirements.rb +26 -20
  16. data/lib/asciidoctor/iso/validate_section.rb +39 -20
  17. data/lib/asciidoctor/iso/validate_style.rb +36 -24
  18. data/lib/asciidoctor/iso/validate_title.rb +23 -17
  19. data/lib/isodoc/iso/base_convert.rb +19 -2
  20. data/lib/isodoc/iso/html/style-human.css +7 -0
  21. data/lib/isodoc/iso/html/style-iso.css +7 -0
  22. data/lib/isodoc/iso/html_convert.rb +0 -1
  23. data/lib/isodoc/iso/i18n-en.yaml +4 -0
  24. data/lib/isodoc/iso/i18n-fr.yaml +4 -0
  25. data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
  26. data/lib/isodoc/iso/index.rb +140 -0
  27. data/lib/isodoc/iso/iso.amendment.xsl +1092 -208
  28. data/lib/isodoc/iso/iso.international-standard.xsl +1092 -208
  29. data/lib/isodoc/iso/presentation_xml_convert.rb +45 -37
  30. data/lib/isodoc/iso/word_convert.rb +0 -1
  31. data/lib/isodoc/iso/xref.rb +15 -7
  32. data/lib/metanorma/iso/processor.rb +1 -0
  33. data/lib/metanorma/iso/version.rb +1 -1
  34. data/metanorma-iso.gemspec +8 -8
  35. data/spec/asciidoctor/amd_spec.rb +696 -0
  36. data/spec/asciidoctor/base_spec.rb +733 -0
  37. data/spec/asciidoctor/blocks_spec.rb +527 -0
  38. data/spec/asciidoctor/cleanup_spec.rb +1134 -0
  39. data/spec/asciidoctor/inline_spec.rb +195 -0
  40. data/spec/asciidoctor/lists_spec.rb +197 -0
  41. data/spec/asciidoctor/refs_spec.rb +375 -0
  42. data/spec/asciidoctor/section_spec.rb +393 -0
  43. data/spec/asciidoctor/table_spec.rb +329 -0
  44. data/spec/asciidoctor/validate_spec.rb +1627 -0
  45. data/spec/isodoc/amd_spec.rb +967 -946
  46. data/spec/isodoc/blocks_spec.rb +530 -507
  47. data/spec/isodoc/i18n_spec.rb +953 -911
  48. data/spec/isodoc/inline_spec.rb +355 -293
  49. data/spec/isodoc/iso_spec.rb +338 -314
  50. data/spec/isodoc/metadata_spec.rb +392 -382
  51. data/spec/isodoc/postproc_spec.rb +836 -657
  52. data/spec/isodoc/ref_spec.rb +374 -331
  53. data/spec/isodoc/section_spec.rb +821 -519
  54. data/spec/isodoc/table_spec.rb +472 -411
  55. data/spec/isodoc/terms_spec.rb +209 -185
  56. data/spec/isodoc/xref_spec.rb +1370 -1236
  57. data/spec/metanorma/processor_spec.rb +28 -26
  58. data/spec/spec_helper.rb +178 -193
  59. metadata +65 -66
  60. data/.rubocop.ribose.yml +0 -66
  61. data/lib/isodoc/iso/html/scripts.html +0 -178
  62. data/spec/asciidoctor-iso/amd_spec.rb +0 -694
  63. data/spec/asciidoctor-iso/base_spec.rb +0 -713
  64. data/spec/asciidoctor-iso/blocks_spec.rb +0 -482
  65. data/spec/asciidoctor-iso/cleanup_spec.rb +0 -1025
  66. data/spec/asciidoctor-iso/inline_spec.rb +0 -170
  67. data/spec/asciidoctor-iso/lists_spec.rb +0 -190
  68. data/spec/asciidoctor-iso/refs_spec.rb +0 -317
  69. data/spec/asciidoctor-iso/section_spec.rb +0 -362
  70. data/spec/asciidoctor-iso/table_spec.rb +0 -313
  71. data/spec/asciidoctor-iso/validate_spec.rb +0 -1621
  72. data/spec/assets/xref_error.adoc +0 -7
@@ -1,17 +1,10 @@
1
1
  require_relative "init"
2
2
  require "isodoc"
3
+ require_relative "index"
3
4
 
4
5
  module IsoDoc
5
6
  module Iso
6
-
7
- # A {Converter} implementation that generates HTML output, and a document
8
- # schema encapsulation of the document for validation
9
- #
10
7
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
11
- def initialize(options)
12
- super
13
- end
14
-
15
8
  def convert1(docxml, filename, dir)
16
9
  if amd(docxml)
17
10
  @oldsuppressheadingnumbers = @suppressheadingnumbers
@@ -33,43 +26,57 @@ module IsoDoc
33
26
  @xrefs = Xref.new(lang, script, klass, labels, options)
34
27
  end
35
28
 
36
- def figure1(f)
37
- return if labelled_ancestor(f) && f.ancestors("figure").empty?
38
- lbl = @xrefs.anchor(f['id'], :label, false) or return
39
- figname = f.parent.name == "figure" ? "" : "#{@i18n.figure} "
40
- connective = f.parent.name == "figure" ? "&nbsp; " : "&nbsp;&mdash; "
41
- prefix_name(f, connective, l10n("#{figname}#{lbl}"), "name")
29
+ def figure1(node)
30
+ return if labelled_ancestor(node) && node.ancestors("figure").empty?
31
+
32
+ lbl = @xrefs.anchor(node["id"], :label, false) or return
33
+ figname = node.parent.name == "figure" ? "" : "#{@i18n.figure} "
34
+ connective = node.parent.name == "figure" ? "&nbsp; " : "&nbsp;&mdash; "
35
+ prefix_name(node, connective, l10n("#{figname}#{lbl}"), "name")
42
36
  end
43
37
 
44
- def example1(f)
45
- n = @xrefs.get[f["id"]]
46
- lbl = (n.nil? || n[:label].nil? || n[:label].empty?) ? @i18n.example :
47
- l10n("#{@i18n.example} #{n[:label]}")
48
- prefix_name(f, "&nbsp;&mdash; ", lbl, "name")
38
+ def example1(node)
39
+ n = @xrefs.get[node["id"]]
40
+ lbl = if n.nil? || n[:label].nil? || n[:label].empty?
41
+ @i18n.example
42
+ else
43
+ l10n("#{@i18n.example} #{n[:label]}")
44
+ end
45
+ prefix_name(node, "&nbsp;&mdash; ", lbl, "name")
49
46
  end
50
47
 
51
- def eref_localities1_zh(target, type, from, to, delim)
48
+ def eref_localities1_zh(target, type, from, to, n, delim)
52
49
  subsection = from&.text&.match(/\./)
53
- ret = (delim == ";") ? ";" : (type == "list") ? "" : delim
50
+ ret = if delim == ";"
51
+ ";"
52
+ else
53
+ type == "list" ? "" : delim
54
+ end
54
55
  ret += " 第#{from.text}" if from
55
56
  ret += "&ndash;#{to.text}" if to
56
- loc = (@i18n.locality[type] || type.sub(/^locality:/, "").capitalize )
57
+ loc = (@i18n.locality[type] || type.sub(/^locality:/, "").capitalize)
57
58
  ret += " #{loc}" unless subsection && type == "clause" ||
58
- type == "list" || target.match(/^IEV$|^IEC 60050-/)
59
+ type == "list" || target.match(/^IEV$|^IEC 60050-/) ||
60
+ n["droploc"] == "true"
59
61
  ret += ")" if type == "list"
60
62
  ret
61
63
  end
62
64
 
63
- def eref_localities1(target, type, from, to, delim, lang = "en")
65
+ def eref_localities1(target, type, from, to, delim, n, lang = "en")
64
66
  return "" if type == "anchor"
67
+
65
68
  subsection = from&.text&.match(/\./)
66
69
  type = type.downcase
67
70
  lang == "zh" and
68
- return l10n(eref_localities1_zh(target, type, from, to, delim))
69
- ret = (delim == ";") ? ";" : (type == "list") ? "" : delim
70
- loc = @i18n.locality[type] || type.sub(/^locality:/, "").capitalize
71
- ret += " #{loc}" unless subsection && type == "clause" ||
72
- type == "list" || target.match(/^IEV$|^IEC 60050-/)
71
+ return l10n(eref_localities1_zh(target, type, from, to, n, delim))
72
+ ret = if delim == ";"
73
+ ";"
74
+ else
75
+ type == "list" ? "" : delim
76
+ end
77
+ ret += eref_locality_populate(type, n) unless subsection &&
78
+ type == "clause" || type == "list" ||
79
+ target.match(/^IEV$|^IEC 60050-/)
73
80
  ret += " #{from.text}" if from
74
81
  ret += "&ndash;#{to.text}" if to
75
82
  ret += ")" if type == "list"
@@ -81,17 +88,18 @@ module IsoDoc
81
88
  l10n(@xrefs.anchor(container, :xref) + delim + linkend)
82
89
  end
83
90
 
84
- def example_span_label(node, div, name)
91
+ def example_span_label(_node, div, name)
85
92
  return if name.nil?
86
- div.span **{ class: "example_label" } do |p|
93
+
94
+ div.span **{ class: "example_label" } do |_p|
87
95
  name.children.each { |n| parse(n, div) }
88
96
  end
89
97
  end
90
98
 
91
- def clause1(f)
92
- if !f.at(ns("./title")) &&
93
- !%w(sections preface bibliography).include?(f.parent.name)
94
- f["inline-header"] = "true"
99
+ def clause1(node)
100
+ if !node.at(ns("./title")) &&
101
+ !%w(sections preface bibliography).include?(node.parent.name)
102
+ node["inline-header"] = "true"
95
103
  end
96
104
  super
97
105
  end
@@ -99,8 +107,8 @@ module IsoDoc
99
107
  def clause(docxml)
100
108
  docxml.xpath(ns("//clause[not(ancestor::annex)] | "\
101
109
  "//terms | //definitions | //references | "\
102
- "//preface/introduction[clause]")).
103
- each do |f|
110
+ "//preface/introduction[clause]"))
111
+ .each do |f|
104
112
  clause1(f)
105
113
  end
106
114
  end
@@ -34,7 +34,6 @@ module IsoDoc
34
34
  html_doc_path("style-iso.scss")),
35
35
  htmlcoverpage: html_doc_path("html_iso_titlepage.html"),
36
36
  htmlintropage: html_doc_path("html_iso_intro.html"),
37
- scripts: html_doc_path("scripts.html"),
38
37
  wordstylesheet: html_doc_path("wordstyle.scss"),
39
38
  standardstylesheet: html_doc_path("isodoc.scss"),
40
39
  header: html_doc_path("header.html"),
@@ -56,8 +56,8 @@ module IsoDoc
56
56
  # subclauses are not prefixed with "Clause"
57
57
  i = Counter.new
58
58
  clause.xpath(ns("./clause | ./terms | ./term | ./definitions | "\
59
- "./references")).
60
- each do |c|
59
+ "./references"))
60
+ .each do |c|
61
61
  i.increment(c)
62
62
  section_names1(c, "#{num}.#{i.print}", level + 1)
63
63
  end
@@ -85,6 +85,7 @@ module IsoDoc
85
85
  c = IsoDoc::XrefGen::Counter.new
86
86
  clause.xpath(ns(".//formula")).each do |t|
87
87
  next if t["id"].nil? || t["id"].empty?
88
+
88
89
  @anchors[t["id"]] =
89
90
  anchor_struct("#{num}#{hiersep}#{c.increment(t).print}", t,
90
91
  t["inequality"] ? @labels["inequality"] : @labels["formula"],
@@ -108,6 +109,7 @@ module IsoDoc
108
109
  j = subfigure_increment(j, c, t)
109
110
  sublabel = j.zero? ? nil : "#{(j+96).chr})"
110
111
  next if t["id"].nil? || t["id"].empty?
112
+
111
113
  figure_anchor(t, sublabel, c.print)
112
114
  end
113
115
  end
@@ -115,20 +117,26 @@ module IsoDoc
115
117
  def hierarchical_figure_names(clause, num)
116
118
  c = IsoDoc::XrefGen::Counter.new
117
119
  j = 0
118
- clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
119
- each do |t|
120
+ clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]"))
121
+ .each do |t|
120
122
  j = subfigure_increment(j, c, t)
121
123
  label = "#{num}#{hiersep}#{c.print}"
122
- sublabel = j.zero? ? nil : "#{(j+96).chr})"
124
+ sublabel = j.zero? ? nil : "#{(j + 96).chr})"
123
125
  next if t["id"].nil? || t["id"].empty?
126
+
124
127
  figure_anchor(t, sublabel, label)
125
128
  end
126
129
  end
127
130
 
128
131
  def reference_names(ref)
129
132
  super
130
- @anchors[ref["id"]] = { xref: @anchors[ref["id"]][:xref].
131
- sub(/ \(All Parts\)/i, "") }
133
+ @anchors[ref["id"]] = { xref: @anchors[ref["id"]][:xref]
134
+ .sub(/ \(All Parts\)/i, "") }
135
+ end
136
+
137
+ def back_anchor_names(docxml)
138
+ super
139
+ docxml.xpath(ns("//indexsect")).each { |b| preface_names(b) }
132
140
  end
133
141
  end
134
142
  end
@@ -38,6 +38,7 @@ module Metanorma
38
38
 
39
39
  def use_presentation_xml(ext)
40
40
  return true if ext == :html_alt
41
+
41
42
  super
42
43
  end
43
44
 
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "1.7.1".freeze
3
+ VERSION = "1.8.1".freeze
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
2
 
3
- lib = File.expand_path("../lib", __FILE__)
3
+ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require "metanorma/iso/version"
6
6
 
@@ -29,22 +29,22 @@ Gem::Specification.new do |spec|
29
29
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
30
30
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
31
31
 
32
+ spec.add_dependency "isodoc", "~> 1.6.0"
33
+ spec.add_dependency "metanorma-standoc", "~> 1.9.0"
34
+ spec.add_dependency "mn2sts", "~> 1.5.0"
32
35
  spec.add_dependency "ruby-jing"
33
- spec.add_dependency "isodoc", "~> 1.5.0"
34
- spec.add_dependency "metanorma-standoc", "~> 1.8.0"
35
36
  spec.add_dependency "tokenizer", "~> 0.3.0"
36
37
  spec.add_dependency "twitter_cldr"
37
- spec.add_dependency "mn2sts", "~> 1.5.0"
38
38
 
39
39
  spec.add_development_dependency "byebug"
40
- spec.add_development_dependency "sassc", "2.4.0"
41
40
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
42
41
  spec.add_development_dependency "guard", "~> 2.14"
43
42
  spec.add_development_dependency "guard-rspec", "~> 4.7"
44
- spec.add_development_dependency "rake" #, "~> 12.0"
43
+ spec.add_development_dependency "iev", "~> 0.2.0"
44
+ spec.add_development_dependency "rake", "~> 13.0"
45
45
  spec.add_development_dependency "rspec", "~> 3.6"
46
- spec.add_development_dependency "rubocop", "= 0.54.0"
46
+ spec.add_development_dependency "rubocop", "~> 1.5.2"
47
+ spec.add_development_dependency "sassc", "2.4.0"
47
48
  spec.add_development_dependency "simplecov", "~> 0.15"
48
49
  spec.add_development_dependency "timecop", "~> 0.9"
49
- spec.add_development_dependency "iev", "~> 0.2.0"
50
50
  end
@@ -0,0 +1,696 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Asciidoctor::ISO do
4
+ it "processes amendment sections" do
5
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
+ #{AMD_BLANK_HDR}
7
+ == Foreword
8
+
9
+ Text
10
+
11
+ == Introduction
12
+
13
+ === Introduction Subsection
14
+
15
+ == Scope
16
+
17
+ Text
18
+
19
+ == Acknowledgements
20
+
21
+ == Normative References
22
+
23
+ == Terms and Definitions
24
+
25
+ === Term1
26
+
27
+ == Terms, Definitions, Symbols and Abbreviated Terms
28
+
29
+ === Normal Terms
30
+
31
+ ==== Term2
32
+
33
+ === Symbols and Abbreviated Terms
34
+
35
+ == Symbols and Abbreviated Terms
36
+
37
+ == Clause 4
38
+
39
+ === Introduction
40
+
41
+ === Clause 4.2
42
+
43
+ == Terms and Definitions
44
+
45
+ [appendix]
46
+ == Annex
47
+
48
+ === Annex A.1
49
+
50
+ [%appendix]
51
+ === Appendix 1
52
+
53
+ == Bibliography
54
+
55
+ === Bibliography Subsection
56
+ INPUT
57
+ #{BLANK_HDR.sub(%r{<doctype>article</doctype>}, '<doctype>amendment</doctype>')}
58
+ <sections>
59
+ <clause id="_" obligation="normative">
60
+ <title>Foreword</title>
61
+ <p id="_">Text</p>
62
+ </clause>
63
+ <clause id="_" obligation="normative">
64
+ <title>Introduction</title>
65
+ <clause id="_" obligation="normative">
66
+ <title>Introduction Subsection</title>
67
+ </clause>
68
+ </clause>
69
+ <clause id="_" obligation="normative">
70
+ <title>Scope</title>
71
+ <p id="_">Text</p>
72
+ </clause>
73
+ <clause id="_" obligation="normative">
74
+ <title>Acknowledgements</title>
75
+ </clause>
76
+ <clause id="_" obligation="normative">
77
+ <title>Normative References</title>
78
+ </clause>
79
+ <clause id="_" obligation="normative">
80
+ <title>Terms and Definitions</title>
81
+ <clause id="_" obligation="normative">
82
+ <title>Term1</title>
83
+ </clause>
84
+ </clause>
85
+ <clause id="_" obligation="normative">
86
+ <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
87
+ <clause id="_" obligation="normative">
88
+ <title>Normal Terms</title>
89
+ <clause id="_" obligation="normative">
90
+ <title>Term2</title>
91
+ </clause>
92
+ </clause>
93
+ <clause id="_" obligation="normative">
94
+ <title>Symbols and Abbreviated Terms</title>
95
+ </clause>
96
+ </clause>
97
+ <clause id="_" obligation="normative">
98
+ <title>Symbols and Abbreviated Terms</title>
99
+ </clause>
100
+ <clause id="_" obligation="normative">
101
+ <title>Clause 4</title>
102
+ <clause id="_" obligation="normative">
103
+ <title>Introduction</title>
104
+ </clause>
105
+ <clause id="_" obligation="normative">
106
+ <title>Clause 4.2</title>
107
+ </clause>
108
+ </clause>
109
+ <clause id="_" obligation="normative">
110
+ <title>Terms and Definitions</title>
111
+ </clause>
112
+ <clause id="_" obligation="normative">
113
+ <title>Bibliography</title>
114
+ <clause id="_" obligation="normative">
115
+ <title>Bibliography Subsection</title>
116
+ </clause>
117
+ </clause>
118
+ </sections>
119
+ <annex id='_' obligation='normative'>
120
+ <title>Annex</title>
121
+ <clause id='_' obligation='normative'>
122
+ <title>Annex A.1</title>
123
+ </clause>
124
+ <appendix id='_' obligation='normative'>
125
+ <title>Appendix 1</title>
126
+ </appendix>
127
+ </annex>
128
+ </iso-standard>
129
+ OUTPUT
130
+ end
131
+
132
+ it "processes default metadata, amendment" do
133
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
134
+ = Document title
135
+ Author
136
+ :docfile: test.adoc
137
+ :nodoc:
138
+ :novalid:
139
+ :no-isobib:
140
+ :docnumber: 17301
141
+ :partnumber: 1
142
+ :edition: 2
143
+ :revdate: 2000-01-01
144
+ :draft: 0.3.4
145
+ :technical-committee: TC
146
+ :technical-committee-number: 1
147
+ :technical-committee-type: A
148
+ :subcommittee: SC
149
+ :subcommittee-number: 2
150
+ :subcommittee-type: B
151
+ :workgroup: WG
152
+ :workgroup-number: 3
153
+ :workgroup-type: C
154
+ :technical-committee_2: TC1
155
+ :technical-committee-number_2: 11
156
+ :technical-committee-type_2: A1
157
+ :subcommittee_2: SC1
158
+ :subcommittee-number_2: 21
159
+ :subcommittee-type_2: B1
160
+ :workgroup_2: WG1
161
+ :workgroup-number_2: 31
162
+ :workgroup-type_2: C1
163
+ :secretariat: SECRETARIAT
164
+ :docstage: 10
165
+ :docsubstage: 20
166
+ :iteration: 3
167
+ :language: en
168
+ :title-intro-en: Introduction
169
+ :title-main-en: Main Title -- Title
170
+ :title-part-en: Title Part
171
+ :title-intro-fr: Introduction Française
172
+ :title-main-fr: Titre Principal
173
+ :title-part-fr: Part du Titre
174
+ :library-ics: 1,2,3
175
+ :copyright-year: 2017
176
+ :updates: ISO 17301-1:2016
177
+ :created-date: 2016-05-01
178
+ :amendment-number: 1
179
+ :title-amendment-en: Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions
180
+ :title-amendment-fr: Fraction massique de matière étrangère, riz usiné (non gluant), diviseurs d’échantillon et recommandations relatives aux conditions d’entreposage et de transport
181
+ :doctype: amendment
182
+ :updates-document-type: international-standard
183
+ INPUT
184
+
185
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
186
+ <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
187
+ <bibdata type="standard">
188
+ <title format="text/plain" language="en" type="main">Introduction — Main Title — Title — Title Part — Mass fraction of
189
+ extraneous matter, milled rice (nonglutinous), sample dividers and
190
+ recommendations relating to storage and transport conditions</title>
191
+ <title format="text/plain" language="en" type="title-intro">Introduction</title>
192
+ <title format="text/plain" language="en" type="title-main">Main Title — Title</title>
193
+ <title format="text/plain" language="en" type="title-part">Title Part</title>
194
+ <title format="text/plain" language="en" type="title-amd">Mass fraction of extraneous matter, milled rice (nonglutinous), sample
195
+ dividers and recommendations relating to storage and transport conditions
196
+ </title>
197
+ <title format="text/plain" language="fr" type="main">Introduction Française — Titre Principal — Part du Titre — Fraction
198
+ massique de matière étrangère, riz usiné (non gluant), diviseurs
199
+ d’échantillon et recommandations relatives aux conditions d’entreposage et
200
+ de transport
201
+ </title>
202
+ <title format="text/plain" language="fr" type="title-intro">Introduction Française</title>
203
+ <title format="text/plain" language="fr" type="title-main">Titre Principal</title>
204
+ <title format="text/plain" language="fr" type="title-part">Part du Titre</title>
205
+ <title format="text/plain" language="fr" type="title-amd">Fraction massique de matière étrangère, riz usiné (non gluant), diviseurs
206
+ d’échantillon et recommandations relatives aux conditions d’entreposage et
207
+ de transport
208
+ </title>
209
+ <docidentifier type="ISO">ISO 17301-1:2016/PreNP Amd 1</docidentifier>
210
+ <docidentifier type="iso-with-lang">ISO 17301-1:2016/PreNP Amd 1(E)</docidentifier>
211
+ <docidentifier type="iso-reference">ISO 17301-1:2016/PreNP Amd 1:2017(E)</docidentifier>
212
+ <docnumber>17301</docnumber>
213
+ <date type="created">
214
+ <on>2016-05-01</on>
215
+ </date>
216
+ <contributor>
217
+ <role type="author"/>
218
+ <organization>
219
+ <name>International Organization for Standardization</name>
220
+ <abbreviation>ISO</abbreviation>
221
+ </organization>
222
+ </contributor>
223
+ <contributor>
224
+ <role type="publisher"/>
225
+ <organization>
226
+ <name>International Organization for Standardization</name>
227
+ <abbreviation>ISO</abbreviation>
228
+ </organization>
229
+ </contributor>
230
+ <edition>2</edition>
231
+ <version>
232
+ <revision-date>2000-01-01</revision-date>
233
+ <draft>0.3.4</draft>
234
+ </version>
235
+ <language>en</language>
236
+ <script>Latn</script>
237
+ <status>
238
+ <stage abbreviation="NP Amd">10</stage>
239
+ <substage>20</substage>
240
+ <iteration>3</iteration>
241
+ </status>
242
+ <copyright>
243
+ <from>2017</from>
244
+ <owner>
245
+ <organization>
246
+ <name>International Organization for Standardization</name>
247
+ <abbreviation>ISO</abbreviation>
248
+ </organization>
249
+ </owner>
250
+ </copyright>
251
+ <ext>
252
+ <doctype>amendment</doctype>
253
+ <editorialgroup>
254
+ <technical-committee number="1" type="A">TC</technical-committee>
255
+ <technical-committee number="11" type="A1">TC1</technical-committee>
256
+ <subcommittee number="2" type="B">SC</subcommittee>
257
+ <subcommittee number="21" type="B1">SC1</subcommittee>
258
+ <workgroup number="3" type="C">WG</workgroup>
259
+ <workgroup number="31" type="C1">WG1</workgroup>
260
+ <secretariat>SECRETARIAT</secretariat>
261
+ </editorialgroup>
262
+ <ics>
263
+ <code>1</code>
264
+ </ics>
265
+ <ics>
266
+ <code>2</code>
267
+ </ics>
268
+ <ics>
269
+ <code>3</code>
270
+ </ics>
271
+ <structuredidentifier>
272
+ <project-number amendment="1" origyr="2016-05-01" part="1">17301</project-number>
273
+ </structuredidentifier>
274
+ <stagename>New work item proposal</stagename>
275
+ <updates-document-type>international-standard</updates-document-type>
276
+ </ext>
277
+ </bibdata>
278
+ <sections/>
279
+ </iso-standard>
280
+ OUTPUT
281
+ end
282
+
283
+ it "processes metadata, amendment" do
284
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
285
+ = Document title
286
+ Author
287
+ :docfile: test.adoc
288
+ :nodoc:
289
+ :novalid:
290
+ :no-isobib:
291
+ :docnumber: 17301
292
+ :partnumber: 1
293
+ :doctype: amendment
294
+ :docstage: 30
295
+ :updates: ISO 17301-1:2030
296
+ :amendment-number: 1
297
+ INPUT
298
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
299
+
300
+ <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
301
+ <bibdata type="standard">
302
+ <docidentifier type="ISO">ISO 17301-1:2030/CD Amd 1</docidentifier>
303
+ <docidentifier type="iso-with-lang">ISO 17301-1:2030/CD Amd 1(E)</docidentifier>
304
+ <docidentifier type="iso-reference">ISO 17301-1:2030/CD Amd 1(E)</docidentifier>
305
+ <docnumber>17301</docnumber>
306
+ <contributor>
307
+ <role type="author"/>
308
+ <organization>
309
+ <name>International Organization for Standardization</name>
310
+ <abbreviation>ISO</abbreviation>
311
+ </organization>
312
+ </contributor>
313
+ <contributor>
314
+ <role type="publisher"/>
315
+ <organization>
316
+ <name>International Organization for Standardization</name>
317
+ <abbreviation>ISO</abbreviation>
318
+ </organization>
319
+ </contributor>
320
+ <language>en</language>
321
+ <script>Latn</script>
322
+ <status>
323
+ <stage abbreviation="CD Amd">30</stage>
324
+ <substage>00</substage>
325
+ </status>
326
+ <copyright>
327
+ <from>#{Time.now.year}</from>
328
+ <owner>
329
+ <organization>
330
+ <name>International Organization for Standardization</name>
331
+ <abbreviation>ISO</abbreviation>
332
+ </organization>
333
+ </owner>
334
+ </copyright>
335
+ <ext>
336
+ <doctype>amendment</doctype>
337
+ <editorialgroup>
338
+ <technical-committee/>
339
+ <subcommittee/>
340
+ <workgroup/>
341
+ </editorialgroup>
342
+ <structuredidentifier>
343
+ <project-number amendment="1" part="1">17301</project-number>
344
+ </structuredidentifier>
345
+ <stagename>Committee draft</stagename>
346
+ </ext>
347
+ </bibdata>
348
+ <sections/>
349
+ </iso-standard>
350
+ OUTPUT
351
+ end
352
+
353
+ it "processes metadata, amendment" do
354
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
355
+ = Document title
356
+ Author
357
+ :docfile: test.adoc
358
+ :nodoc:
359
+ :novalid:
360
+ :no-isobib:
361
+ :docnumber: 17301
362
+ :partnumber: 1
363
+ :doctype: amendment
364
+ :docstage: 40
365
+ :updates: ISO 17301-1:2030
366
+ :amendment-number: 1
367
+ INPUT
368
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
369
+ <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
370
+ <bibdata type="standard">
371
+ <docidentifier type="ISO">ISO 17301-1:2030/DAmd 1</docidentifier>
372
+ <docidentifier type="iso-with-lang">ISO 17301-1:2030/DAmd 1(E)</docidentifier>
373
+ <docidentifier type="iso-reference">ISO 17301-1:2030/DAmd 1(E)</docidentifier>
374
+ <docnumber>17301</docnumber>
375
+ <contributor>
376
+ <role type="author"/>
377
+ <organization>
378
+ <name>International Organization for Standardization</name>
379
+ <abbreviation>ISO</abbreviation>
380
+ </organization>
381
+ </contributor>
382
+ <contributor>
383
+ <role type="publisher"/>
384
+ <organization>
385
+ <name>International Organization for Standardization</name>
386
+ <abbreviation>ISO</abbreviation>
387
+ </organization>
388
+ </contributor>
389
+ <language>en</language>
390
+ <script>Latn</script>
391
+ <status>
392
+ <stage abbreviation="DAmd">40</stage>
393
+ <substage>00</substage>
394
+ </status>
395
+ <copyright>
396
+ <from>#{Time.now.year}</from>
397
+ <owner>
398
+ <organization>
399
+ <name>International Organization for Standardization</name>
400
+ <abbreviation>ISO</abbreviation>
401
+ </organization>
402
+ </owner>
403
+ </copyright>
404
+ <ext>
405
+ <doctype>amendment</doctype>
406
+ <editorialgroup>
407
+ <technical-committee/>
408
+ <subcommittee/>
409
+ <workgroup/>
410
+ </editorialgroup>
411
+ <structuredidentifier>
412
+ <project-number amendment="1" part="1">17301</project-number>
413
+ </structuredidentifier>
414
+ <stagename>Draft</stagename>
415
+ </ext>
416
+ </bibdata>
417
+ <sections/>
418
+ </iso-standard>
419
+ OUTPUT
420
+ end
421
+
422
+ it "processes metadata, amendment" do
423
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
424
+ = Document title
425
+ Author
426
+ :docfile: test.adoc
427
+ :nodoc:
428
+ :novalid:
429
+ :no-isobib:
430
+ :docnumber: 17301
431
+ :partnumber: 1
432
+ :doctype: amendment
433
+ :updates: ISO 17301-1:2030
434
+ :amendment-number: 1
435
+ INPUT
436
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
437
+ <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
438
+ <bibdata type="standard">
439
+ <docidentifier type="ISO">ISO 17301-1:2030/Amd 1</docidentifier>
440
+ <docidentifier type="iso-with-lang">ISO 17301-1:2030/Amd 1(E)</docidentifier>
441
+ <docidentifier type="iso-reference">ISO 17301-1:2030/Amd 1(E)</docidentifier>
442
+ <docnumber>17301</docnumber>
443
+ <contributor>
444
+ <role type="author"/>
445
+ <organization>
446
+ <name>International Organization for Standardization</name>
447
+ <abbreviation>ISO</abbreviation>
448
+ </organization>
449
+ </contributor>
450
+ <contributor>
451
+ <role type="publisher"/>
452
+ <organization>
453
+ <name>International Organization for Standardization</name>
454
+ <abbreviation>ISO</abbreviation>
455
+ </organization>
456
+ </contributor>
457
+ <language>en</language>
458
+ <script>Latn</script>
459
+ <status>
460
+ <stage abbreviation="IS">60</stage>
461
+ <substage>60</substage>
462
+ </status>
463
+ <copyright>
464
+ <from>#{Time.now.year}</from>
465
+ <owner>
466
+ <organization>
467
+ <name>International Organization for Standardization</name>
468
+ <abbreviation>ISO</abbreviation>
469
+ </organization>
470
+ </owner>
471
+ </copyright>
472
+ <ext>
473
+ <doctype>amendment</doctype>
474
+ <editorialgroup>
475
+ <technical-committee/>
476
+ <subcommittee/>
477
+ <workgroup/>
478
+ </editorialgroup>
479
+ <structuredidentifier>
480
+ <project-number amendment="1" part="1">17301</project-number>
481
+ </structuredidentifier>
482
+ <stagename>International standard</stagename>
483
+ </ext>
484
+ </bibdata>
485
+ <sections/>
486
+ </iso-standard>
487
+ OUTPUT
488
+ end
489
+
490
+ it "processes metadata, corrigendum" do
491
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
492
+ = Document title
493
+ Author
494
+ :docfile: test.adoc
495
+ :nodoc:
496
+ :novalid:
497
+ :no-isobib:
498
+ :docnumber: 17301
499
+ :partnumber: 1
500
+ :doctype: technical-corrigendum
501
+ :docstage: 30
502
+ :updates: ISO 17301-1:2030
503
+ :corrigendum-number: 3
504
+ INPUT
505
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
506
+ #{' '}
507
+ <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
508
+ <bibdata type="standard">
509
+ <docidentifier type="ISO">ISO 17301-1:2030/CD Cor.3</docidentifier>
510
+ <docidentifier type="iso-with-lang">ISO 17301-1:2030/CD Cor.3(E)</docidentifier>
511
+ <docidentifier type="iso-reference">ISO 17301-1:2030/CD Cor.3(E)</docidentifier>
512
+ <docnumber>17301</docnumber>
513
+ <contributor>
514
+ <role type="author"/>
515
+ <organization>
516
+ <name>International Organization for Standardization</name>
517
+ <abbreviation>ISO</abbreviation>
518
+ </organization>
519
+ </contributor>
520
+ <contributor>
521
+ <role type="publisher"/>
522
+ <organization>
523
+ <name>International Organization for Standardization</name>
524
+ <abbreviation>ISO</abbreviation>
525
+ </organization>
526
+ </contributor>
527
+ <language>en</language>
528
+ <script>Latn</script>
529
+ <status>
530
+ <stage abbreviation="CD Cor">30</stage>
531
+ <substage>00</substage>
532
+ </status>
533
+ <copyright>
534
+ <from>#{Time.now.year}</from>
535
+ <owner>
536
+ <organization>
537
+ <name>International Organization for Standardization</name>
538
+ <abbreviation>ISO</abbreviation>
539
+ </organization>
540
+ </owner>
541
+ </copyright>
542
+ <ext>
543
+ <doctype>technical-corrigendum</doctype>
544
+ <editorialgroup>
545
+ <technical-committee/>
546
+ <subcommittee/>
547
+ <workgroup/>
548
+ </editorialgroup>
549
+ <structuredidentifier>
550
+ <project-number corrigendum="3" part="1">17301</project-number>
551
+ </structuredidentifier>
552
+ <stagename>Committee draft</stagename>
553
+ </ext>
554
+ </bibdata>
555
+ <sections/>
556
+ </iso-standard>
557
+ OUTPUT
558
+ end
559
+
560
+ it "processes metadata, corrigendum" do
561
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
562
+ = Document title
563
+ Author
564
+ :docfile: test.adoc
565
+ :nodoc:
566
+ :novalid:
567
+ :no-isobib:
568
+ :docnumber: 17301
569
+ :partnumber: 1
570
+ :doctype: technical-corrigendum
571
+ :docstage: 50
572
+ :updates: ISO 17301-1:2030
573
+ :corrigendum-number: 3
574
+ INPUT
575
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
576
+ <iso-standard xmlns='https://www.metanorma.org/ns/iso' type="semantic" version="#{Metanorma::ISO::VERSION}">
577
+ <bibdata type='standard'>
578
+ <docidentifier type='ISO'>ISO 17301-1:2030/FDCor.3</docidentifier>
579
+ <docidentifier type='iso-with-lang'>ISO 17301-1:2030/FDCor.3(E)</docidentifier>
580
+ <docidentifier type='iso-reference'>ISO 17301-1:2030/FDCor.3(E)</docidentifier>
581
+ <docnumber>17301</docnumber>
582
+ <contributor>
583
+ <role type='author'/>
584
+ <organization>
585
+ <name>International Organization for Standardization</name>
586
+ <abbreviation>ISO</abbreviation>
587
+ </organization>
588
+ </contributor>
589
+ <contributor>
590
+ <role type='publisher'/>
591
+ <organization>
592
+ <name>International Organization for Standardization</name>
593
+ <abbreviation>ISO</abbreviation>
594
+ </organization>
595
+ </contributor>
596
+ <language>en</language>
597
+ <script>Latn</script>
598
+ <status>
599
+ <stage abbreviation='FDCor'>50</stage>
600
+ <substage>00</substage>
601
+ </status>
602
+ <copyright>
603
+ <from>#{Time.now.year}</from>
604
+ <owner>
605
+ <organization>
606
+ <name>International Organization for Standardization</name>
607
+ <abbreviation>ISO</abbreviation>
608
+ </organization>
609
+ </owner>
610
+ </copyright>
611
+ <ext>
612
+ <doctype>technical-corrigendum</doctype>
613
+ <editorialgroup>
614
+ <technical-committee/>
615
+ <subcommittee/>
616
+ <workgroup/>
617
+ </editorialgroup>
618
+ <structuredidentifier>
619
+ <project-number part='1' corrigendum='3'>17301</project-number>
620
+ </structuredidentifier>
621
+ <stagename>Final draft</stagename>
622
+ </ext>
623
+ </bibdata>
624
+ <sections/>
625
+ </iso-standard>
626
+ OUTPUT
627
+ end
628
+
629
+ it "processes metadata, corrigendum" do
630
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
631
+ = Document title
632
+ Author
633
+ :docfile: test.adoc
634
+ :nodoc:
635
+ :novalid:
636
+ :no-isobib:
637
+ :docnumber: 17301
638
+ :partnumber: 1
639
+ :doctype: technical-corrigendum
640
+ :updates: ISO 17301-1:2030
641
+ :corrigendum-number: 3
642
+ INPUT
643
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
644
+ <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
645
+ <bibdata type="standard">
646
+ <docidentifier type="ISO">ISO 17301-1:2030/Cor.3</docidentifier>
647
+ <docidentifier type="iso-with-lang">ISO 17301-1:2030/Cor.3(E)</docidentifier>
648
+ <docidentifier type="iso-reference">ISO 17301-1:2030/Cor.3(E)</docidentifier>
649
+ <docnumber>17301</docnumber>
650
+ <contributor>
651
+ <role type="author"/>
652
+ <organization>
653
+ <name>International Organization for Standardization</name>
654
+ <abbreviation>ISO</abbreviation>
655
+ </organization>
656
+ </contributor>
657
+ <contributor>
658
+ <role type="publisher"/>
659
+ <organization>
660
+ <name>International Organization for Standardization</name>
661
+ <abbreviation>ISO</abbreviation>
662
+ </organization>
663
+ </contributor>
664
+ <language>en</language>
665
+ <script>Latn</script>
666
+ <status>
667
+ <stage abbreviation="IS">60</stage>
668
+ <substage>60</substage>
669
+ </status>
670
+ <copyright>
671
+ <from>#{Time.now.year}</from>
672
+ <owner>
673
+ <organization>
674
+ <name>International Organization for Standardization</name>
675
+ <abbreviation>ISO</abbreviation>
676
+ </organization>
677
+ </owner>
678
+ </copyright>
679
+ <ext>
680
+ <doctype>technical-corrigendum</doctype>
681
+ <editorialgroup>
682
+ <technical-committee/>
683
+ <subcommittee/>
684
+ <workgroup/>
685
+ </editorialgroup>
686
+ <structuredidentifier>
687
+ <project-number corrigendum="3" part="1">17301</project-number>
688
+ </structuredidentifier>
689
+ <stagename>International standard</stagename>
690
+ </ext>
691
+ </bibdata>
692
+ <sections/>
693
+ </iso-standard>
694
+ OUTPUT
695
+ end
696
+ end