metanorma-iso 3.1.0 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +1 -1
- data/lib/isodoc/iso/i18n-de.yaml +64 -0
- data/lib/isodoc/iso/i18n-en.yaml +2 -0
- data/lib/isodoc/iso/i18n-fr.yaml +46 -11
- data/lib/isodoc/iso/i18n-ru.yaml +61 -0
- data/lib/isodoc/iso/iso.amendment.xsl +591 -364
- data/lib/isodoc/iso/iso.international-standard.xsl +591 -364
- data/lib/isodoc/iso/metadata.rb +28 -21
- data/lib/isodoc/iso/presentation_bibdata.rb +2 -0
- data/lib/isodoc/iso/xref.rb +8 -12
- data/lib/metanorma/iso/basicdoc.rng +6 -6
- data/lib/metanorma/iso/front_contributor.rb +145 -21
- data/lib/metanorma/iso/front_id.rb +1 -7
- data/lib/metanorma/iso/isodoc.rng +8 -60
- data/lib/metanorma/iso/validate_requirements.rb +34 -36
- data/lib/metanorma/iso/validate_style.rb +9 -4
- data/lib/metanorma/iso/version.rb +1 -1
- data/lib/relaton/render/config.yml +1 -1
- data/metanorma-iso.gemspec +1 -1
- metadata +3 -3
data/lib/isodoc/iso/metadata.rb
CHANGED
@@ -23,7 +23,7 @@ module IsoDoc
|
|
23
23
|
|
24
24
|
def docstatus(isoxml, _out)
|
25
25
|
docstatus = isoxml.at(ns("//bibdata/status/stage"))
|
26
|
-
|
26
|
+
published_default(isoxml)
|
27
27
|
revdate = isoxml.at(ns("//bibdata/version/revision-date"))
|
28
28
|
set(:revdate, revdate&.text)
|
29
29
|
docstatus and docstatus1(isoxml, docstatus)
|
@@ -73,7 +73,7 @@ module IsoDoc
|
|
73
73
|
|
74
74
|
def part_title(part, titlenums, lang)
|
75
75
|
part or return ""
|
76
|
-
suffix = part.children
|
76
|
+
suffix = to_xml(part.children)
|
77
77
|
p = titlenums[:part]
|
78
78
|
titlenums[:part] && titlenums[:subpart] and
|
79
79
|
p = "#{titlenums[:part]}–#{titlenums[:subpart]}"
|
@@ -102,11 +102,11 @@ module IsoDoc
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def compose_title(tparts, tnums, lang)
|
105
|
-
t = tparts[:main].nil? ? "" : tparts[:main].children
|
105
|
+
t = tparts[:main].nil? ? "" : to_xml(tparts[:main].children)
|
106
106
|
tparts[:intro] and
|
107
|
-
t = "#{tparts[:intro].children
|
107
|
+
t = "#{to_xml(tparts[:intro].children)} — #{t}"
|
108
108
|
tparts[:complementary] and
|
109
|
-
t = "#{t} — #{tparts[:complementary].children
|
109
|
+
t = "#{t} — #{to_xml(tparts[:complementary].children)}"
|
110
110
|
if tparts[:part]
|
111
111
|
suffix = part_title(tparts[:part], tnums, lang)
|
112
112
|
t = "#{t} — #{suffix}"
|
@@ -138,19 +138,19 @@ module IsoDoc
|
|
138
138
|
# intro, main, complementary, part, amd = title_parts(isoxml, lang)
|
139
139
|
tp = title_parts(isoxml, lang)
|
140
140
|
tn = title_nums(isoxml)
|
141
|
-
set(:doctitlemain, tp[:main] ? tp[:main].children
|
141
|
+
set(:doctitlemain, tp[:main] ? to_xml(tp[:main].children) : "")
|
142
142
|
main = compose_title(tp, tn, lang)
|
143
143
|
set(:doctitle, main)
|
144
|
-
tp[:intro] and set(:doctitleintro, tp[:intro].children
|
144
|
+
tp[:intro] and set(:doctitleintro, to_xml(tp[:intro].children))
|
145
145
|
tp[:complementary] and
|
146
|
-
set(:doctitlecomplementary, tp[:complementary].children
|
146
|
+
set(:doctitlecomplementary, to_xml(tp[:complementary].children))
|
147
147
|
set(:doctitlepartlabel, part_prefix(tn, lang))
|
148
|
-
set(:doctitlepart, tp[:part].children
|
148
|
+
set(:doctitlepart, to_xml(tp[:part].children)) if tp[:part]
|
149
149
|
set(:doctitleamdlabel, amd_prefix(tn, lang)) if tn[:amd]
|
150
|
-
set(:doctitleamd, tp[:amd].children
|
150
|
+
set(:doctitleamd, to_xml(tp[:amd].children)) if tp[:amd]
|
151
151
|
set(:doctitlecorrlabel, corr_prefix(tn, lang)) if tn[:corr]
|
152
152
|
set(:doctitleaddlabel, add_prefix(tn, lang)) if tn[:add]
|
153
|
-
set(:doctitleadd, tp[:add].children
|
153
|
+
set(:doctitleadd, to_xml(tp[:add].children)) if tp[:add]
|
154
154
|
end
|
155
155
|
|
156
156
|
def subtitle(isoxml, _out)
|
@@ -158,18 +158,18 @@ module IsoDoc
|
|
158
158
|
tp = title_parts(isoxml, lang)
|
159
159
|
tn = title_nums(isoxml)
|
160
160
|
|
161
|
-
set(:docsubtitlemain, tp[:main] ? tp[:main].children
|
161
|
+
set(:docsubtitlemain, tp[:main] ? to_xml(tp[:main].children) : "")
|
162
162
|
main = compose_title(tp, tn, lang)
|
163
163
|
set(:docsubtitle, main)
|
164
|
-
tp[:intro] and set(:docsubtitleintro, tp[:intro].children
|
164
|
+
tp[:intro] and set(:docsubtitleintro, to_xml(tp[:intro].children))
|
165
165
|
tp[:complementary] and
|
166
|
-
set(:docsubtitlecomplementary, tp[:complementary].children
|
166
|
+
set(:docsubtitlecomplementary, to_xml(tp[:complementary].children))
|
167
167
|
set(:docsubtitlepartlabel, part_prefix(tn, lang))
|
168
|
-
tp[:part] and set(:docsubtitlepart, tp[:part].children
|
168
|
+
tp[:part] and set(:docsubtitlepart, to_xml(tp[:part].children))
|
169
169
|
set(:docsubtitleamdlabel, amd_prefix(tn, lang)) if tn[:amd]
|
170
|
-
set(:docsubtitleamd, tp[:amd].children
|
170
|
+
set(:docsubtitleamd, to_xml(tp[:amd].children)) if tp[:amd]
|
171
171
|
set(:docsubtitleaddlabel, add_prefix(tn, lang)) if tn[:add]
|
172
|
-
set(:docsubtitleadd, tp[:add].children
|
172
|
+
set(:docsubtitleadd, to_xml(tp[:add].children)) if tp[:add]
|
173
173
|
set(:docsubtitlecorrlabel, corr_prefix(tn, lang)) if tn[:corr]
|
174
174
|
end
|
175
175
|
|
@@ -225,10 +225,17 @@ module IsoDoc
|
|
225
225
|
end
|
226
226
|
|
227
227
|
def editorialgroup(xml)
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
228
|
+
xpath = <<~XPATH
|
229
|
+
//contributor[role/@type = 'author'][role/description = 'Technical committee']/organization/subdivision/identifier[@type = 'full']
|
230
|
+
XPATH
|
231
|
+
a = xml.xpath(ns(xpath))
|
232
|
+
a.empty? or set(:editorialgroup,
|
233
|
+
connectives_strip(@i18n.boolean_conj(a.map(&:text),
|
234
|
+
"and")))
|
235
|
+
a = xml.xpath(ns(xpath.sub("author", "authorizer")))
|
236
|
+
a.empty? or set(:approvalgroup,
|
237
|
+
connectives_strip(@i18n.boolean_conj(a.map(&:text),
|
238
|
+
"and")))
|
232
239
|
end
|
233
240
|
|
234
241
|
def secretariat(xml)
|
@@ -37,6 +37,8 @@ module IsoDoc
|
|
37
37
|
bib.at(ns("./ext/doctype")))
|
38
38
|
hash_translate(bib, @i18n.get["substage_dict"],
|
39
39
|
"./status/substage", nil, @lang)
|
40
|
+
hash_translate(bib, @i18n.get["contributor_role_desc_dict"],
|
41
|
+
"./contributor/role/description", nil, @lang)
|
40
42
|
edition_translate(bib)
|
41
43
|
end
|
42
44
|
|
data/lib/isodoc/iso/xref.rb
CHANGED
@@ -48,7 +48,6 @@ module IsoDoc
|
|
48
48
|
c = IsoDoc::XrefGen::Counter.new
|
49
49
|
clause.xpath(ns(".//formula")).noblank.each do |t|
|
50
50
|
@anchors[t["id"]] = anchor_struct(
|
51
|
-
#"#{num}#{hier_separator}#{c.increment(t).print}", t,
|
52
51
|
hiersemx(clause, num, c.increment(t), t), t,
|
53
52
|
t["inequality"] ? @labels["inequality"] : @labels["formula"],
|
54
53
|
"formula", { unnumb: t["unnumbered"], container: true }
|
@@ -86,8 +85,8 @@ module IsoDoc
|
|
86
85
|
@anchors[elem["id"]][:label] = sublabel
|
87
86
|
@anchors[elem["id"]][:xref] = @anchors[elem.parent["id"]][:xref] +
|
88
87
|
" " + semx(elem, sublabel) + delim_wrap(subfigure_delim)
|
89
|
-
|
90
|
-
|
88
|
+
x = @anchors[elem.parent["id"]][:container] and
|
89
|
+
@anchors[elem["id"]][:container] = x
|
91
90
|
end
|
92
91
|
end
|
93
92
|
|
@@ -128,7 +127,6 @@ module IsoDoc
|
|
128
127
|
j = 0
|
129
128
|
clause.xpath(ns(FIGURE_NO_CLASS)).noblank.each do |t|
|
130
129
|
j = subfigure_increment(j, c, t)
|
131
|
-
#label = "#{num}#{hier_separator}#{c.print}"
|
132
130
|
sublabel = subfigure_label(j)
|
133
131
|
figure_anchor(t, sublabel, hiersemx(clause, num, c, t), "figure")
|
134
132
|
end
|
@@ -142,9 +140,9 @@ module IsoDoc
|
|
142
140
|
.noblank.each do |t|
|
143
141
|
c[t["class"]] ||= IsoDoc::XrefGen::Counter.new
|
144
142
|
j = subfigure_increment(j, c[t["class"]], t)
|
145
|
-
#label = "#{num}#{hier_separator}#{c.print}"
|
146
143
|
sublabel = j.zero? ? nil : "#{(j + 96).chr})"
|
147
|
-
figure_anchor(t, sublabel, hiersemx(clause, num, c[t["class"]], t),
|
144
|
+
figure_anchor(t, sublabel, hiersemx(clause, num, c[t["class"]], t),
|
145
|
+
t["class"])
|
148
146
|
end
|
149
147
|
end
|
150
148
|
|
@@ -160,7 +158,7 @@ module IsoDoc
|
|
160
158
|
s.xpath(ns(".//appendix//ol")) - s.xpath(ns(".//ol//ol"))
|
161
159
|
c = Counter.new
|
162
160
|
notes.noblank.each do |n|
|
163
|
-
#n["id"] ||= "_#{UUIDTools::UUID.random_create}"
|
161
|
+
# n["id"] ||= "_#{UUIDTools::UUID.random_create}"
|
164
162
|
@anchors[n["id"]] = anchor_struct(increment_label(notes, n, c), n,
|
165
163
|
@labels["list"], "list",
|
166
164
|
{ unnumb: false, container: true })
|
@@ -197,22 +195,20 @@ module IsoDoc
|
|
197
195
|
end
|
198
196
|
|
199
197
|
def modspec_table_components_xrefs(table, table_label, container: false)
|
200
|
-
table
|
198
|
+
table
|
199
|
+
.xpath(ns(".//tr[@id] | .//td[@id] | .//bookmark[@id]")).each do |tr|
|
201
200
|
xref_to_modspec(tr["id"], table_label) or next
|
202
201
|
container or @anchors[tr["id"]].delete(:container)
|
203
202
|
end
|
204
203
|
end
|
205
204
|
|
206
205
|
def xref_to_modspec(id, table_label)
|
207
|
-
#(@anchors[id] && !@anchors[id][:has_modspec]) or return
|
206
|
+
# (@anchors[id] && !@anchors[id][:has_modspec]) or return
|
208
207
|
(@anchors[id] && !@anchors[id][:has_table_prefix]) or return
|
209
208
|
@anchors[id][:has_table_prefix] = true
|
210
209
|
x = @anchors_previous[id][:xref_bare] || @anchors_previous[id][:xref]
|
211
|
-
# @anchors[id][:xref] = l10n("#{table_label}<span class='fmt-comma'>,</span> #{x}")
|
212
|
-
|
213
210
|
@anchors[id][:xref] = l10n(@klass.connectives_spans(@i18n.nested_xref
|
214
211
|
.sub("%1", table_label).sub("%2", x)))
|
215
|
-
|
216
212
|
@anchors[id][:modspec] = @anchors_previous[id][:modspec]
|
217
213
|
@anchors[id][:subtype] = "modspec" # prevents citetbl style from beign applied
|
218
214
|
true
|
@@ -198,14 +198,14 @@ Applicable to modify and delete</a:documentation>
|
|
198
198
|
</zeroOrMore>
|
199
199
|
</element>
|
200
200
|
</optional>
|
201
|
-
<
|
201
|
+
<zeroOrMore>
|
202
202
|
<element name="description">
|
203
|
-
<a:documentation>Description of the change described in this block</a:documentation>
|
204
|
-
<
|
203
|
+
<a:documentation>Description(s) of the change described in this block</a:documentation>
|
204
|
+
<oneOrMore>
|
205
205
|
<ref name="BasicBlock"/>
|
206
|
-
</
|
206
|
+
</oneOrMore>
|
207
207
|
</element>
|
208
|
-
</
|
208
|
+
</zeroOrMore>
|
209
209
|
<optional>
|
210
210
|
<element name="newcontent">
|
211
211
|
<a:documentation>New content to be added to the document; applicable to add and modify</a:documentation>
|
@@ -1291,13 +1291,13 @@ Restricted recursively to contain only other such inline elements with no identi
|
|
1291
1291
|
<ref name="pure_strike"/>
|
1292
1292
|
<ref name="pure_smallcap"/>
|
1293
1293
|
<ref name="br"/>
|
1294
|
+
<ref name="stem"/>
|
1294
1295
|
</choice>
|
1295
1296
|
</define>
|
1296
1297
|
<define name="NestedTextElement">
|
1297
1298
|
<a:documentation>Contents of TextElement tags: leaves out tags that should occur only at top level of block: bookmark image hr pagebreak</a:documentation>
|
1298
1299
|
<choice>
|
1299
1300
|
<ref name="PureTextElement"/>
|
1300
|
-
<ref name="stem"/>
|
1301
1301
|
<ref name="eref"/>
|
1302
1302
|
<ref name="xref"/>
|
1303
1303
|
<ref name="hyperlink"/>
|
@@ -1,17 +1,14 @@
|
|
1
1
|
module Metanorma
|
2
2
|
module Iso
|
3
3
|
class Converter < Standoc::Converter
|
4
|
-
# def home_agency
|
5
|
-
# "ISO"
|
6
|
-
# end
|
7
|
-
|
8
4
|
def default_publisher
|
9
5
|
"ISO"
|
10
6
|
end
|
11
7
|
|
12
8
|
def org_abbrev
|
13
9
|
{ "International Organization for Standardization" => "ISO",
|
14
|
-
"International Electrotechnical Commission" => "IEC"
|
10
|
+
"International Electrotechnical Commission" => "IEC",
|
11
|
+
"International Organization for Standardization, International Electrotechnical Commission" => "ISO/IEC" }
|
15
12
|
end
|
16
13
|
|
17
14
|
def metadata_author(node, xml)
|
@@ -22,23 +19,59 @@ module Metanorma
|
|
22
19
|
end
|
23
20
|
|
24
21
|
def org_organization(node, xml, org)
|
25
|
-
org[:committee]
|
26
|
-
contrib_committee_build(xml, org[:agency], org)
|
27
|
-
|
22
|
+
if org[:committee]
|
23
|
+
contrib_committee_build(xml, org[:agency], org)
|
24
|
+
else super
|
25
|
+
end
|
28
26
|
end
|
29
27
|
|
30
28
|
def committee_contributors(node, xml, approval, agency)
|
31
|
-
metadata_approval_committee_types(approval ? node : nil)
|
32
|
-
|
29
|
+
t = metadata_approval_committee_types(approval ? node : nil)
|
30
|
+
v = t.first
|
31
|
+
if node.attr("#{v}-number")
|
33
32
|
node.attr(v) or node.set_attr(v, "")
|
34
|
-
o =
|
35
|
-
|
36
|
-
|
33
|
+
o = committee_contrib_org_prep(node, v, approval, agency)
|
34
|
+
o[:groups] = t
|
35
|
+
o[:approval] = approval
|
37
36
|
org_contributor(node, xml, o)
|
38
37
|
end
|
39
38
|
approval or committee_contributors_approval(node, xml, agency)
|
40
39
|
end
|
41
40
|
|
41
|
+
def committee_contrib_org_prep(node, type, approval, agency)
|
42
|
+
agency_arr, agency_abbrev =
|
43
|
+
committee_org_prep_agency(node, type, agency, [], [])
|
44
|
+
{ source: [type], role: approval ? "authorizer" : "author",
|
45
|
+
default_org: false, committee: true, agency: agency_arr,
|
46
|
+
agency_abbrev:,
|
47
|
+
desc: type.sub(/^approval-/, "").tr("-", " ").capitalize }.compact
|
48
|
+
end
|
49
|
+
|
50
|
+
def committee_org_prep_agency(node, type, agency, agency_arr, agency_abbr)
|
51
|
+
i = 1
|
52
|
+
suffix = ""
|
53
|
+
while node.attr("#{type}-number#{suffix}") ||
|
54
|
+
node.attr("#{type}#{suffix}")
|
55
|
+
agency_arr << (node.attr("#{type}-agency#{suffix}") || agency)
|
56
|
+
agency_abbr << node.attr("#{type}-agency-abbr#{suffix}")
|
57
|
+
i += 1
|
58
|
+
suffix = "_#{i}"
|
59
|
+
end
|
60
|
+
[agency_arr, agency_abbr]
|
61
|
+
end
|
62
|
+
|
63
|
+
def org_attrs_complex_parse(node, opts, source)
|
64
|
+
i = 1
|
65
|
+
suffix = ""
|
66
|
+
ret = []
|
67
|
+
while node.attr("#{source}-number#{suffix}") || node.attr("#{source}#{suffix}")
|
68
|
+
ret << extract_org_attrs_complex(node, opts, source, suffix)
|
69
|
+
i += 1
|
70
|
+
suffix = "_#{i}"
|
71
|
+
end
|
72
|
+
ret
|
73
|
+
end
|
74
|
+
|
42
75
|
def committee_contributors_approval(node, xml, agency)
|
43
76
|
o = { name: agency, role: "authorizer", default_org: false,
|
44
77
|
desc: "Agency", committee: false }
|
@@ -52,13 +85,42 @@ module Metanorma
|
|
52
85
|
end
|
53
86
|
|
54
87
|
def contrib_committee_build(xml, agency, committee)
|
55
|
-
name = org_abbrev.invert[agency]
|
88
|
+
if name = org_abbrev.invert[agency]
|
89
|
+
committee[:agency_abbrev] = agency
|
90
|
+
agency = name
|
91
|
+
end
|
56
92
|
xml.name agency
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
93
|
+
s = committee
|
94
|
+
loop do
|
95
|
+
contrib_committee_subdiv(xml, s)
|
96
|
+
s = s[:subdiv] or break
|
61
97
|
end
|
98
|
+
abbr = committee[:agency_abbrev] and xml.abbreviation abbr
|
99
|
+
full_committee_id(xml.parent)
|
100
|
+
end
|
101
|
+
|
102
|
+
def contrib_committee_subdiv(xml, committee)
|
103
|
+
contributors_committees_filter_empty?(committee) and return
|
104
|
+
xml.subdivision **attr_code(type: committee[:desc]) do |o|
|
105
|
+
o.name committee[:name]
|
106
|
+
# s = committee[:subdiv] and contrib_committee_subdiv(o, s)
|
107
|
+
committee[:abbr] and o.abbreviation committee[:abbr]
|
108
|
+
committee[:ident] and o.identifier committee[:ident]
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def full_committee_id(contrib)
|
113
|
+
ret = full_committee_agency_id(contrib)
|
114
|
+
ids = contrib.xpath("./subdivision").map { |x| x.at("./identifier")&.text }
|
115
|
+
ins = contrib.at("./subdivision/identifier") and
|
116
|
+
ins.next = "<identifier type='full'>#{ret}#{ids.join('/')}</identifier>"
|
117
|
+
end
|
118
|
+
|
119
|
+
def full_committee_agency_id(contrib)
|
120
|
+
agency = contrib.at("./abbreviation")&.text
|
121
|
+
ret = agency == default_publisher ? "" : "#{agency} "
|
122
|
+
/^\s+/.match?(ret) and ret = ""
|
123
|
+
ret
|
62
124
|
end
|
63
125
|
|
64
126
|
COMMITTEE_ABBREVS =
|
@@ -66,16 +128,58 @@ module Metanorma
|
|
66
128
|
"workgroup" => "WG" }.freeze
|
67
129
|
|
68
130
|
def committee_abbrev(type, number, level)
|
131
|
+
number.nil? || number.empty? and return
|
69
132
|
type ||= COMMITTEE_ABBREVS[level.sub(/^approval-/, "")]
|
70
133
|
type == "Other" and type = ""
|
71
134
|
"#{type} #{number}".strip
|
72
135
|
end
|
73
136
|
|
74
137
|
def org_attrs_parse(node, opts)
|
75
|
-
|
76
|
-
|
138
|
+
opts_orig = opts.dup
|
139
|
+
ret = []
|
140
|
+
ret << super&.map&.with_index do |x, i|
|
141
|
+
x.merge(agency: opts.dig(:agency, i),
|
142
|
+
agency_abbrev: opts.dig(:agency_abbrev, i), abbr: opts[:abbr],
|
77
143
|
committee: opts[:committee], default_org: opts[:default_org])
|
78
144
|
end
|
145
|
+
opts_orig[:groups]&.each_with_index do |g, i|
|
146
|
+
i.zero? and next
|
147
|
+
contributors_committees_pad_multiples(ret, node, g)
|
148
|
+
opts = committee_contrib_org_prep(node, g, opts_orig[:approval], nil)
|
149
|
+
ret << super
|
150
|
+
end
|
151
|
+
#ret = contributors_committees_filter_empty(ret)
|
152
|
+
#ret.first
|
153
|
+
ret = contributors_committees_nest1(ret)
|
154
|
+
end
|
155
|
+
|
156
|
+
# ensure there is subcommittee, workgroup -number_2, -number_3 etc
|
157
|
+
# to parse mutlple tech committees
|
158
|
+
def contributors_committees_pad_multiples(committees, node, group)
|
159
|
+
committees.each_with_index do |_r, j|
|
160
|
+
suffix = j.zero? ? "" : "_#{j + 1}"
|
161
|
+
node.attr("#{group}#{suffix}") or
|
162
|
+
node.set_attr("#{group}#{suffix}", "")
|
163
|
+
node.attr("#{group}-number#{suffix}") or
|
164
|
+
node.set_attr("#{group}-number#{suffix}", "")
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def contributors_committees_filter_empty?(committee)
|
169
|
+
committee[:name].empty? &&
|
170
|
+
(committee[:ident].nil? || %w(WG TC SC).include?(committee[:ident]))
|
171
|
+
end
|
172
|
+
|
173
|
+
def contributors_committees_nest1(committees)
|
174
|
+
committees.empty? and return committees
|
175
|
+
committees = committees.reverse
|
176
|
+
committees.each_with_index do |m, i|
|
177
|
+
i.zero? and next
|
178
|
+
m.each_with_index do |m1, j|
|
179
|
+
m1[:subdiv] = committees[i - 1][j]
|
180
|
+
end
|
181
|
+
end
|
182
|
+
committees[-1]
|
79
183
|
end
|
80
184
|
|
81
185
|
def metadata_publisher(node, xml)
|
@@ -93,7 +197,10 @@ module Metanorma
|
|
93
197
|
def metadata_editorial_committee(node, xml)
|
94
198
|
xml.editorialgroup do |a|
|
95
199
|
%w(technical-committee subcommittee workgroup).each do |v|
|
96
|
-
node.attr("#{v}-number")
|
200
|
+
val = node.attr("#{v}-number")
|
201
|
+
val && !val.empty? and committee_component(v, node, a)
|
202
|
+
a.parent.xpath("./#{v.gsub('-', '_')}[not(node())][not(@number)]")
|
203
|
+
.each(&:remove)
|
97
204
|
end
|
98
205
|
node.attr("secretariat") and a.secretariat(node.attr("secretariat"))
|
99
206
|
end
|
@@ -106,6 +213,8 @@ module Metanorma
|
|
106
213
|
&.split(%r{[/,;]}))
|
107
214
|
types.each do |v|
|
108
215
|
node.attr("#{v}-number") and committee_component(v, node, a)
|
216
|
+
a.parent.xpath("./#{v.gsub('-', '_')}[not(node())][not(@number)]")
|
217
|
+
.each(&:remove)
|
109
218
|
end
|
110
219
|
end
|
111
220
|
end
|
@@ -124,6 +233,21 @@ module Metanorma
|
|
124
233
|
xml.agency v
|
125
234
|
end
|
126
235
|
end
|
236
|
+
|
237
|
+
def committee_component(compname, node, out)
|
238
|
+
i = 1
|
239
|
+
suffix = ""
|
240
|
+
while node.attr(compname + suffix)
|
241
|
+
num = node.attr("#{compname}-number#{suffix}")
|
242
|
+
name = node.attr(compname + suffix)
|
243
|
+
(!num.nil? && !num.empty?) || (!name.nil? && !name.empty?) and
|
244
|
+
out.send compname.gsub(/-/, "_"), name,
|
245
|
+
**attr_code(number: num,
|
246
|
+
type: node.attr("#{compname}-type#{suffix}"))
|
247
|
+
i += 1
|
248
|
+
suffix = "_#{i}"
|
249
|
+
end
|
250
|
+
end
|
127
251
|
end
|
128
252
|
end
|
129
253
|
end
|
@@ -187,9 +187,6 @@ module Metanorma
|
|
187
187
|
|
188
188
|
def iso_id_default(params)
|
189
189
|
params_nolang = params.dup.tap { |hs| hs.delete(:language) }
|
190
|
-
#params1 = if params[:unpublished]
|
191
|
-
#params_nolang.dup.tap { |hs| hs.delete(:year) }
|
192
|
-
#else params_nolang end
|
193
190
|
params1 = params_nolang
|
194
191
|
params1.delete(:unpublished)
|
195
192
|
pubid_select(params1).create(**params1)
|
@@ -205,9 +202,6 @@ module Metanorma
|
|
205
202
|
end
|
206
203
|
|
207
204
|
def iso_id_with_lang(params)
|
208
|
-
#params1 = if params[:unpublished]
|
209
|
-
#params.dup.tap { |hs| hs.delete(:year) }
|
210
|
-
#else params end
|
211
205
|
params1 = params
|
212
206
|
params1.delete(:unpublished)
|
213
207
|
pubid_select(params1).create(**params1)
|
@@ -220,7 +214,7 @@ module Metanorma
|
|
220
214
|
|
221
215
|
def structured_id(node, xml)
|
222
216
|
node.attr("docnumber") or return
|
223
|
-
part, subpart = node
|
217
|
+
part, subpart = node.attr("partnumber")&.split("-")
|
224
218
|
xml.structuredidentifier do |i|
|
225
219
|
i.project_number(node.attr("docnumber"), **attr_code(
|
226
220
|
part:, subpart:,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
3
|
-
<!-- VERSION v2.0
|
3
|
+
<!-- VERSION v2.1.0 -->
|
4
4
|
|
5
5
|
<!--
|
6
6
|
ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
|
@@ -42,36 +42,6 @@ All IdRefType instances point not to `@id` in Semantic XML, which is the Content
|
|
42
42
|
but to `@anchor`, the user-supplied cross-reference</a:documentation>
|
43
43
|
<text/>
|
44
44
|
</define>
|
45
|
-
<define name="index-primary">
|
46
|
-
<element name="primary">
|
47
|
-
<oneOrMore>
|
48
|
-
<choice>
|
49
|
-
<ref name="PureTextElement"/>
|
50
|
-
<ref name="stem"/>
|
51
|
-
</choice>
|
52
|
-
</oneOrMore>
|
53
|
-
</element>
|
54
|
-
</define>
|
55
|
-
<define name="index-secondary">
|
56
|
-
<element name="secondary">
|
57
|
-
<oneOrMore>
|
58
|
-
<choice>
|
59
|
-
<ref name="PureTextElement"/>
|
60
|
-
<ref name="stem"/>
|
61
|
-
</choice>
|
62
|
-
</oneOrMore>
|
63
|
-
</element>
|
64
|
-
</define>
|
65
|
-
<define name="index-tertiary">
|
66
|
-
<element name="tertiary">
|
67
|
-
<oneOrMore>
|
68
|
-
<choice>
|
69
|
-
<ref name="PureTextElement"/>
|
70
|
-
<ref name="stem"/>
|
71
|
-
</choice>
|
72
|
-
</oneOrMore>
|
73
|
-
</element>
|
74
|
-
</define>
|
75
45
|
<define name="review">
|
76
46
|
<a:documentation>Generalise BasicDoc element from just review comments, to general annotations;
|
77
47
|
the type attribute defaults to `review` for reviews</a:documentation>
|
@@ -592,28 +562,6 @@ normative or informative references, some split references into sections organiz
|
|
592
562
|
</oneOrMore>
|
593
563
|
</element>
|
594
564
|
</define>
|
595
|
-
<define name="sub">
|
596
|
-
<a:documentation>Subscript text. Corresponds to HTML `sub</a:documentation>
|
597
|
-
<element name="sub">
|
598
|
-
<zeroOrMore>
|
599
|
-
<choice>
|
600
|
-
<ref name="PureTextElement"/>
|
601
|
-
<ref name="stem"/>
|
602
|
-
</choice>
|
603
|
-
</zeroOrMore>
|
604
|
-
</element>
|
605
|
-
</define>
|
606
|
-
<define name="sup">
|
607
|
-
<a:documentation>Superscript text. Corresponds to HTML `sup`</a:documentation>
|
608
|
-
<element name="sup">
|
609
|
-
<zeroOrMore>
|
610
|
-
<choice>
|
611
|
-
<ref name="PureTextElement"/>
|
612
|
-
<ref name="stem"/>
|
613
|
-
</choice>
|
614
|
-
</zeroOrMore>
|
615
|
-
</element>
|
616
|
-
</define>
|
617
565
|
<define name="pagebreak">
|
618
566
|
<a:documentation>Page break. Only applicable in paged layouts (e.g. PDF, Word), and not flow layouts (e.g. HTML)</a:documentation>
|
619
567
|
<element name="pagebreak">
|
@@ -735,6 +683,12 @@ titlecase, or lowercase</a:documentation>
|
|
735
683
|
<ref name="BlockAttributes"/>
|
736
684
|
</define>
|
737
685
|
<define name="TableAttributes" combine="interleave">
|
686
|
+
<optional>
|
687
|
+
<attribute name="plain">
|
688
|
+
<a:documentation>Render as a plain attribute, with no shading or borders</a:documentation>
|
689
|
+
<data type="boolean"/>
|
690
|
+
</attribute>
|
691
|
+
</optional>
|
738
692
|
<optional>
|
739
693
|
<attribute name="width">
|
740
694
|
<a:documentation>Width of the table block in rendering</a:documentation>
|
@@ -1088,7 +1042,6 @@ That concept may be defined as a term within the current document, or it may be
|
|
1088
1042
|
<zeroOrMore>
|
1089
1043
|
<choice>
|
1090
1044
|
<ref name="PureTextElement"/>
|
1091
|
-
<ref name="stem"/>
|
1092
1045
|
<ref name="index"/>
|
1093
1046
|
<ref name="index-xref"/>
|
1094
1047
|
</choice>
|
@@ -1101,7 +1054,6 @@ That concept may be defined as a term within the current document, or it may be
|
|
1101
1054
|
<zeroOrMore>
|
1102
1055
|
<choice>
|
1103
1056
|
<ref name="PureTextElement"/>
|
1104
|
-
<ref name="stem"/>
|
1105
1057
|
<ref name="index"/>
|
1106
1058
|
<ref name="index-xref"/>
|
1107
1059
|
</choice>
|
@@ -2019,10 +1971,7 @@ used in document amendments</a:documentation>
|
|
2019
1971
|
<element name="name">
|
2020
1972
|
<a:documentation>The symbolic form of the designation</a:documentation>
|
2021
1973
|
<oneOrMore>
|
2022
|
-
<
|
2023
|
-
<ref name="PureTextElement"/>
|
2024
|
-
<ref name="stem"/>
|
2025
|
-
</choice>
|
1974
|
+
<ref name="PureTextElement"/>
|
2026
1975
|
</oneOrMore>
|
2027
1976
|
</element>
|
2028
1977
|
</element>
|
@@ -2075,7 +2024,6 @@ used in document amendments</a:documentation>
|
|
2075
2024
|
<zeroOrMore>
|
2076
2025
|
<choice>
|
2077
2026
|
<ref name="PureTextElement"/>
|
2078
|
-
<ref name="stem"/>
|
2079
2027
|
<ref name="index"/>
|
2080
2028
|
<ref name="index-xref"/>
|
2081
2029
|
</choice>
|