metanorma-iso 1.3.25 → 1.4.2
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 +0 -1
- data/.github/workflows/ubuntu.yml +6 -3
- data/.github/workflows/windows.yml +0 -1
- data/Gemfile +1 -0
- data/Rakefile +2 -0
- data/lib/asciidoctor/iso/base.rb +16 -13
- data/lib/asciidoctor/iso/biblio.rng +14 -4
- data/lib/asciidoctor/iso/cleanup.rb +1 -1
- data/lib/asciidoctor/iso/front.rb +3 -155
- data/lib/asciidoctor/iso/front_id.rb +196 -0
- data/lib/asciidoctor/iso/isodoc.rng +444 -1
- data/lib/asciidoctor/iso/isostandard.rng +10 -1
- data/lib/asciidoctor/iso/reqt.rng +23 -0
- data/lib/asciidoctor/iso/term_lookup_cleanup.rb +7 -10
- data/lib/asciidoctor/iso/validate.rb +1 -5
- data/lib/asciidoctor/iso/validate_requirements.rb +1 -1
- data/lib/asciidoctor/iso/validate_style.rb +6 -5
- data/lib/asciidoctor/iso/validate_title.rb +1 -1
- data/lib/isodoc/iso/base_convert.rb +67 -112
- data/lib/isodoc/iso/html/header.html +5 -1
- data/lib/isodoc/iso/html/html_iso_titlepage.html +9 -0
- data/lib/isodoc/iso/html/htmlstyle.scss +0 -1
- data/lib/isodoc/iso/html/isodoc.scss +25 -1
- data/lib/isodoc/iso/html/style-human.scss +8 -1
- data/lib/isodoc/iso/html/style-iso.scss +8 -1
- data/lib/isodoc/iso/html/word_iso_intro.html +4 -0
- data/lib/isodoc/iso/html/word_iso_titlepage.html +4 -4
- data/lib/isodoc/iso/html/wordstyle.scss +20 -7
- data/lib/isodoc/iso/iso.amendment.xsl +5114 -0
- data/lib/isodoc/iso/iso.international-standard.xsl +1258 -530
- data/lib/isodoc/iso/metadata.rb +31 -27
- data/lib/isodoc/iso/pdf_convert.rb +5 -11
- data/lib/isodoc/iso/presentation_xml_convert.rb +13 -0
- data/lib/isodoc/iso/sections.rb +66 -0
- data/lib/isodoc/iso/sts_convert.rb +31 -0
- data/lib/isodoc/iso/xref.rb +111 -0
- data/lib/metanorma-iso.rb +2 -0
- data/lib/metanorma/iso/processor.rb +14 -8
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +6 -2
- data/spec/asciidoctor-iso/amd_spec.rb +412 -4
- data/spec/asciidoctor-iso/base_spec.rb +18 -16
- data/spec/asciidoctor-iso/cleanup_spec.rb +2 -2
- data/spec/asciidoctor-iso/macros_spec.rb +33 -17
- data/spec/asciidoctor-iso/refs_spec.rb +1 -1
- data/spec/asciidoctor-iso/table_spec.rb +1 -1
- data/spec/isodoc/amd_spec.rb +652 -0
- data/spec/isodoc/blocks_spec.rb +112 -27
- data/spec/isodoc/inline_spec.rb +2 -2
- data/spec/isodoc/metadata_spec.rb +88 -4
- data/spec/isodoc/postproc_spec.rb +9 -9
- data/spec/isodoc/ref_spec.rb +6 -6
- data/spec/isodoc/section_spec.rb +28 -1
- data/spec/isodoc/table_spec.rb +8 -8
- data/spec/isodoc/terms_spec.rb +4 -4
- data/spec/isodoc/xref_spec.rb +24 -18
- data/spec/metanorma/processor_spec.rb +2 -2
- metadata +73 -11
data/lib/isodoc/iso/metadata.rb
CHANGED
@@ -6,14 +6,14 @@ module IsoDoc
|
|
6
6
|
def initialize(lang, script, labels)
|
7
7
|
super
|
8
8
|
@metadata = {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
tc: "XXXX",
|
10
|
+
sc: "XXXX",
|
11
|
+
wg: "XXXX",
|
12
|
+
editorialgroup: [],
|
13
|
+
secretariat: "XXXX",
|
14
|
+
obsoletes: nil,
|
15
|
+
obsoletes_part: nil
|
16
|
+
}
|
17
17
|
end
|
18
18
|
|
19
19
|
def status_abbrev(stage, substage, iter, draft, doctype)
|
@@ -22,7 +22,9 @@ module IsoDoc
|
|
22
22
|
stage = "DTS" if stage == "DIS"
|
23
23
|
stage = "FDTS" if stage == "FDIS"
|
24
24
|
end
|
25
|
-
|
25
|
+
if %w(PWI NWIP WD CD).include?(stage)
|
26
|
+
stage += iter if iter
|
27
|
+
end
|
26
28
|
stage = "Pre" + stage if draft =~ /^0\./
|
27
29
|
stage
|
28
30
|
end
|
@@ -51,7 +53,7 @@ module IsoDoc
|
|
51
53
|
end
|
52
54
|
|
53
55
|
def docid(isoxml, _out)
|
54
|
-
dn = isoxml.at(ns("//bibdata/docidentifier[@type = '
|
56
|
+
dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'ISO']"))
|
55
57
|
set(:docnumber, dn&.text)
|
56
58
|
tcdn = isoxml.xpath(ns("//bibdata/docidentifier[@type = 'iso-tc']"))
|
57
59
|
set(:tc_docnumber, tcdn.map { |n| n.text })
|
@@ -116,15 +118,23 @@ module IsoDoc
|
|
116
118
|
main
|
117
119
|
end
|
118
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
|
+
|
119
135
|
def title(isoxml, _out)
|
120
|
-
intro = isoxml
|
121
|
-
|
122
|
-
part = isoxml.at(ns("//bibdata//title[@type='title-part' and @language='en']"))
|
123
|
-
partnumber = isoxml.at(ns("//bibdata//project-number/@part"))
|
124
|
-
subpartnumber = isoxml.at(ns("//bibdata//project-number/@subpart"))
|
125
|
-
amdnumber = isoxml.at(ns("//bibdata//project-number/@amendment"))
|
126
|
-
corrnumber = isoxml.at(ns("//bibdata//project-number/@corrigendum"))
|
127
|
-
amd = isoxml.at(ns("//bibdata//title[@type='title-amd' and @language='en']"))
|
136
|
+
intro, main, part, amd = title_parts(isoxml, "en")
|
137
|
+
partnumber, subpartnumber, amdnumber, corrnumber = title_nums(isoxml)
|
128
138
|
|
129
139
|
set(:doctitlemain, @c.encode(main ? main.text : "", :hexadecimal))
|
130
140
|
main = compose_title(main, intro, part, partnumber, subpartnumber, "en")
|
@@ -138,14 +148,8 @@ module IsoDoc
|
|
138
148
|
end
|
139
149
|
|
140
150
|
def subtitle(isoxml, _out)
|
141
|
-
intro = isoxml
|
142
|
-
|
143
|
-
part = isoxml.at(ns("//bibdata//title[@type='title-part' and @language='fr']"))
|
144
|
-
partnumber = isoxml.at(ns("//bibdata//project-number/@part"))
|
145
|
-
subpartnumber = isoxml.at(ns("//bibdata//project-number/@subpart"))
|
146
|
-
amdnumber = isoxml.at(ns("//bibdata//project-number/@amendment"))
|
147
|
-
corrnumber = isoxml.at(ns("//bibdata//project-number/@corrigendum"))
|
148
|
-
amd = isoxml.at(ns("//bibdata//title[@type='title-amd' and @language='fr']"))
|
151
|
+
intro, main, part, amd = title_parts(isoxml, "fr")
|
152
|
+
partnumber, subpartnumber, amdnumber, corrnumber = title_nums(isoxml)
|
149
153
|
|
150
154
|
set(:docsubtitlemain, @c.encode(main ? main.text : "", :hexadecimal))
|
151
155
|
main = compose_title(main, intro, part, partnumber, subpartnumber, "fr")
|
@@ -206,7 +210,7 @@ module IsoDoc
|
|
206
210
|
super
|
207
211
|
ics = []
|
208
212
|
isoxml.xpath(ns("//bibdata/ext/ics/code")).each { |i| ics << i.text }
|
209
|
-
set(:ics, ics.empty? ?
|
213
|
+
set(:ics, ics.empty? ? nil : ics.join(", "))
|
210
214
|
end
|
211
215
|
end
|
212
216
|
end
|
@@ -13,18 +13,12 @@ module IsoDoc
|
|
13
13
|
super
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
f.write file
|
22
|
-
f.path
|
16
|
+
def pdf_stylesheet(docxml)
|
17
|
+
case doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
|
18
|
+
when "amendment", "technical-corrigendum" then "iso.amendment.xsl"
|
19
|
+
else
|
20
|
+
"iso.international-standard.xsl"
|
23
21
|
end
|
24
|
-
FileUtils.rm_rf dir
|
25
|
-
::Metanorma::Output::XslfoPdf.new.convert(
|
26
|
-
filename, outname_html + ".pdf",
|
27
|
-
File.join(@libdir, "iso.international-standard.xsl"))
|
28
22
|
end
|
29
23
|
end
|
30
24
|
end
|
@@ -0,0 +1,13 @@
|
|
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 PresentationXMLConvert < IsoDoc::PresentationXMLConvert
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -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(isoxml) and @suppressheadingnumbers = @oldsuppressheadingnumbers
|
34
|
+
super
|
35
|
+
amd(isoxml) 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,31 @@
|
|
1
|
+
require "isodoc"
|
2
|
+
require "mn2sts"
|
3
|
+
|
4
|
+
module IsoDoc
|
5
|
+
module Iso
|
6
|
+
|
7
|
+
# A {Converter} implementation that generates HTML output, and a document
|
8
|
+
# schema encapsulation of the document for validation
|
9
|
+
#
|
10
|
+
class StsConvert < IsoDoc::XslfoPdfConvert
|
11
|
+
def initialize(options)
|
12
|
+
@libdir = File.dirname(__FILE__)
|
13
|
+
@format = :sts
|
14
|
+
@suffix = "sts.xml"
|
15
|
+
end
|
16
|
+
|
17
|
+
def convert(input_filename, file = nil, debug = false, output_filename = nil)
|
18
|
+
file = File.read(input_filename, encoding: "utf-8") if file.nil?
|
19
|
+
docxml, filename, dir = convert_init(file, input_filename, debug)
|
20
|
+
/\.xml$/.match(input_filename) or
|
21
|
+
input_filename = Tempfile.open([filename, ".xml"], encoding: "utf-8") do |f|
|
22
|
+
f.write file
|
23
|
+
f.path
|
24
|
+
end
|
25
|
+
FileUtils.rm_rf dir
|
26
|
+
Mn2sts.convert(input_filename, output_filename || "#{filename}.#{@suffix}")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,111 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module Iso
|
3
|
+
class Xref < IsoDoc::Xref
|
4
|
+
def parse(docxml)
|
5
|
+
if @klass.amd(docxml)
|
6
|
+
back_anchor_names(docxml)
|
7
|
+
note_anchor_names(docxml.xpath(ns("//annex//table | //annex//figure")))
|
8
|
+
note_anchor_names(docxml.xpath(ns("//annex")))
|
9
|
+
example_anchor_names(docxml.xpath(ns("//annex")))
|
10
|
+
list_anchor_names(docxml.xpath(ns("//annex")))
|
11
|
+
else
|
12
|
+
super
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def initial_anchor_names(d)
|
17
|
+
super
|
18
|
+
introduction_names(d.at(ns("//introduction")))
|
19
|
+
end
|
20
|
+
|
21
|
+
# we can reference 0-number clauses in introduction
|
22
|
+
def introduction_names(clause)
|
23
|
+
return if clause.nil?
|
24
|
+
clause.xpath(ns("./clause")).each_with_index do |c, i|
|
25
|
+
section_names1(c, "0.#{i + 1}", 2)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def annex_names(clause, num)
|
30
|
+
appendix_names(clause, num)
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
def appendix_names(clause, num)
|
35
|
+
clause.xpath(ns("./appendix")).each_with_index do |c, i|
|
36
|
+
@anchors[c["id"]] = anchor_struct(i + 1, nil, @labels["appendix"], "clause")
|
37
|
+
@anchors[c["id"]][:level] = 2
|
38
|
+
@anchors[c["id"]][:container] = clause["id"]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def section_names1(clause, num, level)
|
43
|
+
@anchors[clause["id"]] =
|
44
|
+
{ label: num, level: level, xref: num }
|
45
|
+
# subclauses are not prefixed with "Clause"
|
46
|
+
clause.xpath(ns("./clause | ./terms | ./term | ./definitions | "\
|
47
|
+
"./references")).
|
48
|
+
each_with_index do |c, i|
|
49
|
+
section_names1(c, "#{num}.#{i + 1}", level + 1)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def annex_names1(clause, num, level)
|
54
|
+
@anchors[clause["id"]] = { label: num, xref: num, level: level }
|
55
|
+
clause.xpath(ns("./clause | ./references")).each_with_index do |c, i|
|
56
|
+
annex_names1(c, "#{num}.#{i + 1}", level + 1)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def hierarchical_formula_names(clause, num)
|
61
|
+
c = IsoDoc::XrefGen::Counter.new
|
62
|
+
clause.xpath(ns(".//formula")).each do |t|
|
63
|
+
next if t["id"].nil? || t["id"].empty?
|
64
|
+
@anchors[t["id"]] =
|
65
|
+
anchor_struct("#{num}#{hiersep}#{c.increment(t).print}", t,
|
66
|
+
t["inequality"] ? @labels["inequality"] : @labels["formula"],
|
67
|
+
"formula", t["unnumbered"])
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def figure_anchor(t, sublabel, label)
|
72
|
+
@anchors[t["id"]] = anchor_struct(
|
73
|
+
(sublabel ? "#{label} #{sublabel}" : label),
|
74
|
+
nil, @labels["figure"], "figure", t["unnumbered"])
|
75
|
+
sublabel && t["unnumbered"] != "true" and
|
76
|
+
@anchors[t["id"]][:label] = sublabel
|
77
|
+
end
|
78
|
+
|
79
|
+
def sequential_figure_names(clause)
|
80
|
+
c = IsoDoc::XrefGen::Counter.new
|
81
|
+
j = 0
|
82
|
+
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
|
83
|
+
each do |t|
|
84
|
+
j = subfigure_increment(j, c, t)
|
85
|
+
sublabel = j.zero? ? nil : "#{(j+96).chr})"
|
86
|
+
next if t["id"].nil? || t["id"].empty?
|
87
|
+
figure_anchor(t, sublabel, c.print)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def hierarchical_figure_names(clause, num)
|
92
|
+
c = IsoDoc::XrefGen::Counter.new
|
93
|
+
j = 0
|
94
|
+
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
|
95
|
+
each do |t|
|
96
|
+
j = subfigure_increment(j, c, t)
|
97
|
+
label = "#{num}#{hiersep}#{c.print}"
|
98
|
+
sublabel = j.zero? ? nil : "#{(j+96).chr})"
|
99
|
+
next if t["id"].nil? || t["id"].empty?
|
100
|
+
figure_anchor(t, sublabel, label)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def reference_names(ref)
|
105
|
+
super
|
106
|
+
@anchors[ref["id"]] = { xref: @anchors[ref["id"]][:xref].
|
107
|
+
sub(/ \(All Parts\)/i, "") }
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
data/lib/metanorma-iso.rb
CHANGED
@@ -4,6 +4,8 @@ require_relative "metanorma/iso/version"
|
|
4
4
|
require_relative "isodoc/iso/html_convert"
|
5
5
|
require_relative "isodoc/iso/word_convert"
|
6
6
|
require_relative "isodoc/iso/pdf_convert"
|
7
|
+
require_relative "isodoc/iso/sts_convert"
|
8
|
+
require_relative "isodoc/iso/presentation_xml_convert"
|
7
9
|
require "asciidoctor/extensions"
|
8
10
|
|
9
11
|
if defined? Metanorma
|
@@ -24,7 +24,8 @@ module Metanorma
|
|
24
24
|
html: "html",
|
25
25
|
html_alt: "alt.html",
|
26
26
|
doc: "doc",
|
27
|
-
pdf: "pdf"
|
27
|
+
pdf: "pdf",
|
28
|
+
sts: "sts.xml"
|
28
29
|
)
|
29
30
|
end
|
30
31
|
|
@@ -32,20 +33,25 @@ module Metanorma
|
|
32
33
|
"Metanorma::ISO #{Metanorma::ISO::VERSION}"
|
33
34
|
end
|
34
35
|
|
35
|
-
def
|
36
|
-
|
36
|
+
def use_presentation_xml(ext)
|
37
|
+
return true if ext == :html_alt
|
38
|
+
super
|
37
39
|
end
|
38
40
|
|
39
|
-
def output(isodoc_node, outname, format, options={})
|
41
|
+
def output(isodoc_node, inname, outname, format, options={})
|
40
42
|
case format
|
41
43
|
when :html
|
42
|
-
IsoDoc::Iso::HtmlConvert.new(options).convert(
|
44
|
+
IsoDoc::Iso::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
43
45
|
when :html_alt
|
44
|
-
IsoDoc::Iso::HtmlConvert.new(options.merge(alt: true)).convert(
|
46
|
+
IsoDoc::Iso::HtmlConvert.new(options.merge(alt: true)).convert(inname, isodoc_node, nil, outname)
|
45
47
|
when :doc
|
46
|
-
IsoDoc::Iso::WordConvert.new(options).convert(
|
48
|
+
IsoDoc::Iso::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
47
49
|
when :pdf
|
48
|
-
IsoDoc::Iso::PdfConvert.new(options).convert(
|
50
|
+
IsoDoc::Iso::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
51
|
+
when :sts
|
52
|
+
IsoDoc::Iso::StsConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
53
|
+
when :presentation
|
54
|
+
IsoDoc::Iso::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
49
55
|
else
|
50
56
|
super
|
51
57
|
end
|
data/metanorma-iso.gemspec
CHANGED
@@ -30,10 +30,14 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
31
31
|
|
32
32
|
spec.add_dependency "ruby-jing"
|
33
|
-
spec.add_dependency "isodoc", "~> 1.
|
34
|
-
spec.add_dependency "metanorma-standoc", "~> 1.
|
33
|
+
spec.add_dependency "isodoc", "~> 1.1.0"
|
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"
|
40
|
+
spec.add_development_dependency "sassc", "2.4.0"
|
37
41
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
38
42
|
spec.add_development_dependency "guard", "~> 2.14"
|
39
43
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
@@ -241,9 +241,9 @@ OUTPUT
|
|
241
241
|
d’échantillon et recommandations relatives aux conditions d’entreposage et
|
242
242
|
de transport
|
243
243
|
</title>
|
244
|
-
<docidentifier type='
|
245
|
-
<docidentifier type='iso-with-lang'>ISO
|
246
|
-
<docidentifier type='iso-reference'>ISO
|
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
247
|
<docnumber>17301</docnumber>
|
248
248
|
<date type='created'>
|
249
249
|
<on>2016-05-01</on>
|
@@ -270,7 +270,7 @@ OUTPUT
|
|
270
270
|
<language>en</language>
|
271
271
|
<script>Latn</script>
|
272
272
|
<status>
|
273
|
-
<stage abbreviation='
|
273
|
+
<stage abbreviation='NP'>10</stage>
|
274
274
|
<substage>20</substage>
|
275
275
|
<iteration>3</iteration>
|
276
276
|
</status>
|
@@ -315,4 +315,412 @@ OUTPUT
|
|
315
315
|
OUTPUT
|
316
316
|
end
|
317
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
|
+
|
318
726
|
end
|