metanorma-iso 1.3.21 → 1.3.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +8 -7
- data/.github/workflows/ubuntu.yml +8 -7
- data/.github/workflows/windows.yml +8 -8
- data/Gemfile +2 -0
- data/lib/asciidoctor/iso/base.rb +22 -0
- data/lib/asciidoctor/iso/biblio.rng +142 -37
- data/lib/asciidoctor/iso/cleanup.rb +19 -2
- data/lib/asciidoctor/iso/front.rb +19 -72
- data/lib/asciidoctor/iso/front_id.rb +196 -0
- data/lib/asciidoctor/iso/isodoc.rng +48 -2
- data/lib/asciidoctor/iso/isostandard-amd.rng +98 -0
- data/lib/asciidoctor/iso/isostandard.rng +17 -1
- data/lib/asciidoctor/iso/macros.rb +21 -0
- data/lib/asciidoctor/iso/section.rb +18 -32
- data/lib/asciidoctor/iso/term_lookup_cleanup.rb +87 -0
- data/lib/asciidoctor/iso/validate.rb +41 -21
- data/lib/asciidoctor/iso/validate_requirements.rb +1 -1
- data/lib/asciidoctor/iso/validate_section.rb +2 -2
- data/lib/asciidoctor/iso/validate_style.rb +7 -6
- data/lib/isodoc/iso/base_convert.rb +48 -64
- data/lib/isodoc/iso/html/header.html +10 -6
- data/lib/isodoc/iso/html/html_iso_titlepage.html +27 -18
- data/lib/isodoc/iso/html/isodoc.scss +49 -28
- data/lib/isodoc/iso/html/scripts.html +23 -21
- data/lib/isodoc/iso/html/style-human.scss +25 -2
- data/lib/isodoc/iso/html/style-iso.scss +20 -2
- data/lib/isodoc/iso/html/word_iso_titlepage.html +23 -2
- data/lib/isodoc/iso/html/wordstyle.scss +80 -39
- data/lib/isodoc/iso/html_convert.rb +7 -9
- data/lib/isodoc/iso/iso.amendment.xsl +4597 -0
- data/lib/isodoc/iso/iso.international-standard.xsl +4597 -0
- data/lib/isodoc/iso/metadata.rb +74 -44
- data/lib/isodoc/iso/pdf_convert.rb +39 -0
- data/lib/isodoc/iso/sections.rb +66 -0
- data/lib/isodoc/iso/sts_convert.rb +29 -0
- data/lib/metanorma-iso.rb +2 -0
- data/lib/metanorma/iso/processor.rb +16 -1
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +4 -1
- data/spec/asciidoctor-iso/amd_spec.rb +726 -0
- data/spec/asciidoctor-iso/base_spec.rb +43 -21
- data/spec/asciidoctor-iso/blocks_spec.rb +21 -9
- data/spec/asciidoctor-iso/cleanup_spec.rb +203 -175
- data/spec/asciidoctor-iso/inline_spec.rb +2 -1
- data/spec/asciidoctor-iso/macros_spec.rb +275 -0
- data/spec/asciidoctor-iso/refs_spec.rb +7 -4
- data/spec/asciidoctor-iso/section_spec.rb +8 -8
- data/spec/assets/iso.xml +64 -1
- data/spec/isodoc/amd_spec.rb +606 -0
- data/spec/isodoc/i18n_spec.rb +12 -20
- data/spec/isodoc/inline_spec.rb +2 -2
- data/spec/isodoc/iso_spec.rb +1 -1
- data/spec/isodoc/metadata_spec.rb +12 -4
- data/spec/isodoc/postproc_spec.rb +20 -119
- data/spec/isodoc/ref_spec.rb +5 -5
- data/spec/isodoc/section_spec.rb +36 -13
- data/spec/isodoc/table_spec.rb +22 -22
- data/spec/isodoc/terms_spec.rb +2 -2
- data/spec/isodoc/xref_spec.rb +19 -19
- data/spec/metanorma/processor_spec.rb +2 -2
- data/spec/spec_helper.rb +13 -1
- metadata +57 -5
- data/asciidoctor-iso.gemspec.old +0 -50
data/lib/isodoc/iso/metadata.rb
CHANGED
@@ -6,37 +6,25 @@ module IsoDoc
|
|
6
6
|
def initialize(lang, script, labels)
|
7
7
|
super
|
8
8
|
@metadata = {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
|
20
|
-
"00": "PWI",
|
21
|
-
"10": "NWIP",
|
22
|
-
"20": "WD",
|
23
|
-
"30": "CD",
|
24
|
-
"40": "DIS",
|
25
|
-
"50": "FDIS",
|
26
|
-
"60": "IS",
|
27
|
-
"90": "(Review)",
|
28
|
-
"95": "(Withdrawal)",
|
29
|
-
}.freeze
|
30
|
-
|
31
|
-
def stage_abbr(stage)
|
32
|
-
self.class::STAGE_ABBRS[stage.to_sym] || "??"
|
33
|
-
end
|
34
|
-
|
35
|
-
def status_abbrev(stage, substage, iter, draft)
|
9
|
+
tc: "XXXX",
|
10
|
+
sc: "XXXX",
|
11
|
+
wg: "XXXX",
|
12
|
+
editorialgroup: [],
|
13
|
+
secretariat: "XXXX",
|
14
|
+
obsoletes: nil,
|
15
|
+
obsoletes_part: nil
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def status_abbrev(stage, substage, iter, draft, doctype)
|
36
20
|
return "" unless stage
|
37
|
-
|
38
|
-
|
39
|
-
|
21
|
+
if %w(technical-report technical-specification).include?(doctype)
|
22
|
+
stage = "DTS" if stage == "DIS"
|
23
|
+
stage = "FDTS" if stage == "FDIS"
|
24
|
+
end
|
25
|
+
if %w(PWI NWIP WD CD).include?(stage)
|
26
|
+
stage += iter if iter
|
27
|
+
end
|
40
28
|
stage = "Pre" + stage if draft =~ /^0\./
|
41
29
|
stage
|
42
30
|
end
|
@@ -48,12 +36,13 @@ module IsoDoc
|
|
48
36
|
set(:stage, docstatus.text)
|
49
37
|
set(:stage_int, docstatus.text.to_i)
|
50
38
|
set(:unpublished, unpublished(docstatus.text))
|
51
|
-
set(:statusabbr, status_abbrev(docstatus
|
39
|
+
set(:statusabbr, status_abbrev(docstatus["abbreviation"] || "??",
|
52
40
|
isoxml&.at(ns("//bibdata/status/substage"))&.text,
|
53
41
|
isoxml&.at(ns("//bibdata/status/iteration"))&.text,
|
54
|
-
isoxml&.at(ns("//version/draft"))&.text
|
42
|
+
isoxml&.at(ns("//version/draft"))&.text,
|
43
|
+
isoxml&.at(ns("//bibdata/ext/doctype"))&.text))
|
55
44
|
unpublished(docstatus.text) and
|
56
|
-
set(:stageabbr,
|
45
|
+
set(:stageabbr, docstatus["abbreviation"])
|
57
46
|
end
|
58
47
|
revdate = isoxml.at(ns("//version/revision-date"))
|
59
48
|
set(:revdate, revdate&.text)
|
@@ -68,6 +57,10 @@ module IsoDoc
|
|
68
57
|
set(:docnumber, dn&.text)
|
69
58
|
tcdn = isoxml.xpath(ns("//bibdata/docidentifier[@type = 'iso-tc']"))
|
70
59
|
set(:tc_docnumber, tcdn.map { |n| n.text })
|
60
|
+
dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'iso-with-lang']"))
|
61
|
+
set(:docnumber_lang, dn&.text)
|
62
|
+
dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'iso-reference']"))
|
63
|
+
set(:docnumber_reference, dn&.text)
|
71
64
|
end
|
72
65
|
|
73
66
|
# we don't leave this to i18n.rb, because we have both English and
|
@@ -79,6 +72,20 @@ module IsoDoc
|
|
79
72
|
end
|
80
73
|
end
|
81
74
|
|
75
|
+
def amd_label(lang)
|
76
|
+
case lang
|
77
|
+
when "en" then "AMENDMENT"
|
78
|
+
when "fr" then "AMENDMENT"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def corr_label(lang)
|
83
|
+
case lang
|
84
|
+
when "en" then "TECHNICAL CORRIGENDUM"
|
85
|
+
when "fr" then "RECTIFICATIF TECHNIQUE"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
82
89
|
def part_title(part, partnum, subpartnum, lang)
|
83
90
|
return "" unless part
|
84
91
|
suffix = @c.encode(part.text, :hexadecimal)
|
@@ -92,6 +99,14 @@ module IsoDoc
|
|
92
99
|
"#{part_label(lang)} #{partnum}"
|
93
100
|
end
|
94
101
|
|
102
|
+
def amd_prefix(num, lang)
|
103
|
+
"#{amd_label(lang)} #{num}"
|
104
|
+
end
|
105
|
+
|
106
|
+
def corr_prefix(num, lang)
|
107
|
+
"#{corr_label(lang)} #{num}"
|
108
|
+
end
|
109
|
+
|
95
110
|
def compose_title(main, intro, part, partnum, subpartnum, lang)
|
96
111
|
main = main.nil? ? "" : @c.encode(main.text, :hexadecimal)
|
97
112
|
intro &&
|
@@ -103,12 +118,23 @@ module IsoDoc
|
|
103
118
|
main
|
104
119
|
end
|
105
120
|
|
121
|
+
def title_nums(isoxml)
|
122
|
+
[isoxml.at(ns("//bibdata//project-number/@part")),
|
123
|
+
isoxml.at(ns("//bibdata//project-number/@subpart")),
|
124
|
+
isoxml.at(ns("//bibdata//project-number/@amendment")),
|
125
|
+
isoxml.at(ns("//bibdata//project-number/@corrigendum"))]
|
126
|
+
end
|
127
|
+
|
128
|
+
def title_parts(isoxml, lang)
|
129
|
+
[isoxml.at(ns("//bibdata//title[@type='title-intro' and @language='#{lang}']")),
|
130
|
+
isoxml.at(ns("//bibdata//title[@type='title-main' and @language='#{lang}']")),
|
131
|
+
isoxml.at(ns("//bibdata//title[@type='title-part' and @language='#{lang}']")),
|
132
|
+
isoxml.at(ns("//bibdata//title[@type='title-amd' and @language='#{lang}']"))]
|
133
|
+
end
|
134
|
+
|
106
135
|
def title(isoxml, _out)
|
107
|
-
intro = isoxml
|
108
|
-
|
109
|
-
part = isoxml.at(ns("//bibdata//title[@type='title-part' and @language='en']"))
|
110
|
-
partnumber = isoxml.at(ns("//bibdata//project-number/@part"))
|
111
|
-
subpartnumber = isoxml.at(ns("//bibdata//project-number/@subpart"))
|
136
|
+
intro, main, part, amd = title_parts(isoxml, "en")
|
137
|
+
partnumber, subpartnumber, amdnumber, corrnumber = title_nums(isoxml)
|
112
138
|
|
113
139
|
set(:doctitlemain, @c.encode(main ? main.text : "", :hexadecimal))
|
114
140
|
main = compose_title(main, intro, part, partnumber, subpartnumber, "en")
|
@@ -116,20 +142,24 @@ module IsoDoc
|
|
116
142
|
set(:doctitleintro, @c.encode(intro ? intro.text : "", :hexadecimal)) if intro
|
117
143
|
set(:doctitlepartlabel, part_prefix(partnumber, subpartnumber, "en"))
|
118
144
|
set(:doctitlepart, @c.encode(part.text, :hexadecimal)) if part
|
145
|
+
set(:doctitleamdlabel, amd_prefix(amdnumber, "en")) if amdnumber
|
146
|
+
set(:doctitleamd, @c.encode(amd.text, :hexadecimal)) if amd
|
147
|
+
set(:doctitlecorrlabel, corr_prefix(corrnumber, "en")) if corrnumber
|
119
148
|
end
|
120
149
|
|
121
150
|
def subtitle(isoxml, _out)
|
122
|
-
intro = isoxml
|
123
|
-
|
124
|
-
|
125
|
-
partnumber = isoxml.at(ns("//bibdata//project-number/@part"))
|
126
|
-
subpartnumber = isoxml.at(ns("//bibdata//project-number/@subpart"))
|
151
|
+
intro, main, part, amd = title_parts(isoxml, "fr")
|
152
|
+
partnumber, subpartnumber, amdnumber, corrnumber = title_nums(isoxml)
|
153
|
+
|
127
154
|
set(:docsubtitlemain, @c.encode(main ? main.text : "", :hexadecimal))
|
128
155
|
main = compose_title(main, intro, part, partnumber, subpartnumber, "fr")
|
129
156
|
set(:docsubtitle, main)
|
130
157
|
set(:docsubtitleintro, @c.encode(intro ? intro.text : "", :hexadecimal)) if intro
|
131
158
|
set(:docsubtitlepartlabel, part_prefix(partnumber, subpartnumber, "fr"))
|
132
159
|
set(:docsubtitlepart, @c.encode(part.text, :hexadecimal)) if part
|
160
|
+
set(:docsubtitleamdlabel, amd_prefix(amdnumber, "fr")) if amdnumber
|
161
|
+
set(:docsubtitleamd, @c.encode(amd.text, :hexadecimal)) if amd
|
162
|
+
set(:docsubtitlecorrlabel, corr_prefix(corrnumber, "fr")) if corrnumber
|
133
163
|
end
|
134
164
|
|
135
165
|
def author(xml, _out)
|
@@ -180,7 +210,7 @@ module IsoDoc
|
|
180
210
|
super
|
181
211
|
ics = []
|
182
212
|
isoxml.xpath(ns("//bibdata/ext/ics/code")).each { |i| ics << i.text }
|
183
|
-
set(:ics, ics.empty? ?
|
213
|
+
set(:ics, ics.empty? ? nil : ics.join(", "))
|
184
214
|
end
|
185
215
|
end
|
186
216
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require_relative "base_convert"
|
2
|
+
require "isodoc"
|
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 PdfConvert < IsoDoc::XslfoPdfConvert
|
11
|
+
def initialize(options)
|
12
|
+
@libdir = File.dirname(__FILE__)
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def pdf_stylesheet(docxml)
|
17
|
+
case doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
|
18
|
+
when "amendment", "technical-corrigendum" then "itu.recommendation-annex.xsl"
|
19
|
+
else
|
20
|
+
"iso.international-standard.xsl"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def convert(filename, file = nil, debug = false)
|
25
|
+
file = File.read(filename, encoding: "utf-8") if file.nil?
|
26
|
+
docxml, outname_html, dir = convert_init(file, filename, debug)
|
27
|
+
/\.xml$/.match(filename) or
|
28
|
+
filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
|
29
|
+
f.write file
|
30
|
+
f.path
|
31
|
+
end
|
32
|
+
FileUtils.rm_rf dir
|
33
|
+
::Metanorma::Output::XslfoPdf.new.convert(
|
34
|
+
filename, outname_html + ".pdf", File.join(@libdir, pdf_stylesheet(docxml)))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module Iso
|
3
|
+
module BaseConvert
|
4
|
+
def middle_title(out)
|
5
|
+
middle_title_main(out)
|
6
|
+
middle_title_amd(out)
|
7
|
+
end
|
8
|
+
|
9
|
+
def middle_title_main(out)
|
10
|
+
out.p(**{ class: "zzSTDTitle1" }) do |p|
|
11
|
+
p << @meta.get[:doctitleintro]
|
12
|
+
p << " — " if @meta.get[:doctitleintro] && @meta.get[:doctitlemain]
|
13
|
+
p << @meta.get[:doctitlemain]
|
14
|
+
p << " — " if @meta.get[:doctitlemain] && @meta.get[:doctitlepart]
|
15
|
+
end
|
16
|
+
a = @meta.get[:doctitlepart] and out.p(**{ class: "zzSTDTitle2" }) do |p|
|
17
|
+
b = @meta.get[:doctitlepartlabel] and p << "#{b}: "
|
18
|
+
p << "<br/><b>#{a}</b>"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def middle_title_amd(out)
|
23
|
+
a = @meta.get[:doctitleamdlabel] and out.p(**{ class: "zzSTDTitle2" }) do |p|
|
24
|
+
p << a
|
25
|
+
a = @meta.get[:doctitleamd] and p << ": #{a}"
|
26
|
+
end
|
27
|
+
a = @meta.get[:doctitlecorrlabel] and out.p(**{ class: "zzSTDTitle2" }) do |p|
|
28
|
+
p << a
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def annex(isoxml, out)
|
33
|
+
@amd and @suppressheadingnumbers = @oldsuppressheadingnumbers
|
34
|
+
super
|
35
|
+
@amd and @suppressheadingnumbers = true
|
36
|
+
end
|
37
|
+
|
38
|
+
def introduction(isoxml, out)
|
39
|
+
f = isoxml.at(ns("//introduction")) || return
|
40
|
+
num = f.at(ns(".//clause")) ? "0" : nil
|
41
|
+
title_attr = { class: "IntroTitle" }
|
42
|
+
page_break(out)
|
43
|
+
out.div **{ class: "Section3", id: f["id"] } do |div|
|
44
|
+
clause_name(num, @introduction_lbl, div, title_attr)
|
45
|
+
f.elements.each do |e|
|
46
|
+
parse(e, div) unless e.name == "title"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def foreword(isoxml, out)
|
52
|
+
f = isoxml.at(ns("//foreword")) || return
|
53
|
+
page_break(out)
|
54
|
+
out.div **attr_code(id: f["id"]) do |s|
|
55
|
+
s.h1(**{ class: "ForewordTitle" }) { |h1| h1 << @foreword_lbl }
|
56
|
+
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def clause_parse_title(node, div, c1, out)
|
61
|
+
return inline_header_title(out, node, c1) if c1.nil?
|
62
|
+
super
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,29 @@
|
|
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 StsConvert < IsoDoc::XslfoPdfConvert
|
11
|
+
def initialize(options)
|
12
|
+
@libdir = File.dirname(__FILE__)
|
13
|
+
end
|
14
|
+
|
15
|
+
def convert(filename, file = nil, debug = false)
|
16
|
+
file = File.read(filename, encoding: "utf-8") if file.nil?
|
17
|
+
docxml, outname_html, dir = convert_init(file, filename, debug)
|
18
|
+
/\.xml$/.match(filename) or
|
19
|
+
filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
|
20
|
+
f.write file
|
21
|
+
f.path
|
22
|
+
end
|
23
|
+
FileUtils.rm_rf dir
|
24
|
+
Mn2sts.convert(filename, outname_html + ".sts.xml")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
data/lib/metanorma-iso.rb
CHANGED
@@ -3,6 +3,8 @@ require_relative "asciidoctor/iso/converter"
|
|
3
3
|
require_relative "metanorma/iso/version"
|
4
4
|
require_relative "isodoc/iso/html_convert"
|
5
5
|
require_relative "isodoc/iso/word_convert"
|
6
|
+
require_relative "isodoc/iso/pdf_convert"
|
7
|
+
require_relative "isodoc/iso/sts_convert"
|
6
8
|
require "asciidoctor/extensions"
|
7
9
|
|
8
10
|
if defined? Metanorma
|
@@ -2,6 +2,15 @@ require "metanorma/processor"
|
|
2
2
|
|
3
3
|
module Metanorma
|
4
4
|
module Iso
|
5
|
+
def self.fonts_used
|
6
|
+
{
|
7
|
+
html: ["Cambria", "Times New Roman", "Cambria Math", "HanSans", "Courier New"],
|
8
|
+
html_alt: ["Cambria", "Times New Roman", "Cambria Math", "HanSans", "Courier New"],
|
9
|
+
doc: ["Cambria", "Times New Roman", "Cambria Math", "HanSans", "Courier New"],
|
10
|
+
pdf: ["Cambria", "Times New Roman", "Cambria Math", "HanSans", "Courier New"],
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
5
14
|
class Processor < Metanorma::Processor
|
6
15
|
|
7
16
|
def initialize
|
@@ -14,7 +23,9 @@ module Metanorma
|
|
14
23
|
super.merge(
|
15
24
|
html: "html",
|
16
25
|
html_alt: "alt.html",
|
17
|
-
doc: "doc"
|
26
|
+
doc: "doc",
|
27
|
+
pdf: "pdf",
|
28
|
+
sts: "sts.xml"
|
18
29
|
)
|
19
30
|
end
|
20
31
|
|
@@ -34,6 +45,10 @@ module Metanorma
|
|
34
45
|
IsoDoc::Iso::HtmlConvert.new(options.merge(alt: true)).convert(outname, isodoc_node)
|
35
46
|
when :doc
|
36
47
|
IsoDoc::Iso::WordConvert.new(options).convert(outname, isodoc_node)
|
48
|
+
when :pdf
|
49
|
+
IsoDoc::Iso::PdfConvert.new(options).convert(outname, isodoc_node)
|
50
|
+
when :sts
|
51
|
+
IsoDoc::Iso::StsConvert.new(options).convert(outname, isodoc_node)
|
37
52
|
else
|
38
53
|
super
|
39
54
|
end
|
data/metanorma-iso.gemspec
CHANGED
@@ -31,7 +31,10 @@ Gem::Specification.new do |spec|
|
|
31
31
|
|
32
32
|
spec.add_dependency "ruby-jing"
|
33
33
|
spec.add_dependency "isodoc", "~> 1.0.0"
|
34
|
-
spec.add_dependency "metanorma-standoc", "~> 1.
|
34
|
+
spec.add_dependency "metanorma-standoc", "~> 1.4.0"
|
35
|
+
spec.add_dependency "tokenizer", "~> 0.3.0"
|
36
|
+
spec.add_dependency "twitter_cldr"
|
37
|
+
spec.add_dependency "mn2sts", "~> 1.2.0"
|
35
38
|
|
36
39
|
spec.add_development_dependency "byebug"
|
37
40
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
@@ -0,0 +1,726 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
RSpec.describe Asciidoctor::ISO do
|
5
|
+
it "validates amendment document against distinct ISO XML schema" do
|
6
|
+
FileUtils.rm_f "test.err"
|
7
|
+
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
8
|
+
= Document title
|
9
|
+
Author
|
10
|
+
:docfile: test.adoc
|
11
|
+
:nodoc:
|
12
|
+
:no-isobib:
|
13
|
+
:doctype: amendment
|
14
|
+
|
15
|
+
[change=mid-air]
|
16
|
+
== Para
|
17
|
+
INPUT
|
18
|
+
expect(File.read("test.err")).to include 'value of attribute "change" is invalid; must be equal to'
|
19
|
+
end
|
20
|
+
|
21
|
+
it "processes amendment sections" do
|
22
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
23
|
+
#{AMD_BLANK_HDR}
|
24
|
+
== Foreword
|
25
|
+
|
26
|
+
Text
|
27
|
+
|
28
|
+
== Introduction
|
29
|
+
|
30
|
+
=== Introduction Subsection
|
31
|
+
|
32
|
+
== Scope
|
33
|
+
|
34
|
+
Text
|
35
|
+
|
36
|
+
== Acknowledgements
|
37
|
+
|
38
|
+
== Normative References
|
39
|
+
|
40
|
+
== Terms and Definitions
|
41
|
+
|
42
|
+
=== Term1
|
43
|
+
|
44
|
+
== Terms, Definitions, Symbols and Abbreviated Terms
|
45
|
+
|
46
|
+
=== Normal Terms
|
47
|
+
|
48
|
+
==== Term2
|
49
|
+
|
50
|
+
=== Symbols and Abbreviated Terms
|
51
|
+
|
52
|
+
== Symbols and Abbreviated Terms
|
53
|
+
|
54
|
+
== Clause 4
|
55
|
+
|
56
|
+
=== Introduction
|
57
|
+
|
58
|
+
=== Clause 4.2
|
59
|
+
|
60
|
+
== Terms and Definitions
|
61
|
+
|
62
|
+
[appendix]
|
63
|
+
== Annex
|
64
|
+
|
65
|
+
=== Annex A.1
|
66
|
+
|
67
|
+
[%appendix]
|
68
|
+
=== Appendix 1
|
69
|
+
|
70
|
+
== Bibliography
|
71
|
+
|
72
|
+
=== Bibliography Subsection
|
73
|
+
INPUT
|
74
|
+
#{BLANK_HDR.sub(%r{<doctype>article</doctype>}, "<doctype>amendment</doctype>")}
|
75
|
+
<sections>
|
76
|
+
<clause id='_' obligation='normative'>
|
77
|
+
<title>Foreword</title>
|
78
|
+
<p id='_'>Text</p>
|
79
|
+
</clause>
|
80
|
+
<clause id='_' obligation='normative'>
|
81
|
+
<title>Introduction</title>
|
82
|
+
<clause id='_' obligation='normative'>
|
83
|
+
<title>Introduction Subsection</title>
|
84
|
+
</clause>
|
85
|
+
</clause>
|
86
|
+
<clause id='_' obligation='normative'>
|
87
|
+
<title>Scope</title>
|
88
|
+
<p id='_'>Text</p>
|
89
|
+
</clause>
|
90
|
+
<clause id='_' obligation='normative'>
|
91
|
+
<title>Acknowledgements</title>
|
92
|
+
</clause>
|
93
|
+
<clause id='_' obligation='normative'>
|
94
|
+
<title>Normative References</title>
|
95
|
+
</clause>
|
96
|
+
<clause id='_' obligation='normative'>
|
97
|
+
<title>Terms and Definitions</title>
|
98
|
+
<clause id='_' obligation='normative'>
|
99
|
+
<title>Term1</title>
|
100
|
+
</clause>
|
101
|
+
</clause>
|
102
|
+
<clause id='_' obligation='normative'>
|
103
|
+
<title>Terms, Definitions, Symbols and Abbreviated Terms</title>
|
104
|
+
<clause id='_' obligation='normative'>
|
105
|
+
<title>Normal Terms</title>
|
106
|
+
<clause id='_' obligation='normative'>
|
107
|
+
<title>Term2</title>
|
108
|
+
</clause>
|
109
|
+
</clause>
|
110
|
+
<clause id='_' obligation='normative'>
|
111
|
+
<title>Symbols and Abbreviated Terms</title>
|
112
|
+
</clause>
|
113
|
+
</clause>
|
114
|
+
<clause id='_' obligation='normative'>
|
115
|
+
<title>Symbols and Abbreviated Terms</title>
|
116
|
+
</clause>
|
117
|
+
<clause id='_' obligation='normative'>
|
118
|
+
<title>Clause 4</title>
|
119
|
+
<clause id='_' obligation='normative'>
|
120
|
+
<title>Introduction</title>
|
121
|
+
</clause>
|
122
|
+
<clause id='_' obligation='normative'>
|
123
|
+
<title>Clause 4.2</title>
|
124
|
+
</clause>
|
125
|
+
</clause>
|
126
|
+
<clause id='_' obligation='normative'>
|
127
|
+
<title>Terms and Definitions</title>
|
128
|
+
</clause>
|
129
|
+
<clause id='_' obligation='normative'>
|
130
|
+
<title>Bibliography</title>
|
131
|
+
<clause id='_' obligation='normative'>
|
132
|
+
<title>Bibliography Subsection</title>
|
133
|
+
</clause>
|
134
|
+
</clause>
|
135
|
+
</sections>
|
136
|
+
<annex id='_' obligation='normative'>
|
137
|
+
<title>Annex</title>
|
138
|
+
<clause id='_' obligation='normative'>
|
139
|
+
<title>Annex A.1</title>
|
140
|
+
</clause>
|
141
|
+
<appendix id='_' obligation='normative'>
|
142
|
+
<title>Appendix 1</title>
|
143
|
+
</appendix>
|
144
|
+
</annex>
|
145
|
+
</iso-standard>
|
146
|
+
|
147
|
+
OUTPUT
|
148
|
+
end
|
149
|
+
|
150
|
+
it "processes section attributes" do
|
151
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
152
|
+
#{AMD_BLANK_HDR}
|
153
|
+
[change=delete,locality="clause=introduction,paragraph=4-7",inline-header="true"]
|
154
|
+
== Clause 1
|
155
|
+
|
156
|
+
INPUT
|
157
|
+
#{BLANK_HDR.sub(%r{<doctype>article</doctype>}, "<doctype>amendment</doctype>")}
|
158
|
+
<sections><clause id="_" obligation="normative" change="delete" locality="clause=introduction,paragraph=4-7">
|
159
|
+
<title>Clause 1</title>
|
160
|
+
</clause>
|
161
|
+
</sections>
|
162
|
+
</iso-standard>
|
163
|
+
OUTPUT
|
164
|
+
end
|
165
|
+
|
166
|
+
it "processes default metadata, amendment" do
|
167
|
+
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
168
|
+
= Document title
|
169
|
+
Author
|
170
|
+
:docfile: test.adoc
|
171
|
+
:nodoc:
|
172
|
+
:novalid:
|
173
|
+
:no-isobib:
|
174
|
+
:docnumber: 17301
|
175
|
+
:partnumber: 1
|
176
|
+
:edition: 2
|
177
|
+
:revdate: 2000-01-01
|
178
|
+
:draft: 0.3.4
|
179
|
+
:technical-committee: TC
|
180
|
+
:technical-committee-number: 1
|
181
|
+
:technical-committee-type: A
|
182
|
+
:subcommittee: SC
|
183
|
+
:subcommittee-number: 2
|
184
|
+
:subcommittee-type: B
|
185
|
+
:workgroup: WG
|
186
|
+
:workgroup-number: 3
|
187
|
+
:workgroup-type: C
|
188
|
+
:technical-committee_2: TC1
|
189
|
+
:technical-committee-number_2: 11
|
190
|
+
:technical-committee-type_2: A1
|
191
|
+
:subcommittee_2: SC1
|
192
|
+
:subcommittee-number_2: 21
|
193
|
+
:subcommittee-type_2: B1
|
194
|
+
:workgroup_2: WG1
|
195
|
+
:workgroup-number_2: 31
|
196
|
+
:workgroup-type_2: C1
|
197
|
+
:secretariat: SECRETARIAT
|
198
|
+
:docstage: 10
|
199
|
+
:docsubstage: 20
|
200
|
+
:iteration: 3
|
201
|
+
:language: en
|
202
|
+
:title-intro-en: Introduction
|
203
|
+
:title-main-en: Main Title -- Title
|
204
|
+
:title-part-en: Title Part
|
205
|
+
:title-intro-fr: Introduction Française
|
206
|
+
:title-main-fr: Titre Principal
|
207
|
+
:title-part-fr: Part du Titre
|
208
|
+
:library-ics: 1,2,3
|
209
|
+
:copyright-year: 2017
|
210
|
+
:updates: ISO 17301-1:2016
|
211
|
+
:created-date: 2016-05-01
|
212
|
+
:amendment-number: 1
|
213
|
+
:title-amendment-en: Mass fraction of extraneous matter, milled rice (nonglutinous), sample dividers and recommendations relating to storage and transport conditions
|
214
|
+
: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
|
215
|
+
:doctype: amendment
|
216
|
+
:updates-document-type: international-standard
|
217
|
+
INPUT
|
218
|
+
<iso-standard xmlns='https://www.metanorma.org/ns/iso'>
|
219
|
+
<bibdata type='standard'>
|
220
|
+
<title language='en' format='text/plain' type='main'>Introduction — Main Title — Title — Title Part — Mass fraction of
|
221
|
+
extraneous matter, milled rice (nonglutinous), sample dividers and
|
222
|
+
recommendations relating to storage and transport conditions</title>
|
223
|
+
<title language='en' format='text/plain' type='title-intro'>Introduction</title>
|
224
|
+
<title language='en' format='text/plain' type='title-main'>Main Title — Title</title>
|
225
|
+
<title language='en' format='text/plain' type='title-part'>Title Part</title>
|
226
|
+
<title language='en' format='text/plain' type='title-amd'>
|
227
|
+
Mass fraction of extraneous matter, milled rice (nonglutinous), sample
|
228
|
+
dividers and recommendations relating to storage and transport conditions
|
229
|
+
</title>
|
230
|
+
<title language='fr' format='text/plain' type='main'>
|
231
|
+
Introduction Française — Titre Principal — Part du Titre — Fraction
|
232
|
+
massique de matière étrangère, riz usiné (non gluant), diviseurs
|
233
|
+
d’échantillon et recommandations relatives aux conditions d’entreposage et
|
234
|
+
de transport
|
235
|
+
</title>
|
236
|
+
<title language='fr' format='text/plain' type='title-intro'>Introduction Française</title>
|
237
|
+
<title language='fr' format='text/plain' type='title-main'>Titre Principal</title>
|
238
|
+
<title language='fr' format='text/plain' type='title-part'>Part du Titre</title>
|
239
|
+
<title language='fr' format='text/plain' type='title-amd'>
|
240
|
+
Fraction massique de matière étrangère, riz usiné (non gluant), diviseurs
|
241
|
+
d’échantillon et recommandations relatives aux conditions d’entreposage et
|
242
|
+
de transport
|
243
|
+
</title>
|
244
|
+
<docidentifier type='iso'>ISO 17301-1:2016/PreNP Amd 1</docidentifier>
|
245
|
+
<docidentifier type='iso-with-lang'>ISO 17301-1:2016/PreNP Amd 1(E)</docidentifier>
|
246
|
+
<docidentifier type='iso-reference'>ISO 17301-1:2016/PreNP Amd 1:2017(E)</docidentifier>
|
247
|
+
<docnumber>17301</docnumber>
|
248
|
+
<date type='created'>
|
249
|
+
<on>2016-05-01</on>
|
250
|
+
</date>
|
251
|
+
<contributor>
|
252
|
+
<role type='author'/>
|
253
|
+
<organization>
|
254
|
+
<name>International Organization for Standardization</name>
|
255
|
+
<abbreviation>ISO</abbreviation>
|
256
|
+
</organization>
|
257
|
+
</contributor>
|
258
|
+
<contributor>
|
259
|
+
<role type='publisher'/>
|
260
|
+
<organization>
|
261
|
+
<name>International Organization for Standardization</name>
|
262
|
+
<abbreviation>ISO</abbreviation>
|
263
|
+
</organization>
|
264
|
+
</contributor>
|
265
|
+
<edition>2</edition>
|
266
|
+
<version>
|
267
|
+
<revision-date>2000-01-01</revision-date>
|
268
|
+
<draft>0.3.4</draft>
|
269
|
+
</version>
|
270
|
+
<language>en</language>
|
271
|
+
<script>Latn</script>
|
272
|
+
<status>
|
273
|
+
<stage abbreviation='NP'>10</stage>
|
274
|
+
<substage>20</substage>
|
275
|
+
<iteration>3</iteration>
|
276
|
+
</status>
|
277
|
+
<copyright>
|
278
|
+
<from>2017</from>
|
279
|
+
<owner>
|
280
|
+
<organization>
|
281
|
+
<name>International Organization for Standardization</name>
|
282
|
+
<abbreviation>ISO</abbreviation>
|
283
|
+
</organization>
|
284
|
+
</owner>
|
285
|
+
</copyright>
|
286
|
+
<ext>
|
287
|
+
<doctype>amendment</doctype>
|
288
|
+
<editorialgroup>
|
289
|
+
<technical-committee number='1' type='A'>TC</technical-committee>
|
290
|
+
<technical-committee number='11' type='A1'>TC1</technical-committee>
|
291
|
+
<subcommittee number='2' type='B'>SC</subcommittee>
|
292
|
+
<subcommittee number='21' type='B1'>SC1</subcommittee>
|
293
|
+
<workgroup number='3' type='C'>WG</workgroup>
|
294
|
+
<workgroup number='31' type='C1'>WG1</workgroup>
|
295
|
+
<secretariat>SECRETARIAT</secretariat>
|
296
|
+
</editorialgroup>
|
297
|
+
<ics>
|
298
|
+
<code>1</code>
|
299
|
+
</ics>
|
300
|
+
<ics>
|
301
|
+
<code>2</code>
|
302
|
+
</ics>
|
303
|
+
<ics>
|
304
|
+
<code>3</code>
|
305
|
+
</ics>
|
306
|
+
<structuredidentifier>
|
307
|
+
<project-number part='1' amendment='1' origyr='2016-05-01'>17301</project-number>
|
308
|
+
</structuredidentifier>
|
309
|
+
<stagename>New work item proposal</stagename>
|
310
|
+
<updates-document-type>international-standard</updates-document-type>
|
311
|
+
</ext>
|
312
|
+
</bibdata>
|
313
|
+
<sections/>
|
314
|
+
</iso-standard>
|
315
|
+
OUTPUT
|
316
|
+
end
|
317
|
+
|
318
|
+
it "processes metadata, amendment" do
|
319
|
+
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
320
|
+
= Document title
|
321
|
+
Author
|
322
|
+
:docfile: test.adoc
|
323
|
+
:nodoc:
|
324
|
+
:novalid:
|
325
|
+
:no-isobib:
|
326
|
+
:docnumber: 17301
|
327
|
+
:partnumber: 1
|
328
|
+
:doctype: amendment
|
329
|
+
:docstage: 30
|
330
|
+
:updates: ISO 17301-1:2030
|
331
|
+
:amendment-number: 1
|
332
|
+
INPUT
|
333
|
+
<iso-standard xmlns='https://www.metanorma.org/ns/iso'>
|
334
|
+
<bibdata type='standard'>
|
335
|
+
<docidentifier type='iso'>ISO 17301-1:2030/CD Amd 1</docidentifier>
|
336
|
+
<docidentifier type='iso-with-lang'>ISO 17301-1:2030/CD Amd 1(E)</docidentifier>
|
337
|
+
<docidentifier type='iso-reference'>ISO 17301-1:2030/CD Amd 1(E)</docidentifier>
|
338
|
+
<docnumber>17301</docnumber>
|
339
|
+
<contributor>
|
340
|
+
<role type='author'/>
|
341
|
+
<organization>
|
342
|
+
<name>International Organization for Standardization</name>
|
343
|
+
<abbreviation>ISO</abbreviation>
|
344
|
+
</organization>
|
345
|
+
</contributor>
|
346
|
+
<contributor>
|
347
|
+
<role type='publisher'/>
|
348
|
+
<organization>
|
349
|
+
<name>International Organization for Standardization</name>
|
350
|
+
<abbreviation>ISO</abbreviation>
|
351
|
+
</organization>
|
352
|
+
</contributor>
|
353
|
+
<language>en</language>
|
354
|
+
<script>Latn</script>
|
355
|
+
<status>
|
356
|
+
<stage abbreviation='CD'>30</stage>
|
357
|
+
<substage>00</substage>
|
358
|
+
</status>
|
359
|
+
<copyright>
|
360
|
+
<from>2020</from>
|
361
|
+
<owner>
|
362
|
+
<organization>
|
363
|
+
<name>International Organization for Standardization</name>
|
364
|
+
<abbreviation>ISO</abbreviation>
|
365
|
+
</organization>
|
366
|
+
</owner>
|
367
|
+
</copyright>
|
368
|
+
<ext>
|
369
|
+
<doctype>amendment</doctype>
|
370
|
+
<editorialgroup>
|
371
|
+
<technical-committee/>
|
372
|
+
<subcommittee/>
|
373
|
+
<workgroup/>
|
374
|
+
</editorialgroup>
|
375
|
+
<structuredidentifier>
|
376
|
+
<project-number part='1' amendment='1'>17301</project-number>
|
377
|
+
</structuredidentifier>
|
378
|
+
<stagename>Committee draft</stagename>
|
379
|
+
</ext>
|
380
|
+
</bibdata>
|
381
|
+
<sections/>
|
382
|
+
</iso-standard>
|
383
|
+
OUTPUT
|
384
|
+
end
|
385
|
+
|
386
|
+
it "processes metadata, amendment" do
|
387
|
+
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
388
|
+
= Document title
|
389
|
+
Author
|
390
|
+
:docfile: test.adoc
|
391
|
+
:nodoc:
|
392
|
+
:novalid:
|
393
|
+
:no-isobib:
|
394
|
+
:docnumber: 17301
|
395
|
+
:partnumber: 1
|
396
|
+
:doctype: amendment
|
397
|
+
:docstage: 40
|
398
|
+
:updates: ISO 17301-1:2030
|
399
|
+
:amendment-number: 1
|
400
|
+
INPUT
|
401
|
+
<iso-standard xmlns='https://www.metanorma.org/ns/iso'>
|
402
|
+
<bibdata type='standard'>
|
403
|
+
<docidentifier type='iso'>ISO 17301-1:2030/DAmd 1</docidentifier>
|
404
|
+
<docidentifier type='iso-with-lang'>ISO 17301-1:2030/DAmd 1(E)</docidentifier>
|
405
|
+
<docidentifier type='iso-reference'>ISO 17301-1:2030/DAmd 1(E)</docidentifier>
|
406
|
+
<docnumber>17301</docnumber>
|
407
|
+
<contributor>
|
408
|
+
<role type='author'/>
|
409
|
+
<organization>
|
410
|
+
<name>International Organization for Standardization</name>
|
411
|
+
<abbreviation>ISO</abbreviation>
|
412
|
+
</organization>
|
413
|
+
</contributor>
|
414
|
+
<contributor>
|
415
|
+
<role type='publisher'/>
|
416
|
+
<organization>
|
417
|
+
<name>International Organization for Standardization</name>
|
418
|
+
<abbreviation>ISO</abbreviation>
|
419
|
+
</organization>
|
420
|
+
</contributor>
|
421
|
+
<language>en</language>
|
422
|
+
<script>Latn</script>
|
423
|
+
<status>
|
424
|
+
<stage abbreviation='D'>40</stage>
|
425
|
+
<substage>00</substage>
|
426
|
+
</status>
|
427
|
+
<copyright>
|
428
|
+
<from>2020</from>
|
429
|
+
<owner>
|
430
|
+
<organization>
|
431
|
+
<name>International Organization for Standardization</name>
|
432
|
+
<abbreviation>ISO</abbreviation>
|
433
|
+
</organization>
|
434
|
+
</owner>
|
435
|
+
</copyright>
|
436
|
+
<ext>
|
437
|
+
<doctype>amendment</doctype>
|
438
|
+
<editorialgroup>
|
439
|
+
<technical-committee/>
|
440
|
+
<subcommittee/>
|
441
|
+
<workgroup/>
|
442
|
+
</editorialgroup>
|
443
|
+
<structuredidentifier>
|
444
|
+
<project-number part='1' amendment='1'>17301</project-number>
|
445
|
+
</structuredidentifier>
|
446
|
+
<stagename>Draft</stagename>
|
447
|
+
</ext>
|
448
|
+
</bibdata>
|
449
|
+
<sections/>
|
450
|
+
</iso-standard>
|
451
|
+
OUTPUT
|
452
|
+
end
|
453
|
+
|
454
|
+
it "processes metadata, amendment" do
|
455
|
+
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
456
|
+
= Document title
|
457
|
+
Author
|
458
|
+
:docfile: test.adoc
|
459
|
+
:nodoc:
|
460
|
+
:novalid:
|
461
|
+
:no-isobib:
|
462
|
+
:docnumber: 17301
|
463
|
+
:partnumber: 1
|
464
|
+
:doctype: amendment
|
465
|
+
:updates: ISO 17301-1:2030
|
466
|
+
:amendment-number: 1
|
467
|
+
INPUT
|
468
|
+
<iso-standard xmlns='https://www.metanorma.org/ns/iso'>
|
469
|
+
<bibdata type='standard'>
|
470
|
+
<docidentifier type='iso'>ISO 17301-1:2030/Amd 1</docidentifier>
|
471
|
+
<docidentifier type='iso-with-lang'>ISO 17301-1:2030/Amd 1(E)</docidentifier>
|
472
|
+
<docidentifier type='iso-reference'>ISO 17301-1:2030/Amd 1(E)</docidentifier>
|
473
|
+
<docnumber>17301</docnumber>
|
474
|
+
<contributor>
|
475
|
+
<role type='author'/>
|
476
|
+
<organization>
|
477
|
+
<name>International Organization for Standardization</name>
|
478
|
+
<abbreviation>ISO</abbreviation>
|
479
|
+
</organization>
|
480
|
+
</contributor>
|
481
|
+
<contributor>
|
482
|
+
<role type='publisher'/>
|
483
|
+
<organization>
|
484
|
+
<name>International Organization for Standardization</name>
|
485
|
+
<abbreviation>ISO</abbreviation>
|
486
|
+
</organization>
|
487
|
+
</contributor>
|
488
|
+
<language>en</language>
|
489
|
+
<script>Latn</script>
|
490
|
+
<status>
|
491
|
+
<stage abbreviation='IS'>60</stage>
|
492
|
+
<substage>60</substage>
|
493
|
+
</status>
|
494
|
+
<copyright>
|
495
|
+
<from>2020</from>
|
496
|
+
<owner>
|
497
|
+
<organization>
|
498
|
+
<name>International Organization for Standardization</name>
|
499
|
+
<abbreviation>ISO</abbreviation>
|
500
|
+
</organization>
|
501
|
+
</owner>
|
502
|
+
</copyright>
|
503
|
+
<ext>
|
504
|
+
<doctype>amendment</doctype>
|
505
|
+
<editorialgroup>
|
506
|
+
<technical-committee/>
|
507
|
+
<subcommittee/>
|
508
|
+
<workgroup/>
|
509
|
+
</editorialgroup>
|
510
|
+
<structuredidentifier>
|
511
|
+
<project-number part='1' amendment='1'>17301</project-number>
|
512
|
+
</structuredidentifier>
|
513
|
+
<stagename>International standard</stagename>
|
514
|
+
</ext>
|
515
|
+
</bibdata>
|
516
|
+
<sections/>
|
517
|
+
</iso-standard>
|
518
|
+
OUTPUT
|
519
|
+
end
|
520
|
+
|
521
|
+
it "processes metadata, corrigendum" do
|
522
|
+
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
523
|
+
= Document title
|
524
|
+
Author
|
525
|
+
:docfile: test.adoc
|
526
|
+
:nodoc:
|
527
|
+
:novalid:
|
528
|
+
:no-isobib:
|
529
|
+
:docnumber: 17301
|
530
|
+
:partnumber: 1
|
531
|
+
:doctype: technical-corrigendum
|
532
|
+
:docstage: 30
|
533
|
+
:updates: ISO 17301-1:2030
|
534
|
+
:corrigendum-number: 3
|
535
|
+
INPUT
|
536
|
+
<iso-standard xmlns='https://www.metanorma.org/ns/iso'>
|
537
|
+
<bibdata type='standard'>
|
538
|
+
<docidentifier type='iso'>ISO 17301-1:2030/CD Cor.3</docidentifier>
|
539
|
+
<docidentifier type='iso-with-lang'>ISO 17301-1:2030/CD Cor.3(E)</docidentifier>
|
540
|
+
<docidentifier type='iso-reference'>ISO 17301-1:2030/CD Cor.3(E)</docidentifier>
|
541
|
+
<docnumber>17301</docnumber>
|
542
|
+
<contributor>
|
543
|
+
<role type='author'/>
|
544
|
+
<organization>
|
545
|
+
<name>International Organization for Standardization</name>
|
546
|
+
<abbreviation>ISO</abbreviation>
|
547
|
+
</organization>
|
548
|
+
</contributor>
|
549
|
+
<contributor>
|
550
|
+
<role type='publisher'/>
|
551
|
+
<organization>
|
552
|
+
<name>International Organization for Standardization</name>
|
553
|
+
<abbreviation>ISO</abbreviation>
|
554
|
+
</organization>
|
555
|
+
</contributor>
|
556
|
+
<language>en</language>
|
557
|
+
<script>Latn</script>
|
558
|
+
<status>
|
559
|
+
<stage abbreviation='CD'>30</stage>
|
560
|
+
<substage>00</substage>
|
561
|
+
</status>
|
562
|
+
<copyright>
|
563
|
+
<from>2020</from>
|
564
|
+
<owner>
|
565
|
+
<organization>
|
566
|
+
<name>International Organization for Standardization</name>
|
567
|
+
<abbreviation>ISO</abbreviation>
|
568
|
+
</organization>
|
569
|
+
</owner>
|
570
|
+
</copyright>
|
571
|
+
<ext>
|
572
|
+
<doctype>technical-corrigendum</doctype>
|
573
|
+
<editorialgroup>
|
574
|
+
<technical-committee/>
|
575
|
+
<subcommittee/>
|
576
|
+
<workgroup/>
|
577
|
+
</editorialgroup>
|
578
|
+
<structuredidentifier>
|
579
|
+
<project-number part='1' corrigendum='3'>17301</project-number>
|
580
|
+
</structuredidentifier>
|
581
|
+
<stagename>Committee draft</stagename>
|
582
|
+
</ext>
|
583
|
+
</bibdata>
|
584
|
+
<sections/>
|
585
|
+
</iso-standard>
|
586
|
+
OUTPUT
|
587
|
+
end
|
588
|
+
|
589
|
+
it "processes metadata, corrigendum" do
|
590
|
+
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
591
|
+
= Document title
|
592
|
+
Author
|
593
|
+
:docfile: test.adoc
|
594
|
+
:nodoc:
|
595
|
+
:novalid:
|
596
|
+
:no-isobib:
|
597
|
+
:docnumber: 17301
|
598
|
+
:partnumber: 1
|
599
|
+
:doctype: technical-corrigendum
|
600
|
+
:docstage: 50
|
601
|
+
:updates: ISO 17301-1:2030
|
602
|
+
:corrigendum-number: 3
|
603
|
+
INPUT
|
604
|
+
<iso-standard xmlns='https://www.metanorma.org/ns/iso'>
|
605
|
+
<bibdata type='standard'>
|
606
|
+
<docidentifier type='iso'>ISO 17301-1:2030/FDCor.3</docidentifier>
|
607
|
+
<docidentifier type='iso-with-lang'>ISO 17301-1:2030/FDCor.3(E)</docidentifier>
|
608
|
+
<docidentifier type='iso-reference'>ISO 17301-1:2030/FDCor.3(E)</docidentifier>
|
609
|
+
<docnumber>17301</docnumber>
|
610
|
+
<contributor>
|
611
|
+
<role type='author'/>
|
612
|
+
<organization>
|
613
|
+
<name>International Organization for Standardization</name>
|
614
|
+
<abbreviation>ISO</abbreviation>
|
615
|
+
</organization>
|
616
|
+
</contributor>
|
617
|
+
<contributor>
|
618
|
+
<role type='publisher'/>
|
619
|
+
<organization>
|
620
|
+
<name>International Organization for Standardization</name>
|
621
|
+
<abbreviation>ISO</abbreviation>
|
622
|
+
</organization>
|
623
|
+
</contributor>
|
624
|
+
<language>en</language>
|
625
|
+
<script>Latn</script>
|
626
|
+
<status>
|
627
|
+
<stage abbreviation='FD'>50</stage>
|
628
|
+
<substage>00</substage>
|
629
|
+
</status>
|
630
|
+
<copyright>
|
631
|
+
<from>2020</from>
|
632
|
+
<owner>
|
633
|
+
<organization>
|
634
|
+
<name>International Organization for Standardization</name>
|
635
|
+
<abbreviation>ISO</abbreviation>
|
636
|
+
</organization>
|
637
|
+
</owner>
|
638
|
+
</copyright>
|
639
|
+
<ext>
|
640
|
+
<doctype>technical-corrigendum</doctype>
|
641
|
+
<editorialgroup>
|
642
|
+
<technical-committee/>
|
643
|
+
<subcommittee/>
|
644
|
+
<workgroup/>
|
645
|
+
</editorialgroup>
|
646
|
+
<structuredidentifier>
|
647
|
+
<project-number part='1' corrigendum='3'>17301</project-number>
|
648
|
+
</structuredidentifier>
|
649
|
+
<stagename>Final draft</stagename>
|
650
|
+
</ext>
|
651
|
+
</bibdata>
|
652
|
+
<sections/>
|
653
|
+
</iso-standard>
|
654
|
+
OUTPUT
|
655
|
+
end
|
656
|
+
|
657
|
+
it "processes metadata, corrigendum" do
|
658
|
+
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
659
|
+
= Document title
|
660
|
+
Author
|
661
|
+
:docfile: test.adoc
|
662
|
+
:nodoc:
|
663
|
+
:novalid:
|
664
|
+
:no-isobib:
|
665
|
+
:docnumber: 17301
|
666
|
+
:partnumber: 1
|
667
|
+
:doctype: technical-corrigendum
|
668
|
+
:updates: ISO 17301-1:2030
|
669
|
+
:corrigendum-number: 3
|
670
|
+
INPUT
|
671
|
+
<iso-standard xmlns='https://www.metanorma.org/ns/iso'>
|
672
|
+
<bibdata type='standard'>
|
673
|
+
<docidentifier type='iso'>ISO 17301-1:2030/Cor.3</docidentifier>
|
674
|
+
<docidentifier type='iso-with-lang'>ISO 17301-1:2030/Cor.3(E)</docidentifier>
|
675
|
+
<docidentifier type='iso-reference'>ISO 17301-1:2030/Cor.3(E)</docidentifier>
|
676
|
+
<docnumber>17301</docnumber>
|
677
|
+
<contributor>
|
678
|
+
<role type='author'/>
|
679
|
+
<organization>
|
680
|
+
<name>International Organization for Standardization</name>
|
681
|
+
<abbreviation>ISO</abbreviation>
|
682
|
+
</organization>
|
683
|
+
</contributor>
|
684
|
+
<contributor>
|
685
|
+
<role type='publisher'/>
|
686
|
+
<organization>
|
687
|
+
<name>International Organization for Standardization</name>
|
688
|
+
<abbreviation>ISO</abbreviation>
|
689
|
+
</organization>
|
690
|
+
</contributor>
|
691
|
+
<language>en</language>
|
692
|
+
<script>Latn</script>
|
693
|
+
<status>
|
694
|
+
<stage abbreviation='IS'>60</stage>
|
695
|
+
<substage>60</substage>
|
696
|
+
</status>
|
697
|
+
<copyright>
|
698
|
+
<from>2020</from>
|
699
|
+
<owner>
|
700
|
+
<organization>
|
701
|
+
<name>International Organization for Standardization</name>
|
702
|
+
<abbreviation>ISO</abbreviation>
|
703
|
+
</organization>
|
704
|
+
</owner>
|
705
|
+
</copyright>
|
706
|
+
<ext>
|
707
|
+
<doctype>technical-corrigendum</doctype>
|
708
|
+
<editorialgroup>
|
709
|
+
<technical-committee/>
|
710
|
+
<subcommittee/>
|
711
|
+
<workgroup/>
|
712
|
+
</editorialgroup>
|
713
|
+
<structuredidentifier>
|
714
|
+
<project-number part='1' corrigendum='3'>17301</project-number>
|
715
|
+
</structuredidentifier>
|
716
|
+
<stagename>International standard</stagename>
|
717
|
+
</ext>
|
718
|
+
</bibdata>
|
719
|
+
<sections/>
|
720
|
+
</iso-standard>
|
721
|
+
OUTPUT
|
722
|
+
end
|
723
|
+
|
724
|
+
|
725
|
+
|
726
|
+
end
|