metanorma-iso 3.1.2 → 3.1.3
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/lib/isodoc/iso/iso.amendment.xsl +276 -157
- data/lib/isodoc/iso/iso.international-standard.xsl +276 -157
- data/lib/isodoc/iso/metadata.rb +20 -32
- data/lib/isodoc/iso/presentation_bibdata.rb +0 -29
- data/lib/isodoc/iso/presentation_section.rb +2 -2
- data/lib/metanorma/iso/biblio-standoc.rng +0 -49
- data/lib/metanorma/iso/biblio.rng +11 -1
- data/lib/metanorma/iso/cleanup.rb +20 -35
- data/lib/metanorma/iso/front_contributor.rb +34 -173
- data/lib/metanorma/iso/isodoc.rng +6 -1
- data/lib/metanorma/iso/relaton-iso.rng +0 -50
- data/lib/metanorma/iso/validate.rb +7 -4
- data/lib/metanorma/iso/version.rb +1 -1
- metadata +2 -2
data/lib/isodoc/iso/metadata.rb
CHANGED
@@ -23,32 +23,26 @@ module IsoDoc
|
|
23
23
|
|
24
24
|
def docstatus(isoxml, _out)
|
25
25
|
docstatus = isoxml.at(ns("//bibdata/status/stage"))
|
26
|
-
published_default(isoxml)
|
26
|
+
published = published_default(isoxml)
|
27
27
|
revdate = isoxml.at(ns("//bibdata/version/revision-date"))
|
28
28
|
set(:revdate, revdate&.text)
|
29
|
-
docstatus and docstatus1(isoxml, docstatus)
|
29
|
+
docstatus and docstatus1(isoxml, docstatus, published)
|
30
30
|
docscheme = isoxml.at(ns("//presentation-metadata[name" \
|
31
31
|
"[text() = 'document-scheme']]/value"))
|
32
32
|
docscheme and set(:document_scheme, docscheme.text)
|
33
33
|
end
|
34
34
|
|
35
|
-
def docstatus1(isoxml, docstatus)
|
35
|
+
def docstatus1(isoxml, docstatus, published)
|
36
36
|
set(:stage, docstatus.text)
|
37
37
|
set(:stage_int, docstatus.text.to_i)
|
38
38
|
set(:substage_int, isoxml.at(ns("//bibdata/status/substage"))&.text)
|
39
|
-
set(:unpublished, unpublished(docstatus.text))
|
40
39
|
set(:statusabbr,
|
41
40
|
status_abbrev(docstatus["abbreviation"] || "??",
|
42
41
|
isoxml.at(ns("//bibdata/status/substage"))&.text,
|
43
42
|
isoxml.at(ns("//bibdata/status/iteration"))&.text,
|
44
43
|
isoxml.at(ns("//bibdata/version/draft"))&.text,
|
45
44
|
isoxml.at(ns("//bibdata/ext/doctype"))&.text))
|
46
|
-
|
47
|
-
set(:stageabbr, docstatus["abbreviation"])
|
48
|
-
end
|
49
|
-
|
50
|
-
def unpublished(status)
|
51
|
-
status.to_i.positive? && status.to_i < 60
|
45
|
+
!published and set(:stageabbr, docstatus["abbreviation"])
|
52
46
|
end
|
53
47
|
|
54
48
|
def docid(isoxml, _out)
|
@@ -187,13 +181,13 @@ module IsoDoc
|
|
187
181
|
set(:tc, tcid)
|
188
182
|
end
|
189
183
|
|
184
|
+
COMMITTEE = "//bibdata/contributor[role/@type = 'author'] " \
|
185
|
+
"[role/description = 'committee']/organization".freeze
|
186
|
+
|
190
187
|
def tc_base(xml, grouptype)
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
"@type"))&.text || "TC"
|
195
|
-
tc_type == "Other" and tc_type = ""
|
196
|
-
"#{tc_type} #{tc_num.text}".strip
|
188
|
+
s = xml.at(ns("#{COMMITTEE}/subdivision[@type = 'Technical committee']"))
|
189
|
+
s or return nil
|
190
|
+
s.at(ns("./identifier[not(@type = 'full')]"))&.text
|
197
191
|
end
|
198
192
|
|
199
193
|
def sc(xml)
|
@@ -202,12 +196,9 @@ module IsoDoc
|
|
202
196
|
end
|
203
197
|
|
204
198
|
def sc_base(xml, grouptype)
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
"@type"))&.text || "SC"
|
209
|
-
sc_type == "Other" and sc_type = ""
|
210
|
-
"#{sc_type} #{sc_num.text}"
|
199
|
+
s = xml.at(ns("#{COMMITTEE}/subdivision[@type = 'Subcommittee']"))
|
200
|
+
s or return nil
|
201
|
+
s.at(ns("./identifier[not(@type = 'full')]"))&.text
|
211
202
|
end
|
212
203
|
|
213
204
|
def wg(xml)
|
@@ -216,18 +207,13 @@ module IsoDoc
|
|
216
207
|
end
|
217
208
|
|
218
209
|
def wg_base(xml, grouptype)
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
"@type"))&.text || "WG"
|
223
|
-
wg_type == "Other" and wg_type = ""
|
224
|
-
"#{wg_type} #{wg_num.text}"
|
210
|
+
s = xml.at(ns("#{COMMITTEE}/subdivision[@type = 'Workgroup']"))
|
211
|
+
s or return nil
|
212
|
+
s.at(ns("./identifier[not(@type = 'full')]"))&.text
|
225
213
|
end
|
226
214
|
|
227
215
|
def editorialgroup(xml)
|
228
|
-
xpath =
|
229
|
-
//contributor[role/@type = 'author'][role/description = 'Technical committee']/organization/subdivision/identifier[@type = 'full']
|
230
|
-
XPATH
|
216
|
+
xpath = "#{COMMITTEE}/subdivision/identifier[@type = 'full']"
|
231
217
|
a = xml.xpath(ns(xpath))
|
232
218
|
a.empty? or set(:editorialgroup,
|
233
219
|
connectives_strip(@i18n.boolean_conj(a.map(&:text),
|
@@ -239,7 +225,9 @@ module IsoDoc
|
|
239
225
|
end
|
240
226
|
|
241
227
|
def secretariat(xml)
|
242
|
-
sec = xml.at(ns("//bibdata/
|
228
|
+
sec = xml.at(ns("//bibdata/contributor[role/@type = 'author']" \
|
229
|
+
"[role/description = 'secretariat']/organization/subdivision" \
|
230
|
+
"[@type = 'Secretariat']/name"))
|
243
231
|
set(:secretariat, sec.text) if sec
|
244
232
|
end
|
245
233
|
|
@@ -1,35 +1,6 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module Iso
|
3
3
|
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
|
4
|
-
def bibdata(docxml)
|
5
|
-
super
|
6
|
-
editorialgroup_identifier(docxml)
|
7
|
-
end
|
8
|
-
|
9
|
-
def editorialgroup_identifier(docxml)
|
10
|
-
%w(editorialgroup approvalgroup).each do |v|
|
11
|
-
docxml.xpath(ns("//bibdata/ext/#{v}")).each do |a|
|
12
|
-
editorialgroup_identifier1(a)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def editorialgroup_identifier1(group)
|
18
|
-
agency = group.xpath(ns("./agency"))&.map(&:text)
|
19
|
-
ret = %w(technical-committee subcommittee workgroup)
|
20
|
-
.each_with_object([]) do |v, m|
|
21
|
-
m << editorialgroup_identifier2(group, v)
|
22
|
-
end
|
23
|
-
group["identifier"] = (agency + ret.compact).join("/")
|
24
|
-
end
|
25
|
-
|
26
|
-
def editorialgroup_identifier2(group, level)
|
27
|
-
a = group.at(ns("./#{level}")) or return nil
|
28
|
-
type = a["type"]
|
29
|
-
type&.casecmp("other")&.zero? and type = ""
|
30
|
-
"#{type} #{a['number']}".strip
|
31
|
-
end
|
32
|
-
|
33
4
|
def bibdata_i18n(bib)
|
34
5
|
hash_translate(bib, @i18n.get["doctype_dict"], "./ext/doctype",
|
35
6
|
"//presentation-metadata/doctype-alias", @lang)
|
@@ -15,9 +15,9 @@ module IsoDoc
|
|
15
15
|
|
16
16
|
def warning_for_missing_metadata_create(docxml)
|
17
17
|
ret = ""
|
18
|
-
docxml.at(ns("//bibdata/
|
18
|
+
docxml.at(ns("//bibdata//contributor/role[description = 'secretariat']")) or
|
19
19
|
ret += "<p>Secretariat is missing.</p>"
|
20
|
-
docxml.at(ns("//bibdata/
|
20
|
+
docxml.at(ns("//bibdata//contributor/role[description = 'committee']")) or
|
21
21
|
ret += "<p>Editorial groups are missing.</p>"
|
22
22
|
docxml.at(ns("//bibdata/date[@type = 'published' or @type = 'issued' " \
|
23
23
|
"or @type = 'created']")) ||
|
@@ -76,12 +76,6 @@ from other documents in the same doctype</a:documentation>
|
|
76
76
|
<ref name="flavor">
|
77
77
|
<a:documentation>Flavour of Metanorma used to process this document</a:documentation>
|
78
78
|
</ref>
|
79
|
-
<optional>
|
80
|
-
<ref name="editorialgroup">
|
81
|
-
<a:documentation>Groups associated with the production of the standards document, typically within
|
82
|
-
a standards definition organization</a:documentation>
|
83
|
-
</ref>
|
84
|
-
</optional>
|
85
79
|
<zeroOrMore>
|
86
80
|
<ref name="ics">
|
87
81
|
<a:documentation>Classification of the document contents taken from the International Classification of Standards</a:documentation>
|
@@ -130,49 +124,6 @@ a standards definition organization</a:documentation>
|
|
130
124
|
However we prefer not to hardcode it, given ongoing extension.</a:documentation>
|
131
125
|
<text/>
|
132
126
|
</define>
|
133
|
-
<define name="editorialgroup">
|
134
|
-
<a:documentation>A group associated with the production of the standards document, typically within
|
135
|
-
a standards definition organization</a:documentation>
|
136
|
-
<element name="editorialgroup">
|
137
|
-
<oneOrMore>
|
138
|
-
<ref name="technical-committee">
|
139
|
-
<a:documentation>A technical committee associated with the production of the standards document</a:documentation>
|
140
|
-
</ref>
|
141
|
-
</oneOrMore>
|
142
|
-
</element>
|
143
|
-
</define>
|
144
|
-
<define name="technical-committee">
|
145
|
-
<a:documentation>Technical committee associated with the production of a standards document</a:documentation>
|
146
|
-
<element name="technical-committee">
|
147
|
-
<ref name="IsoWorkgroup"/>
|
148
|
-
</element>
|
149
|
-
</define>
|
150
|
-
<define name="IsoWorkgroup">
|
151
|
-
<optional>
|
152
|
-
<attribute name="number">
|
153
|
-
<a:documentation>Numeric identifier of the technical committee</a:documentation>
|
154
|
-
</attribute>
|
155
|
-
</optional>
|
156
|
-
<optional>
|
157
|
-
<attribute name="type">
|
158
|
-
<a:documentation>Type of the technical committee, used in identifying the technical committee</a:documentation>
|
159
|
-
</attribute>
|
160
|
-
</optional>
|
161
|
-
<optional>
|
162
|
-
<attribute name="identifier">
|
163
|
-
<a:documentation>Non-numeric, complete identifier of the technical committee</a:documentation>
|
164
|
-
</attribute>
|
165
|
-
</optional>
|
166
|
-
<optional>
|
167
|
-
<attribute name="prefix">
|
168
|
-
<a:documentation>Disambiguating prefix added to number to form the identifier of the technical committee,
|
169
|
-
typically indicating its type</a:documentation>
|
170
|
-
</attribute>
|
171
|
-
</optional>
|
172
|
-
<text>
|
173
|
-
<a:documentation>Name of the technical committee</a:documentation>
|
174
|
-
</text>
|
175
|
-
</define>
|
176
127
|
<define name="ics">
|
177
128
|
<a:documentation>Classification taken from the International Classification of Standards.
|
178
129
|
ICS is defined by ISO here -- https://www.iso.org/publication/PUB100033.html</a:documentation>
|
@@ -242,6 +242,8 @@ Detailed in https://www.relaton.org/model/creator/</a:documentation>
|
|
242
242
|
</choice>
|
243
243
|
</define>
|
244
244
|
<define name="roledescription">
|
245
|
+
<a:documentation>A more detailed description of the role of the contributor
|
246
|
+
Some descriptions are reserved words; in particular, the editorial committee of a standard has the role description "committee"</a:documentation>
|
245
247
|
<element name="description">
|
246
248
|
<ref name="LocalizedMarkedUpString"/>
|
247
249
|
</element>
|
@@ -443,7 +445,10 @@ real names (if the person is named with a pseudonym or user name); previous lega
|
|
443
445
|
</oneOrMore>
|
444
446
|
<zeroOrMore>
|
445
447
|
<ref name="subdivision">
|
446
|
-
<a:documentation>The subdivision of the organization directly involved with the production of the bibliographic item
|
448
|
+
<a:documentation>The subdivision of the organization directly involved with the production of the bibliographic item.
|
449
|
+
Multiple subdivisions can be specified for an organization, with no implication of hierarchical
|
450
|
+
relation between them
|
451
|
+
Editorial and advisory groups are represented as consecutive subdivisions of the SDO</a:documentation>
|
447
452
|
</ref>
|
448
453
|
</zeroOrMore>
|
449
454
|
<optional>
|
@@ -485,6 +490,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
|
|
485
490
|
<a:documentation>The type of subdivision</a:documentation>
|
486
491
|
</attribute>
|
487
492
|
</optional>
|
493
|
+
<optional>
|
494
|
+
<attribute name="subtype">
|
495
|
+
<a:documentation>The subtype of subdivision; e.g. different types of technical committee</a:documentation>
|
496
|
+
</attribute>
|
497
|
+
</optional>
|
488
498
|
<ref name="OrganizationType">
|
489
499
|
<a:documentation>The subdivision, modelled recursively as an organization</a:documentation>
|
490
500
|
</ref>
|
@@ -100,30 +100,6 @@ module Metanorma
|
|
100
100
|
super
|
101
101
|
end
|
102
102
|
|
103
|
-
def bibdata_cleanup(xmldoc)
|
104
|
-
super
|
105
|
-
approval_groups_rename(xmldoc)
|
106
|
-
editorial_groups_agency(xmldoc)
|
107
|
-
editorial_group_types(xmldoc)
|
108
|
-
end
|
109
|
-
|
110
|
-
def approval_groups_rename(xmldoc)
|
111
|
-
%w(technical-committee subcommittee workgroup).each do |v|
|
112
|
-
xmldoc.xpath("//bibdata//approval-#{v}").each { |a| a.name = v }
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
def editorial_groups_agency(xmldoc)
|
117
|
-
pubs = extract_publishers(xmldoc)
|
118
|
-
xmldoc.xpath("//bibdata/ext/editorialgroup").each do |e|
|
119
|
-
pubs.reverse_each do |p|
|
120
|
-
if e.children.empty? then e << "<agency>#{p}</agency>"
|
121
|
-
else e.children.first.previous = "<agency>#{p}</agency>"
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
103
|
def extract_publishers(xmldoc)
|
128
104
|
xmldoc.xpath("//bibdata/contributor[role/@type = 'publisher']/" \
|
129
105
|
"organization").each_with_object([]) do |p, m|
|
@@ -132,25 +108,34 @@ module Metanorma
|
|
132
108
|
end
|
133
109
|
end
|
134
110
|
|
111
|
+
def termdef_boilerplate_insert_locationx(xmldoc)
|
112
|
+
f = xmldoc.at(self.class::TERM_CLAUSE)
|
113
|
+
root = xmldoc.at("//sections/terms | //sections/clause[.//terms]")
|
114
|
+
!f || !root and return f || root
|
115
|
+
f.at("./preceding-sibling::clause") and return root
|
116
|
+
f
|
117
|
+
end
|
118
|
+
|
119
|
+
def published?(status, _xmldoc)
|
120
|
+
status.to_i.positive? && status.to_i >= 60
|
121
|
+
end
|
122
|
+
|
123
|
+
def bibdata_cleanup(xmldoc)
|
124
|
+
super
|
125
|
+
editorial_group_types(xmldoc)
|
126
|
+
end
|
127
|
+
|
135
128
|
DEFAULT_EDGROUP_TYPE = { "technical-committee": "TC",
|
136
129
|
subcommittee: "SC", workgroup: "WG" }.freeze
|
137
130
|
|
138
131
|
def editorial_group_types(xmldoc)
|
139
132
|
%w(technical-committee subcommittee workgroup).each do |v|
|
140
|
-
|
141
|
-
|
142
|
-
g["
|
133
|
+
v1 = v.sub("-", " ").capitalize
|
134
|
+
xmldoc.xpath("//bibdata//subdivision[@type = '#{v1}']").each do |g|
|
135
|
+
g["subtype"] ||= DEFAULT_EDGROUP_TYPE[v.to_sym]
|
143
136
|
end
|
144
137
|
end
|
145
138
|
end
|
146
|
-
|
147
|
-
def termdef_boilerplate_insert_locationx(xmldoc)
|
148
|
-
f = xmldoc.at(self.class::TERM_CLAUSE)
|
149
|
-
root = xmldoc.at("//sections/terms | //sections/clause[.//terms]")
|
150
|
-
!f || !root and return f || root
|
151
|
-
f.at("./preceding-sibling::clause") and return root
|
152
|
-
f
|
153
|
-
end
|
154
139
|
end
|
155
140
|
end
|
156
141
|
end
|
@@ -15,7 +15,9 @@ module Metanorma
|
|
15
15
|
org_contributor(node, xml,
|
16
16
|
{ source: ["publisher", "pub"], role: "author",
|
17
17
|
default: default_publisher })
|
18
|
-
committee_contributors(node, xml,
|
18
|
+
committee_contributors(node, xml, default_publisher,
|
19
|
+
{ approval: false })
|
20
|
+
secretariat_contributor(node, xml, default_publisher)
|
19
21
|
end
|
20
22
|
|
21
23
|
def org_organization(node, xml, org)
|
@@ -25,33 +27,40 @@ module Metanorma
|
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
|
-
def
|
29
|
-
|
30
|
+
def secretariat_contributor(node, xml, agency)
|
31
|
+
node.attr("secretariat") or return
|
32
|
+
o = committee_contrib_org_prep(node, "secretariat", agency, {})
|
33
|
+
o[:desc] = "secretariat"
|
34
|
+
org_contributor(node, xml, o)
|
35
|
+
end
|
36
|
+
|
37
|
+
def committee_contributors(node, xml, agency, opt)
|
38
|
+
t = metadata_approval_committee_types(opt[:approval] ? node : nil)
|
30
39
|
v = t.first
|
31
|
-
if node
|
40
|
+
if committee_number_or_name?(node, v, "")
|
32
41
|
node.attr(v) or node.set_attr(v, "")
|
33
|
-
o = committee_contrib_org_prep(node, v,
|
42
|
+
o = committee_contrib_org_prep(node, v, agency, opt)
|
34
43
|
o[:groups] = t
|
35
|
-
o[:approval] = approval
|
44
|
+
o[:approval] = opt[:approval]
|
36
45
|
org_contributor(node, xml, o)
|
37
46
|
end
|
38
|
-
approval or committee_contributors_approval(node, xml, agency)
|
47
|
+
opt[:approval] or committee_contributors_approval(node, xml, agency)
|
39
48
|
end
|
40
49
|
|
41
|
-
def committee_contrib_org_prep(node, type,
|
50
|
+
def committee_contrib_org_prep(node, type, agency, opt)
|
42
51
|
agency_arr, agency_abbrev =
|
43
52
|
committee_org_prep_agency(node, type, agency, [], [])
|
44
|
-
{ source: [type], role: approval ? "authorizer" : "author",
|
53
|
+
{ source: [type], role: opt[:approval] ? "authorizer" : "author",
|
45
54
|
default_org: false, committee: true, agency: agency_arr,
|
46
|
-
agency_abbrev:,
|
47
|
-
|
55
|
+
agency_abbrev:, desc: "committee",
|
56
|
+
subdivtype: type.sub(/^approval-/, "").tr("-", " ").capitalize }
|
57
|
+
.compact
|
48
58
|
end
|
49
59
|
|
50
60
|
def committee_org_prep_agency(node, type, agency, agency_arr, agency_abbr)
|
51
61
|
i = 1
|
52
62
|
suffix = ""
|
53
|
-
while node
|
54
|
-
node.attr("#{type}#{suffix}")
|
63
|
+
while committee_number_or_name?(node, type, suffix)
|
55
64
|
agency_arr << (node.attr("#{type}-agency#{suffix}") || agency)
|
56
65
|
agency_abbr << node.attr("#{type}-agency-abbr#{suffix}")
|
57
66
|
i += 1
|
@@ -60,163 +69,37 @@ module Metanorma
|
|
60
69
|
[agency_arr, agency_abbr]
|
61
70
|
end
|
62
71
|
|
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
|
-
|
75
72
|
def committee_contributors_approval(node, xml, agency)
|
76
73
|
o = { name: agency, role: "authorizer", default_org: false,
|
77
74
|
desc: "Agency", committee: false }
|
78
75
|
org_contributor(node, xml, o)
|
79
76
|
end
|
80
77
|
|
81
|
-
def
|
82
|
-
n = node.attr("#{source}-number#{suffix}")
|
83
|
-
t = committee_abbrev(node.attr("#{source}-type#{suffix}"), n, source)
|
84
|
-
super.merge(ident: t).compact
|
85
|
-
end
|
86
|
-
|
87
|
-
def contrib_committee_build(xml, agency, committee)
|
88
|
-
if name = org_abbrev.invert[agency]
|
89
|
-
committee[:agency_abbrev] = agency
|
90
|
-
agency = name
|
91
|
-
end
|
92
|
-
xml.name agency
|
93
|
-
s = committee
|
94
|
-
loop do
|
95
|
-
contrib_committee_subdiv(xml, s)
|
96
|
-
s = s[:subdiv] or break
|
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
|
124
|
-
end
|
125
|
-
|
126
|
-
COMMITTEE_ABBREVS =
|
78
|
+
def committee_abbrevs
|
127
79
|
{ "technical-committee" => "TC", "subcommittee" => "SC",
|
128
|
-
"workgroup" => "WG" }
|
80
|
+
"workgroup" => "WG" }
|
81
|
+
end
|
129
82
|
|
130
|
-
def
|
83
|
+
def committee_ident(type, number, level)
|
131
84
|
number.nil? || number.empty? and return
|
132
|
-
type ||=
|
85
|
+
type ||= committee_abbrevs[level.sub(/^approval-/, "")]
|
133
86
|
type == "Other" and type = ""
|
134
87
|
"#{type} #{number}".strip
|
135
88
|
end
|
136
89
|
|
137
|
-
def org_attrs_parse(node, opts)
|
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],
|
143
|
-
committee: opts[:committee], default_org: opts[:default_org])
|
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
90
|
def contributors_committees_filter_empty?(committee)
|
169
|
-
|
170
|
-
|
171
|
-
|
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]
|
91
|
+
committee[:name].empty? &&
|
92
|
+
(committee[:ident].nil? || %w(WG TC
|
93
|
+
SC).include?(committee[:ident]))
|
183
94
|
end
|
184
95
|
|
185
96
|
def metadata_publisher(node, xml)
|
186
97
|
super
|
187
98
|
# approvals
|
188
|
-
committee_contributors(
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
def metadata_committee(node, xml)
|
193
|
-
metadata_editorial_committee(node, xml)
|
194
|
-
metadata_approval_committee(node, xml)
|
195
|
-
end
|
196
|
-
|
197
|
-
def metadata_editorial_committee(node, xml)
|
198
|
-
xml.editorialgroup do |a|
|
199
|
-
%w(technical-committee subcommittee workgroup).each do |v|
|
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)
|
204
|
-
end
|
205
|
-
node.attr("secretariat") and a.secretariat(node.attr("secretariat"))
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
def metadata_approval_committee(node, xml)
|
210
|
-
types = metadata_approval_committee_types(node)
|
211
|
-
xml.approvalgroup do |a|
|
212
|
-
metadata_approval_agency(a, node.attr("approval-agency")
|
213
|
-
&.split(%r{[/,;]}))
|
214
|
-
types.each do |v|
|
215
|
-
node.attr("#{v}-number") and committee_component(v, node, a)
|
216
|
-
a.parent.xpath("./#{v.gsub('-', '_')}[not(node())][not(@number)]")
|
217
|
-
.each(&:remove)
|
218
|
-
end
|
219
|
-
end
|
99
|
+
committee_contributors(
|
100
|
+
node, xml,
|
101
|
+
node.attr("approval-agency") || default_publisher, { approval: true }
|
102
|
+
)
|
220
103
|
end
|
221
104
|
|
222
105
|
def metadata_approval_committee_types(node)
|
@@ -226,28 +109,6 @@ module Metanorma
|
|
226
109
|
approval-workgroup)
|
227
110
|
types
|
228
111
|
end
|
229
|
-
|
230
|
-
def metadata_approval_agency(xml, list)
|
231
|
-
list = [default_publisher] if list.nil? || list.empty?
|
232
|
-
list.each do |v|
|
233
|
-
xml.agency v
|
234
|
-
end
|
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
|
251
112
|
end
|
252
113
|
end
|
253
114
|
end
|
@@ -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.1.
|
3
|
+
<!-- VERSION v2.1.1 -->
|
4
4
|
|
5
5
|
<!--
|
6
6
|
ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
|
@@ -2233,6 +2233,11 @@ used in document amendments</a:documentation>
|
|
2233
2233
|
<ref name="RequiredId"/>
|
2234
2234
|
<ref name="NumberingAttributes"/>
|
2235
2235
|
<ref name="BlockAttributes"/>
|
2236
|
+
<optional>
|
2237
|
+
<attribute name="type">
|
2238
|
+
<a:documentation>Semantic classification of note</a:documentation>
|
2239
|
+
</attribute>
|
2240
|
+
</optional>
|
2236
2241
|
<oneOrMore>
|
2237
2242
|
<choice>
|
2238
2243
|
<a:documentation>Content of the term note</a:documentation>
|