metanorma-iso 2.1.5 → 2.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +3 -1
- data/.github/workflows/release.yml +24 -0
- data/lib/isodoc/iso/html/html_iso_titlepage.html +2 -2
- data/lib/isodoc/iso/html/style-human.scss +39 -1
- data/lib/isodoc/iso/html/style-iso.scss +40 -1
- data/lib/isodoc/iso/i18n-en.yaml +4 -0
- data/lib/isodoc/iso/i18n-fr.yaml +5 -0
- data/lib/isodoc/iso/i18n-ru.yaml +4 -0
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +5 -0
- data/lib/isodoc/iso/init.rb +4 -0
- data/lib/isodoc/iso/iso.amendment.xsl +3698 -3060
- data/lib/isodoc/iso/iso.international-standard.xsl +3698 -3060
- data/lib/isodoc/iso/presentation_xml_convert.rb +22 -6
- data/lib/isodoc/iso/word_cleanup.rb +10 -13
- data/lib/isodoc/iso/word_dis_convert.rb +1 -1
- data/lib/isodoc/iso/xref.rb +35 -4
- data/lib/metanorma/iso/base.rb +4 -0
- data/lib/metanorma/iso/biblio.rng +8 -5
- data/lib/metanorma/iso/boilerplate-fr.xml +1 -1
- data/lib/metanorma/iso/boilerplate-ru.xml +1 -1
- data/lib/metanorma/iso/boilerplate.xml +1 -1
- data/lib/metanorma/iso/cleanup.rb +5 -1
- data/lib/metanorma/iso/front_id.rb +64 -11
- data/lib/metanorma/iso/isodoc.rng +6 -1
- data/lib/metanorma/iso/reqt.rng +1 -1
- data/lib/metanorma/iso/section.rb +5 -0
- data/lib/metanorma/iso/validate.rb +3 -2
- data/lib/metanorma/iso/version.rb +1 -1
- data/lib/metanorma/requirements/modspec.rb +60 -0
- data/lib/metanorma/requirements/requirements.rb +16 -0
- data/lib/metanorma-iso.rb +2 -1
- data/metanorma-iso.gemspec +2 -1
- data/spec/assets/iso.adoc +10 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig1a.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig1b.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig2.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig3.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig4.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig5_f.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figA.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figA1.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figA2.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figTab1.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figTab2.png +0 -0
- data/spec/examples/rice_img/1001_ed2amd3fig1.png +0 -0
- data/spec/examples/rice_img/ISO_1213_1.png +0 -0
- data/spec/examples/rice_img/SL1000-1_ed2amd3fig1.png +0 -0
- data/spec/isodoc/postproc_spec.rb +6 -13
- data/spec/isodoc/ref_spec.rb +129 -82
- data/spec/isodoc/word_dis_spec.rb +9 -13
- data/spec/metanorma/amd_spec.rb +0 -10
- data/spec/metanorma/base_spec.rb +13 -24
- data/spec/metanorma/cleanup_spec.rb +136 -0
- data/spec/metanorma/macros_spec.rb +99 -0
- data/spec/metanorma/processor_spec.rb +86 -87
- data/spec/metanorma/section_spec.rb +2 -2
- data/spec/metanorma/validate_spec.rb +41 -40
- data/spec/requirements/requirements_spec.rb +1299 -0
- data/spec/requirements/xref_spec.rb +1205 -0
- data/spec/vcr_cassettes/docrels.yml +385 -0
- data/spec/vcr_cassettes/withdrawn_iso.yml +19 -19
- metadata +44 -15
- data/lib/isodoc/iso/html/htmlstyle.css +0 -47
- data/lib/isodoc/iso/html/isodoc-dis.css +0 -4493
- data/lib/isodoc/iso/html/isodoc.css +0 -1346
- data/lib/isodoc/iso/html/style-human.css +0 -1027
- data/lib/isodoc/iso/html/style-iso.css +0 -1053
- data/lib/isodoc/iso/html/wordstyle-dis.css +0 -2280
- data/lib/isodoc/iso/html/wordstyle.css +0 -1728
@@ -17,6 +17,24 @@ module IsoDoc
|
|
17
17
|
super
|
18
18
|
end
|
19
19
|
|
20
|
+
def block(docxml)
|
21
|
+
amend docxml
|
22
|
+
figure docxml
|
23
|
+
sourcecode docxml
|
24
|
+
formula docxml
|
25
|
+
admonition docxml
|
26
|
+
ol docxml
|
27
|
+
permission docxml
|
28
|
+
requirement docxml
|
29
|
+
recommendation docxml
|
30
|
+
requirement_render docxml
|
31
|
+
@xrefs.anchors_previous = @xrefs.anchors.dup # store old xrefs of reqts
|
32
|
+
@xrefs.parse docxml
|
33
|
+
table docxml # have table include requirements newly converted to tables
|
34
|
+
example docxml
|
35
|
+
note docxml
|
36
|
+
end
|
37
|
+
|
20
38
|
def annex(isoxml)
|
21
39
|
amd(isoxml) and @suppressheadingnumbers = @oldsuppressheadingnumbers
|
22
40
|
super
|
@@ -178,12 +196,10 @@ module IsoDoc
|
|
178
196
|
i18nhash: @i18n.get)
|
179
197
|
end
|
180
198
|
|
181
|
-
def
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
"#{xml.xpath(ns('./docidentifier | ./uri | ./note')).to_xml}"
|
186
|
-
end
|
199
|
+
def bibrender_formattedref(formattedref, xml)
|
200
|
+
return if %w(techreport standard).include? xml["type"]
|
201
|
+
|
202
|
+
super
|
187
203
|
end
|
188
204
|
|
189
205
|
def ol_depth(node)
|
@@ -84,27 +84,24 @@ module IsoDoc
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def authority_hdr_cleanup(docxml)
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
87
|
+
{ "boilerplate-license": "zzWarningHdr",
|
88
|
+
"boilerplate-copyright": "zzCopyrightHdr" }.each do |k, v|
|
89
|
+
docxml.xpath("//div[@class = '#{k}']").each do |d|
|
90
|
+
d.xpath(".//h1").each do |p|
|
91
|
+
p.name = "p"
|
92
|
+
p["class"] = v
|
93
|
+
end
|
94
|
+
end
|
91
95
|
end
|
92
|
-
end
|
93
|
-
docxml&.xpath("//div[@class = 'boilerplate-copyright']")&.each do |d|
|
94
|
-
d.xpath(".//h1").each do |p|
|
95
|
-
p.name = "p"
|
96
|
-
p["class"] = "zzCopyrightHdr"
|
97
|
-
end
|
98
|
-
end
|
99
96
|
end
|
100
97
|
|
101
98
|
def authority_cleanup(docxml)
|
102
99
|
insert = docxml.at("//div[@id = 'boilerplate-license-destination']")
|
103
|
-
auth = docxml
|
100
|
+
auth = docxml.at("//div[@class = 'boilerplate-license']")&.remove
|
104
101
|
auth&.xpath(".//p[not(@class)]")&.each { |p| p["class"] = "zzWarning" }
|
105
102
|
auth and insert and insert.children = auth
|
106
103
|
insert = docxml.at("//div[@id = 'boilerplate-copyright-destination']")
|
107
|
-
auth = docxml
|
104
|
+
auth = docxml.at("//div[@class = 'boilerplate-copyright']")&.remove
|
108
105
|
auth&.xpath(".//p[not(@class)]")&.each do |p|
|
109
106
|
p["class"] = "zzCopyright"
|
110
107
|
end
|
@@ -98,7 +98,7 @@ module IsoDoc
|
|
98
98
|
@meta.get[:doctitlemain] && @meta.get[:doctitlepart] and p << " — "
|
99
99
|
if @meta.get[:doctitlepart]
|
100
100
|
b = @meta.get[:doctitlepartlabel] and
|
101
|
-
p << "<span style='font-weight:normal'>#{b}
|
101
|
+
p << "<span style='font-weight:normal'>#{b}:</span> "
|
102
102
|
p << " #{@meta.get[:doctitlepart]}"
|
103
103
|
end
|
104
104
|
@meta.get[:doctitleamdlabel] || @meta.get[:doctitleamd] ||
|
data/lib/isodoc/iso/xref.rb
CHANGED
@@ -4,11 +4,11 @@ module IsoDoc
|
|
4
4
|
end
|
5
5
|
|
6
6
|
class Xref < IsoDoc::Xref
|
7
|
+
attr_accessor :anchors_previous, :anchors
|
8
|
+
|
7
9
|
def initial_anchor_names(doc)
|
8
|
-
if @klass.amd(doc)
|
9
|
-
|
10
|
-
else
|
11
|
-
initial_anchor_names1(doc)
|
10
|
+
if @klass.amd(doc) then initial_anchor_names_amd(doc)
|
11
|
+
else initial_anchor_names1(doc)
|
12
12
|
end
|
13
13
|
if @parse_settings.empty? || @parse_settings[:clauses]
|
14
14
|
introduction_names(doc.at(ns("//introduction")))
|
@@ -217,6 +217,37 @@ module IsoDoc
|
|
217
217
|
end
|
218
218
|
true
|
219
219
|
end
|
220
|
+
|
221
|
+
def sequential_table_names(clause)
|
222
|
+
super
|
223
|
+
modspec_table_xrefs(clause) if @anchors_previous
|
224
|
+
end
|
225
|
+
|
226
|
+
def modspec_table_xrefs(clause)
|
227
|
+
clause.xpath(ns(".//table[@class = 'modspec']")).noblank.each do |t|
|
228
|
+
(@anchors[t["id"]] && !@anchors[t["id"]][:modspec]) or next
|
229
|
+
n = @anchors[t["id"]][:xref]
|
230
|
+
@anchors[t["id"]][:modspec] = true
|
231
|
+
@anchors[t["id"]][:xref] =
|
232
|
+
l10n("#{n}, #{@anchors_previous[t['id']][:xref_bare]}")
|
233
|
+
modspec_table_components_xrefs(t, n)
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
def modspec_table_components_xrefs(table, table_label)
|
238
|
+
table.xpath(ns(".//tr[@id]")).each do |tr|
|
239
|
+
(@anchors[tr["id"]] && !@anchors[tr["id"]][:modspec]) or next
|
240
|
+
@anchors[tr["id"]][:modspec] = true
|
241
|
+
@anchors[tr["id"]][:xref] =
|
242
|
+
l10n("#{table_label}, #{@anchors_previous[tr['id']][:xref]}")
|
243
|
+
@anchors[tr["id"]].delete(:container)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
def hierarchical_table_names(clause, _num)
|
248
|
+
super
|
249
|
+
modspec_table_xrefs(clause) if @anchors_previous
|
250
|
+
end
|
220
251
|
end
|
221
252
|
end
|
222
253
|
end
|
data/lib/metanorma/iso/base.rb
CHANGED
@@ -12,6 +12,10 @@ module Metanorma
|
|
12
12
|
XML_ROOT_TAG = "iso-standard".freeze
|
13
13
|
XML_NAMESPACE = "https://www.metanorma.org/ns/iso".freeze
|
14
14
|
|
15
|
+
def requirements_processor
|
16
|
+
::Metanorma::Requirements::Iso
|
17
|
+
end
|
18
|
+
|
15
19
|
def html_converter(node)
|
16
20
|
IsoDoc::Iso::HtmlConvert.new(html_extract_attributes(node))
|
17
21
|
end
|
@@ -225,9 +225,9 @@
|
|
225
225
|
<zeroOrMore>
|
226
226
|
<ref name="forename"/>
|
227
227
|
</zeroOrMore>
|
228
|
-
<
|
229
|
-
<ref name="
|
230
|
-
</
|
228
|
+
<optional>
|
229
|
+
<ref name="formatted-initials"/>
|
230
|
+
</optional>
|
231
231
|
<ref name="surname"/>
|
232
232
|
<zeroOrMore>
|
233
233
|
<ref name="addition"/>
|
@@ -247,8 +247,8 @@
|
|
247
247
|
<ref name="LocalizedString"/>
|
248
248
|
</element>
|
249
249
|
</define>
|
250
|
-
<define name="
|
251
|
-
<element name="
|
250
|
+
<define name="formatted-initials">
|
251
|
+
<element name="formatted-initials">
|
252
252
|
<ref name="LocalizedString"/>
|
253
253
|
</element>
|
254
254
|
</define>
|
@@ -264,6 +264,9 @@
|
|
264
264
|
</define>
|
265
265
|
<define name="forename">
|
266
266
|
<element name="forename">
|
267
|
+
<optional>
|
268
|
+
<attribute name="initial"/>
|
269
|
+
</optional>
|
267
270
|
<ref name="LocalizedString"/>
|
268
271
|
</element>
|
269
272
|
</define>
|
@@ -19,7 +19,7 @@ l’adresse ci-après ou au comité membre de l’ISO dans le pays du demandeur.
|
|
19
19
|
ISO copyright office<br/>
|
20
20
|
CP 401 • Ch. de Blandonnet 8<br/>
|
21
21
|
CH-1214 Vernier, Geneva<br/>
|
22
|
-
Tél
|
22
|
+
Tél: +41 22 749 01 11<br/>
|
23
23
|
Email: copyright@iso.org<br/>
|
24
24
|
Website: www.iso.org
|
25
25
|
</p>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
Бюро ISO по охране авторских прав<br/>
|
15
15
|
CP 401 • Ch. de Blandonnet 8<br/>
|
16
16
|
CH-1214 Vernier, Geneva<br/>
|
17
|
-
|
17
|
+
Тел: +41 22 749 01 11<br/>
|
18
18
|
Электронная почта: copyright@iso.org<br/>
|
19
19
|
Сайт: www.iso.org
|
20
20
|
</p>
|
@@ -20,7 +20,7 @@ at the address below or ISO's member body in the country of the requester.
|
|
20
20
|
ISO copyright office<br/>
|
21
21
|
CP 401 • Ch. de Blandonnet 8<br/>
|
22
22
|
CH-1214 Vernier, Geneva<br/>
|
23
|
-
Phone
|
23
|
+
Phone: +41 22 749 01 11<br/>
|
24
24
|
Email: copyright@iso.org<br/>
|
25
25
|
Website: www.iso.org
|
26
26
|
</p>
|
@@ -88,7 +88,6 @@ module Metanorma
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
# TODO sort by authors
|
92
91
|
# sort by: doc class (ISO, IEC, other standard (not DOI &c), other
|
93
92
|
# then standard class (docid class other than DOI &c)
|
94
93
|
# then docnumber if present, numeric sort
|
@@ -205,6 +204,11 @@ module Metanorma
|
|
205
204
|
super
|
206
205
|
end
|
207
206
|
|
207
|
+
def term_children_cleanup(xmldoc)
|
208
|
+
@vocab and return
|
209
|
+
super
|
210
|
+
end
|
211
|
+
|
208
212
|
def bibdata_cleanup(xmldoc)
|
209
213
|
super
|
210
214
|
approval_groups_rename(xmldoc)
|
@@ -5,6 +5,7 @@ require "json"
|
|
5
5
|
require "pathname"
|
6
6
|
require "open-uri"
|
7
7
|
require "twitter_cldr"
|
8
|
+
require "pubid-iso"
|
8
9
|
|
9
10
|
module Metanorma
|
10
11
|
module ISO
|
@@ -72,7 +73,6 @@ module Metanorma
|
|
72
73
|
def iso_id(node, xml)
|
73
74
|
(!@amd && node.attr("docnumber")) || (@amd && node.attr("updates")) or
|
74
75
|
return
|
75
|
-
|
76
76
|
dn = id_stage_prefix(iso_id1(node), node)
|
77
77
|
dns = [id_year(dn, node, mode: :default),
|
78
78
|
id_year(dn, node, mode: :force),
|
@@ -89,6 +89,69 @@ module Metanorma
|
|
89
89
|
**attr_code(type: "iso-reference"))
|
90
90
|
end
|
91
91
|
|
92
|
+
def get_typeabbr(node, amd: false)
|
93
|
+
case doctype(node)
|
94
|
+
when "directive" then "DIR "
|
95
|
+
when "technical-report" then "TR "
|
96
|
+
when "technical-specification" then "TS "
|
97
|
+
when "amendment" then (amd ? "Amd " : "")
|
98
|
+
when "technical-corrigendum" then (amd ? "Cor " : "")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
=begin
|
103
|
+
def get_typeabbr(node, amd: false)
|
104
|
+
case doctype(node)
|
105
|
+
when "directive" then "DIR"
|
106
|
+
when "technical-report" then "TR"
|
107
|
+
when "technical-specification" then "TS"
|
108
|
+
else nil
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def iso_id(node, xml)
|
113
|
+
(!@amd && node.attr("docnumber")) || (@amd && node.attr("updates")) or
|
114
|
+
return
|
115
|
+
stage = id_stage_abbr(get_stage(node), get_substage(node), node, true)&.strip
|
116
|
+
stage = nil if %w{IS (Review) (Withdrwal)}.include?(stage.strip)
|
117
|
+
urn_stage = "#{get_stage(node)}.#{get_substage(node)}"
|
118
|
+
pub = (node.attr("publisher") || "ISO").split(/[;,]/)
|
119
|
+
params = {
|
120
|
+
number: node.attr("docnumber"), # (@amd ? node.attr("updates") : node.attr("docnumber")),
|
121
|
+
part: node.attr("partnumber"),
|
122
|
+
language: node.attr("language") || "en",
|
123
|
+
type: get_typeabbr(node),
|
124
|
+
year: node.attr("copyright-year") || node.attr("updated-date")&.sub(/-.*$/, ""),
|
125
|
+
publisher: pub[0],
|
126
|
+
copublisher: pub[1..-1],
|
127
|
+
}.compact
|
128
|
+
if a = node.attr("amendment-number")
|
129
|
+
params[:amendments] = { number: a, stage: stage }
|
130
|
+
elsif a = node.attr("corrigendum-number")
|
131
|
+
params[:corrigendums] = { number: a, stage: stage }
|
132
|
+
else
|
133
|
+
params.merge!( { stage: stage, urn_stage: urn_stage }.compact )
|
134
|
+
end
|
135
|
+
iso_id_out(xml, params)
|
136
|
+
end
|
137
|
+
|
138
|
+
def iso_id_out(xml, params)
|
139
|
+
params_nolang = params.dup.tap { |hs| hs.delete(:language) }
|
140
|
+
unpub = /^[0-5]/.match?(params[:urn_stage])
|
141
|
+
params1 = unpub ? params_nolang.dup.tap { |hs| hs.delete(:year) } : params_nolang
|
142
|
+
xml.docidentifier Pubid::Iso::Identifier.new(**params1), **attr_code(type: "ISO")
|
143
|
+
params2 = params_nolang.dup.tap { |hs| hs.delete(:year) }
|
144
|
+
xml.docidentifier Pubid::Iso::Identifier.new(**params2), **attr_code(type: "iso-undated")
|
145
|
+
params1 = unpub ? params.dup.tap { |hs| hs.delete(:year) } : params
|
146
|
+
xml.docidentifier(Pubid::Iso::Identifier.new(**params1),
|
147
|
+
**attr_code(type: "iso-with-lang"))
|
148
|
+
warn params
|
149
|
+
warn "Generated: #{Pubid::Iso::Identifier.new(**params).to_s}"
|
150
|
+
xml.docidentifier(Pubid::Iso::Identifier.new(**params),
|
151
|
+
**attr_code(type: "iso-reference"))
|
152
|
+
end
|
153
|
+
=end
|
154
|
+
|
92
155
|
def iso_id1(node)
|
93
156
|
if @amd
|
94
157
|
dn = node.attr("updates")
|
@@ -231,16 +294,6 @@ module Metanorma
|
|
231
294
|
ret = (stage == "60" ? "60" : "00") if ret.nil? || ret.empty?
|
232
295
|
ret
|
233
296
|
end
|
234
|
-
|
235
|
-
def get_typeabbr(node, amd: false)
|
236
|
-
case doctype(node)
|
237
|
-
when "directive" then "DIR "
|
238
|
-
when "technical-report" then "TR "
|
239
|
-
when "technical-specification" then "TS "
|
240
|
-
when "amendment" then (amd ? "Amd " : "")
|
241
|
-
when "technical-corrigendum" then (amd ? "Cor " : "")
|
242
|
-
end
|
243
|
-
end
|
244
297
|
end
|
245
298
|
end
|
246
299
|
end
|
@@ -1285,7 +1285,12 @@
|
|
1285
1285
|
</define>
|
1286
1286
|
<define name="span">
|
1287
1287
|
<element name="span">
|
1288
|
-
<
|
1288
|
+
<optional>
|
1289
|
+
<attribute name="class"/>
|
1290
|
+
</optional>
|
1291
|
+
<optional>
|
1292
|
+
<attribute name="style"/>
|
1293
|
+
</optional>
|
1289
1294
|
<oneOrMore>
|
1290
1295
|
<ref name="TextElement"/>
|
1291
1296
|
</oneOrMore>
|
data/lib/metanorma/iso/reqt.rng
CHANGED
@@ -90,11 +90,12 @@ module Metanorma
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def term_xrefs_validate1(xref, termids)
|
93
|
-
|
93
|
+
closest_id = xref.xpath("./ancestor::*[@id]")&.last or return
|
94
|
+
(termids[xref["target"]] && !termids[closest_id["id"]]) and
|
94
95
|
@log.add("Style", xref,
|
95
96
|
"only terms clauses can cross-reference terms clause "\
|
96
97
|
"(#{xref['target']})")
|
97
|
-
(!termids[xref["target"]] && termids[
|
98
|
+
(!termids[xref["target"]] && termids[closest_id["id"]]) and
|
98
99
|
@log.add("Style", xref,
|
99
100
|
"non-terms clauses cannot cross-reference terms clause "\
|
100
101
|
"(#{xref['target']})")
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Metanorma
|
2
|
+
class Requirements
|
3
|
+
class Modspec
|
4
|
+
# Don't want to inherit from Metanorma::Requirements::Modspec
|
5
|
+
class Iso < ::Metanorma::Requirements::Modspec
|
6
|
+
def recommendation_label(elem, type, xrefs)
|
7
|
+
lbl = super
|
8
|
+
title = elem.at(ns("./title"))
|
9
|
+
return lbl unless title # &&
|
10
|
+
|
11
|
+
# elem.ancestors("requirement, recommendation, permission").empty?
|
12
|
+
|
13
|
+
lbl += l10n(": ") if lbl
|
14
|
+
lbl += title.children.to_xml
|
15
|
+
lbl
|
16
|
+
end
|
17
|
+
|
18
|
+
# ISO labels modspec reqt as table, with reqt label as title
|
19
|
+
def recommendation_header(reqt, out)
|
20
|
+
n = reqt.at(ns("./name")) and out << n
|
21
|
+
out
|
22
|
+
end
|
23
|
+
|
24
|
+
def recommend_title(node, out)
|
25
|
+
label = node.at(ns("./identifier")) or return
|
26
|
+
out.add_child("<tr><td>#{@labels['modspec']['identifier']}</td>"\
|
27
|
+
"<td><tt>#{label.children.to_xml}</tt></td>")
|
28
|
+
end
|
29
|
+
|
30
|
+
def requirement_component_parse(node, out)
|
31
|
+
if node["exclude"] != "true" && node.name == "description"
|
32
|
+
lbl = "statement"
|
33
|
+
lbl = "declaration" if recommend_class(node) == "recommendclass"
|
34
|
+
out << "<tr><td>#{@labels['modspec'][lbl]}</td>"\
|
35
|
+
"<td>#{node.children.to_xml}</td></tr>"
|
36
|
+
else
|
37
|
+
super
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def requirement_table_cleanup(table)
|
42
|
+
return table unless table["type"] == "recommendclass"
|
43
|
+
|
44
|
+
ins = table.at(ns("./tbody/tr[td/table]")) or return table
|
45
|
+
ins.replace("<tr><td>#{@labels['modspec']['provisions']}</td>" +
|
46
|
+
"<td>#{nested_tables_names(table)}</td></tr>")
|
47
|
+
table.xpath(ns("./tbody/tr[td/table]")).each(&:remove)
|
48
|
+
table
|
49
|
+
end
|
50
|
+
|
51
|
+
def nested_tables_names(table)
|
52
|
+
table.xpath(ns("./tbody/tr/td/table"))
|
53
|
+
.each_with_object([]) do |t, m|
|
54
|
+
m << t.at(ns("./name")).children.to_xml
|
55
|
+
end.join("<br/>")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "mn-requirements"
|
2
|
+
require_relative "modspec"
|
3
|
+
|
4
|
+
module Metanorma
|
5
|
+
class Requirements
|
6
|
+
class Iso < ::Metanorma::Requirements
|
7
|
+
def create(type)
|
8
|
+
case type
|
9
|
+
when :modspec, :ogc
|
10
|
+
::Metanorma::Requirements::Modspec::Iso.new(parent: self)
|
11
|
+
else ::Metanorma::Requirements::Default.new(parent: self)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/metanorma-iso.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "asciidoctor" unless defined? Asciidoctor::Converter
|
2
2
|
require_relative "metanorma/iso/converter"
|
3
3
|
require_relative "metanorma/iso/version"
|
4
|
+
require_relative "metanorma/requirements/requirements"
|
4
5
|
require_relative "isodoc/iso/html_convert"
|
5
6
|
require_relative "isodoc/iso/word_convert"
|
6
7
|
require_relative "isodoc/iso/pdf_convert"
|
@@ -10,7 +11,7 @@ require_relative "isodoc/iso/presentation_xml_convert"
|
|
10
11
|
require_relative "html2doc/lists"
|
11
12
|
require "asciidoctor/extensions"
|
12
13
|
|
13
|
-
if defined? Metanorma
|
14
|
+
if defined? Metanorma::Registry
|
14
15
|
require_relative "metanorma/iso"
|
15
16
|
Metanorma::Registry.instance.register(Metanorma::Iso::Processor)
|
16
17
|
end
|
data/metanorma-iso.gemspec
CHANGED
@@ -29,8 +29,9 @@ 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.5.0")
|
31
31
|
|
32
|
-
spec.add_dependency "metanorma-standoc", "~> 2.
|
32
|
+
spec.add_dependency "metanorma-standoc", "~> 2.2.0"
|
33
33
|
spec.add_dependency "mnconvert", "~> 1.14"
|
34
|
+
spec.add_dependency "pubid-iso"
|
34
35
|
spec.add_dependency "ruby-jing"
|
35
36
|
spec.add_dependency "tokenizer", "~> 0.3.0"
|
36
37
|
spec.add_dependency "twitter_cldr"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
= X
|
2
|
+
A
|
3
|
+
:mn-document-class: iso
|
4
|
+
:title-main-en: Medical devices — Quality management systems — Requirements for regulatory purposes
|
5
|
+
:title-main-fr: Dispositifs médicaux — Systèmes de management de la qualité — Exigences à des fins réglementaires
|
6
|
+
|
7
|
+
== Clause 1
|
8
|
+
|
9
|
+
X
|
10
|
+
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -844,11 +844,9 @@ RSpec.describe IsoDoc do
|
|
844
844
|
<br/>
|
845
845
|
CH-1214 Vernier, Geneva, Switzerland
|
846
846
|
<br/>
|
847
|
-
|
847
|
+
Phone: +41 22 749 01 11
|
848
848
|
<br/>
|
849
|
-
|
850
|
-
<br/>
|
851
|
-
copyright@iso.org
|
849
|
+
Email: copyright@iso.org
|
852
850
|
<br/>
|
853
851
|
www.iso.org</p>
|
854
852
|
</clause>
|
@@ -891,11 +889,9 @@ RSpec.describe IsoDoc do
|
|
891
889
|
<br/>
|
892
890
|
CH-1214 Vernier, Geneva, Switzerland
|
893
891
|
<br/>
|
894
|
-
|
895
|
-
<br/>
|
896
|
-
Fax + 41 22 749 09 47
|
892
|
+
Phone: +41 22 749 01 11
|
897
893
|
<br/>
|
898
|
-
copyright@iso.org
|
894
|
+
Email: copyright@iso.org
|
899
895
|
<br/>
|
900
896
|
www.iso.org</p>
|
901
897
|
</clause>
|
@@ -955,13 +951,10 @@ RSpec.describe IsoDoc do
|
|
955
951
|
CH-1214 Vernier, Geneva, Switzerland
|
956
952
|
|
957
953
|
<br/>
|
958
|
-
|
959
|
-
|
960
|
-
<br/>
|
961
|
-
Fax + 41 22 749 09 47
|
954
|
+
Phone: +41 22 749 01 11
|
962
955
|
|
963
956
|
<br/>
|
964
|
-
copyright@iso.org
|
957
|
+
Email: copyright@iso.org
|
965
958
|
|
966
959
|
<br/>
|
967
960
|
www.iso.org#{' '}</p>
|