metanorma-standoc 3.2.0 → 3.2.1
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/metanorma/standoc/anchor.rb +3 -2
- data/lib/metanorma/standoc/biblio.rng +4 -4
- data/lib/metanorma/standoc/blocks.rb +3 -6
- data/lib/metanorma/standoc/cleanup.rb +27 -57
- data/lib/metanorma/standoc/cleanup_bibdata.rb +9 -0
- data/lib/metanorma/standoc/cleanup_inline.rb +43 -2
- data/lib/metanorma/standoc/cleanup_section_names.rb +1 -0
- data/lib/metanorma/standoc/cleanup_xref.rb +11 -3
- data/lib/metanorma/standoc/front.rb +27 -25
- data/lib/metanorma/standoc/front_committee.rb +5 -5
- data/lib/metanorma/standoc/front_contributor.rb +14 -14
- data/lib/metanorma/standoc/front_ext.rb +7 -5
- data/lib/metanorma/standoc/front_organisation.rb +16 -21
- data/lib/metanorma/standoc/init.rb +31 -5
- data/lib/metanorma/standoc/inline.rb +30 -9
- data/lib/metanorma/standoc/isodoc.rng +27 -10
- data/lib/metanorma/standoc/lists.rb +1 -1
- data/lib/metanorma/standoc/log.rb +12 -0
- data/lib/metanorma/standoc/macros_terms.rb +2 -0
- data/lib/metanorma/standoc/ref.rb +11 -11
- data/lib/metanorma/standoc/ref_utility.rb +2 -6
- data/lib/metanorma/standoc/section.rb +3 -9
- data/lib/metanorma/standoc/table.rb +1 -1
- data/lib/metanorma/standoc/terms.rb +1 -1
- data/lib/metanorma/standoc/utils.rb +27 -2
- data/lib/metanorma/standoc/validate.rb +2 -0
- data/lib/metanorma/standoc/validate_image.rb +49 -0
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +4 -3
- metadata +46 -32
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 10660a42ed7862e1985812db06bfba17b763ff8e2d1e30f61d09eb5739c1a0b9
|
|
4
|
+
data.tar.gz: 9e90a193f69f066f3d63650abb39abb3943f55cd2fe14474b72866dcf75e791b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 70e5255195aba9303da9db4c2088997f59bc00bef4f4358548c77780a575a652a217519d05f6f37884f4f89c1f7601a19d88f6943bb2f2ec5f5ab75485368ac1
|
|
7
|
+
data.tar.gz: a5092f7c6848a6038e98aa9aafcee2170650d7f0b9160a796b807bf6ca85f607eedbfffaedf6d88eca797f56ca9509f0abada15f192f70c0e8b691d383b548c3
|
|
@@ -34,7 +34,7 @@ module Metanorma
|
|
|
34
34
|
t = node.target.gsub(/^#/, "").gsub(%r{(\.xml|\.adoc)(#.*$)}, "\\2")
|
|
35
35
|
attrs, text = inline_anchor_xref_match(text)
|
|
36
36
|
attrs.empty? and
|
|
37
|
-
return { target: t, type: "inline", text:,
|
|
37
|
+
return { target: t, type: "inline", text:, defaultstyle: @xrefstyle }
|
|
38
38
|
inline_anchor_xref_attrs1(attrs, t, text)
|
|
39
39
|
end
|
|
40
40
|
|
|
@@ -50,7 +50,8 @@ module Metanorma
|
|
|
50
50
|
type: attrs.key?("fn") ? "footnote" : "inline",
|
|
51
51
|
case: %w(capital lowercase).detect { |x| attrs.key?(x) },
|
|
52
52
|
label: attrs["label"],
|
|
53
|
-
style: attrs["style"]
|
|
53
|
+
style: attrs["style"],
|
|
54
|
+
defaultstyle: @xrefstyle,
|
|
54
55
|
droploc: attrs.key?("droploc") || nil,
|
|
55
56
|
text: }.compact
|
|
56
57
|
end
|
|
@@ -690,7 +690,7 @@ Examples include GRID, LEI, CrossRef, and Ringgold</a:documentation>
|
|
|
690
690
|
<define name="CitationType">
|
|
691
691
|
<attribute name="bibitemid">
|
|
692
692
|
<a:documentation>Bibliographic item that the citation applies to, referenced as the anchor of a bibliographic description</a:documentation>
|
|
693
|
-
<
|
|
693
|
+
<ref name="IdRefType"/>
|
|
694
694
|
</attribute>
|
|
695
695
|
<choice>
|
|
696
696
|
<zeroOrMore>
|
|
@@ -1296,17 +1296,17 @@ for which this claim of validity is made, if applicable</a:documentation>
|
|
|
1296
1296
|
</define>
|
|
1297
1297
|
<define name="validityBegins">
|
|
1298
1298
|
<element name="validityBegins">
|
|
1299
|
-
<ref name="
|
|
1299
|
+
<ref name="ISO8601DateTime"/>
|
|
1300
1300
|
</element>
|
|
1301
1301
|
</define>
|
|
1302
1302
|
<define name="validityEnds">
|
|
1303
1303
|
<element name="validityEnds">
|
|
1304
|
-
<ref name="
|
|
1304
|
+
<ref name="ISO8601DateTime"/>
|
|
1305
1305
|
</element>
|
|
1306
1306
|
</define>
|
|
1307
1307
|
<define name="validityRevision">
|
|
1308
1308
|
<element name="revision">
|
|
1309
|
-
<ref name="
|
|
1309
|
+
<ref name="ISO8601DateTime"/>
|
|
1310
1310
|
</element>
|
|
1311
1311
|
</define>
|
|
1312
1312
|
<define name="TypedTitleString">
|
|
@@ -48,9 +48,7 @@ module Metanorma
|
|
|
48
48
|
|
|
49
49
|
def block_title(node, out)
|
|
50
50
|
node.title.nil? and return
|
|
51
|
-
out
|
|
52
|
-
name << node.title
|
|
53
|
-
end
|
|
51
|
+
add_noko_elem(out, "name", node.title, id_attr(nil))
|
|
54
52
|
end
|
|
55
53
|
|
|
56
54
|
def form_attrs(node)
|
|
@@ -180,11 +178,10 @@ module Metanorma
|
|
|
180
178
|
if node.attr("citetitle")
|
|
181
179
|
m = /^(?<cite>[^,]+)(?:,(?<text>.*$))?$/m.match node.attr("citetitle")
|
|
182
180
|
out.source **attr_code(target: m[:cite], type: "inline") do |s|
|
|
183
|
-
s <<
|
|
181
|
+
s << m[:text]
|
|
184
182
|
end
|
|
185
183
|
end
|
|
186
|
-
node.attr("attribution")
|
|
187
|
-
out.author { |a| a << node.attr("attribution") }
|
|
184
|
+
add_noko_elem(out, "author", node.attr("attribution"))
|
|
188
185
|
end
|
|
189
186
|
|
|
190
187
|
def quote(node)
|
|
@@ -31,6 +31,7 @@ module Metanorma
|
|
|
31
31
|
element_name_cleanup(xmldoc)
|
|
32
32
|
source_include_cleanup(xmldoc) # feeds: misccontainer_cleanup
|
|
33
33
|
passthrough_cleanup(xmldoc) # feeds: smartquotes_cleanup
|
|
34
|
+
annotation_cleanup(xmldoc)
|
|
34
35
|
unnumbered_blocks_cleanup(xmldoc)
|
|
35
36
|
termdocsource_cleanup(xmldoc) # feeds: metadata_cleanup
|
|
36
37
|
metadata_cleanup(xmldoc) # feeds: boilerplate_cleanup, bibdata_cleanup,
|
|
@@ -119,11 +120,21 @@ module Metanorma
|
|
|
119
120
|
@relaton_log.rewind
|
|
120
121
|
@relaton_log.string.split(/(?<=})\n(?={)/).each do |l|
|
|
121
122
|
e = JSON.parse(l)
|
|
122
|
-
|
|
123
|
-
|
|
123
|
+
relaton_log_add?(e) and
|
|
124
|
+
@log.add(RELATON_SEVERITIES[e["severity"].to_sym], e["key"],
|
|
125
|
+
params: [e["message"]])
|
|
124
126
|
end
|
|
125
127
|
end
|
|
126
128
|
|
|
129
|
+
def relaton_log_add?(entry)
|
|
130
|
+
entry["message"].include?("Fetching from") and return false
|
|
131
|
+
entry["message"].include?("Downloaded index from") and return false
|
|
132
|
+
entry["message"].start_with?("Found:") or return true
|
|
133
|
+
id = /^Found: `(.+)`$/.match(entry["message"]) or return true
|
|
134
|
+
entry["key"].end_with?(id[1]) and return false
|
|
135
|
+
true
|
|
136
|
+
end
|
|
137
|
+
|
|
127
138
|
def docidentifier_cleanup(xmldoc); end
|
|
128
139
|
|
|
129
140
|
TEXT_ELEMS =
|
|
@@ -142,9 +153,8 @@ module Metanorma
|
|
|
142
153
|
|
|
143
154
|
def empty_element_cleanup(xmldoc)
|
|
144
155
|
xmldoc.xpath("//#{TEXT_ELEMS.join(' | //')}").each do |x|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
x.remove if x.children.empty?
|
|
156
|
+
x.name == "name" && x.parent.name == "expression" and next
|
|
157
|
+
x.children.empty? and x.remove
|
|
148
158
|
end
|
|
149
159
|
end
|
|
150
160
|
|
|
@@ -152,58 +162,6 @@ module Metanorma
|
|
|
152
162
|
xmldoc.traverse { |n| n.name = n.name.tr("_", "-") }
|
|
153
163
|
end
|
|
154
164
|
|
|
155
|
-
# allows us to deal with doc relation localities,
|
|
156
|
-
# temporarily stashed to "bpart"
|
|
157
|
-
def bpart_cleanup(xmldoc)
|
|
158
|
-
xmldoc.xpath("//relation/bpart").each do |x|
|
|
159
|
-
extract_localities(x)
|
|
160
|
-
x.replace(x.children)
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
def variant_cleanup(xmldoc)
|
|
165
|
-
variant_space_cleanup(xmldoc)
|
|
166
|
-
xmldoc.xpath("//*[lang-variant]").each do |c|
|
|
167
|
-
if only_langvariant_children?(c)
|
|
168
|
-
duplicate_langvariants(c, c.xpath("./lang-variant"))
|
|
169
|
-
else
|
|
170
|
-
c.xpath(".//lang-variant").each { |x| x.name = "span" }
|
|
171
|
-
end
|
|
172
|
-
end
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
def only_langvariant_children?(node)
|
|
176
|
-
node.children.none? do |n|
|
|
177
|
-
n.name != "lang-variant" && (!n.text? || !n.text.strip.empty?)
|
|
178
|
-
end
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
def duplicate_langvariants(container, variants)
|
|
182
|
-
lang_variant_to_node(variants.first, container)
|
|
183
|
-
variants[1..].reverse.each do |node|
|
|
184
|
-
new = container.dup
|
|
185
|
-
lang_variant_to_node(node, new)
|
|
186
|
-
container.next = new
|
|
187
|
-
end
|
|
188
|
-
end
|
|
189
|
-
|
|
190
|
-
def lang_variant_to_node(variant, node)
|
|
191
|
-
node.children = variant.children
|
|
192
|
-
node["lang"] = variant["lang"]
|
|
193
|
-
node.delete("script")
|
|
194
|
-
variant["script"] and node["script"] = variant["script"]
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
def variant_space_cleanup(xmldoc)
|
|
198
|
-
xmldoc.xpath("//*[lang-variant]").each do |c|
|
|
199
|
-
c.next.nil? || c.next.next.nil? and next
|
|
200
|
-
if c.next.text? && c.next.next.name == "lang-variant"
|
|
201
|
-
c.next.text.gsub(/\s/, "").empty? and
|
|
202
|
-
c.next.remove
|
|
203
|
-
end
|
|
204
|
-
end
|
|
205
|
-
end
|
|
206
|
-
|
|
207
165
|
def metadata_cleanup(xmldoc)
|
|
208
166
|
bibdata_published(xmldoc) # feeds: bibdata_cleanup,
|
|
209
167
|
# docidentifier_cleanup (in generic: template)
|
|
@@ -221,6 +179,18 @@ module Metanorma
|
|
|
221
179
|
x.children = @isodoc.populate_template(to_xml(x.children), nil)
|
|
222
180
|
end
|
|
223
181
|
end
|
|
182
|
+
|
|
183
|
+
def annotation_cleanup(xmldoc)
|
|
184
|
+
ret = xmldoc.xpath("//annotation[@type = 'ignore-log']")
|
|
185
|
+
.each_with_object([]) do |ann, m|
|
|
186
|
+
error_ids = Array(csv_split(ann.text || "", ","))
|
|
187
|
+
m << { from: ann["from"], to: ann["to"], error_ids: error_ids }
|
|
188
|
+
ann
|
|
189
|
+
end
|
|
190
|
+
config = @log.suppress_log
|
|
191
|
+
config[:locations] += ret
|
|
192
|
+
@log.suppress_log = config
|
|
193
|
+
end
|
|
224
194
|
end
|
|
225
195
|
end
|
|
226
196
|
end
|
|
@@ -196,6 +196,15 @@ module Metanorma
|
|
|
196
196
|
def published?(stage, _xmldoc)
|
|
197
197
|
stage.casecmp("published").zero?
|
|
198
198
|
end
|
|
199
|
+
|
|
200
|
+
# allows us to deal with doc relation localities,
|
|
201
|
+
# temporarily stashed to "bpart"
|
|
202
|
+
def bpart_cleanup(xmldoc)
|
|
203
|
+
xmldoc.xpath("//relation/bpart").each do |x|
|
|
204
|
+
extract_localities(x)
|
|
205
|
+
x.replace(x.children)
|
|
206
|
+
end
|
|
207
|
+
end
|
|
199
208
|
end
|
|
200
209
|
end
|
|
201
210
|
end
|
|
@@ -18,8 +18,7 @@ module Metanorma
|
|
|
18
18
|
a.text? or return
|
|
19
19
|
if /\S/.match?(a.text)
|
|
20
20
|
a.content = a.text.lstrip
|
|
21
|
-
else
|
|
22
|
-
a.remove
|
|
21
|
+
else a.remove
|
|
23
22
|
end
|
|
24
23
|
end
|
|
25
24
|
|
|
@@ -189,6 +188,48 @@ module Metanorma
|
|
|
189
188
|
end
|
|
190
189
|
end
|
|
191
190
|
|
|
191
|
+
def variant_cleanup(xmldoc)
|
|
192
|
+
variant_space_cleanup(xmldoc)
|
|
193
|
+
xmldoc.xpath("//*[lang-variant]").each do |c|
|
|
194
|
+
if only_langvariant_children?(c)
|
|
195
|
+
duplicate_langvariants(c, c.xpath("./lang-variant"))
|
|
196
|
+
else
|
|
197
|
+
c.xpath(".//lang-variant").each { |x| x.name = "span" }
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def only_langvariant_children?(node)
|
|
203
|
+
node.children.none? do |n|
|
|
204
|
+
n.name != "lang-variant" && (!n.text? || !n.text.strip.empty?)
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
def duplicate_langvariants(container, variants)
|
|
209
|
+
lang_variant_to_node(variants.first, container)
|
|
210
|
+
variants[1..].reverse.each do |node|
|
|
211
|
+
new = container.dup
|
|
212
|
+
lang_variant_to_node(node, new)
|
|
213
|
+
container.next = new
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def lang_variant_to_node(variant, node)
|
|
218
|
+
node.children = variant.children
|
|
219
|
+
node["lang"] = variant["lang"]
|
|
220
|
+
node.delete("script")
|
|
221
|
+
variant["script"] and node["script"] = variant["script"]
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
def variant_space_cleanup(xmldoc)
|
|
225
|
+
xmldoc.xpath("//*[lang-variant]").each do |c|
|
|
226
|
+
c.next.nil? || c.next.next.nil? and next
|
|
227
|
+
c.next.text? && c.next.next.name == "lang-variant" &&
|
|
228
|
+
c.next.text.gsub(/\s/, "").empty? and
|
|
229
|
+
c.next.remove
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
|
|
192
233
|
private
|
|
193
234
|
|
|
194
235
|
# skip ZWNJ inserted to prevent regexes operating in asciidoctor
|
|
@@ -85,6 +85,7 @@ module Metanorma
|
|
|
85
85
|
else xref_to_eref1(elem)
|
|
86
86
|
end
|
|
87
87
|
elem.delete("target")
|
|
88
|
+
elem.delete("defaultstyle") # xrefstyle default
|
|
88
89
|
extract_localities(elem)
|
|
89
90
|
end
|
|
90
91
|
|
|
@@ -179,10 +180,11 @@ module Metanorma
|
|
|
179
180
|
xmldoc.xpath("//xref").each do |x|
|
|
180
181
|
%r{:(?!//)}.match?(x["target"]) and xref_to_internal_eref(x)
|
|
181
182
|
x.name == "xref" or next
|
|
182
|
-
if refid? x["target"]
|
|
183
|
-
xref_to_eref(x, "eref")
|
|
183
|
+
if refid? x["target"] then xref_to_eref(x, "eref")
|
|
184
184
|
elsif @anchor_alias[x["target"]] then xref_alias(x)
|
|
185
|
-
else
|
|
185
|
+
else
|
|
186
|
+
x.delete("type")
|
|
187
|
+
xref_default_style(x)
|
|
186
188
|
end
|
|
187
189
|
end
|
|
188
190
|
end
|
|
@@ -203,6 +205,12 @@ module Metanorma
|
|
|
203
205
|
elem["style"] == "id" && elem.text.strip.empty? and
|
|
204
206
|
elem << elem["target"]
|
|
205
207
|
elem["target"] = @anchor_alias[elem["target"]]
|
|
208
|
+
xref_default_style(elem)
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
def xref_default_style(elem)
|
|
212
|
+
elem["defaultstyle"] and elem["style"] ||= elem["defaultstyle"]
|
|
213
|
+
elem.delete("defaultstyle")
|
|
206
214
|
end
|
|
207
215
|
|
|
208
216
|
def quotesource_cleanup(xmldoc)
|
|
@@ -9,7 +9,7 @@ module Metanorma
|
|
|
9
9
|
module Front
|
|
10
10
|
def metadata_id(node, xml)
|
|
11
11
|
id = node.attr("docidentifier") || metadata_id_build(node)
|
|
12
|
-
xml
|
|
12
|
+
add_noko_elem(xml, "docidentifier", id, primary: "true")
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def metadata_id_build(node)
|
|
@@ -21,21 +21,23 @@ module Metanorma
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def metadata_other_id(node, xml)
|
|
24
|
-
a = node.attr("isbn") and
|
|
25
|
-
|
|
24
|
+
a = node.attr("isbn") and
|
|
25
|
+
add_noko_elem(xml, "docidentifier", a, type: "ISBN")
|
|
26
|
+
a = node.attr("isbn10") and
|
|
27
|
+
add_noko_elem(xml, "docidentifier", a, type: "ISBN10")
|
|
26
28
|
csv_split(node.attr("docidentifier-additional"), ",")&.each do |n|
|
|
27
29
|
t, v = n.split(":", 2)
|
|
28
|
-
xml
|
|
30
|
+
add_noko_elem(xml, "docidentifier", v, type: t)
|
|
29
31
|
end
|
|
30
|
-
xml
|
|
32
|
+
add_noko_elem(xml, "docnumber", node.attr("docnumber"))
|
|
31
33
|
end
|
|
32
34
|
|
|
33
35
|
def metadata_version(node, xml)
|
|
34
36
|
draft = metadata_version_value(node)
|
|
35
|
-
xml
|
|
37
|
+
add_noko_elem(xml, "edition", node.attr("edition"))
|
|
36
38
|
xml.version do |v|
|
|
37
|
-
v
|
|
38
|
-
v
|
|
39
|
+
add_noko_elem(v, "revision_date", node.attr("revdate"))
|
|
40
|
+
add_noko_elem(v, "draft", draft)
|
|
39
41
|
end
|
|
40
42
|
end
|
|
41
43
|
|
|
@@ -48,23 +50,24 @@ module Metanorma
|
|
|
48
50
|
|
|
49
51
|
def metadata_status(node, xml)
|
|
50
52
|
xml.status do |s|
|
|
51
|
-
s
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
add_noko_elem(s, "stage",
|
|
54
|
+
node.attr("status") || node.attr("docstage") || "published")
|
|
55
|
+
add_noko_elem(s, "substage", node.attr("docsubstage"))
|
|
56
|
+
add_noko_elem(s, "iteration", node.attr("iteration"))
|
|
54
57
|
end
|
|
55
58
|
end
|
|
56
59
|
|
|
57
60
|
def metadata_source(node, xml)
|
|
58
|
-
|
|
61
|
+
add_noko_elem(xml, "uri", node.attr("uri"))
|
|
59
62
|
%w(xml html pdf doc relaton).each do |t|
|
|
60
|
-
|
|
63
|
+
add_noko_elem(xml, "uri", node.attr("#{t}-uri"), type: t)
|
|
61
64
|
end
|
|
62
65
|
end
|
|
63
66
|
|
|
64
67
|
def metadata_date1(node, xml, type)
|
|
65
68
|
date = node.attr("#{type}-date")
|
|
66
69
|
date and xml.date(type:) do |d|
|
|
67
|
-
d
|
|
70
|
+
add_noko_elem(d, "on", date)
|
|
68
71
|
end
|
|
69
72
|
end
|
|
70
73
|
|
|
@@ -80,17 +83,17 @@ module Metanorma
|
|
|
80
83
|
a == "date" || /^date_\d+$/.match(a) or next
|
|
81
84
|
type, date = node.attr(a).split(/ /, 2)
|
|
82
85
|
type or next
|
|
83
|
-
xml.date(type:) { |d| d
|
|
86
|
+
xml.date(type:) { |d| add_noko_elem(d, "on", date) }
|
|
84
87
|
end
|
|
85
88
|
end
|
|
86
89
|
|
|
87
90
|
def metadata_language(node, xml)
|
|
88
|
-
xml
|
|
89
|
-
|
|
91
|
+
add_noko_elem(xml, "language", node.attr("language") || "en")
|
|
92
|
+
add_noko_elem(xml, "locale", node.attr("locale"))
|
|
90
93
|
end
|
|
91
94
|
|
|
92
95
|
def metadata_script(node, xml)
|
|
93
|
-
xml
|
|
96
|
+
add_noko_elem(xml, "script", node.attr("script") ||
|
|
94
97
|
Metanorma::Utils.default_script(node.attr("language")))
|
|
95
98
|
end
|
|
96
99
|
|
|
@@ -128,8 +131,8 @@ module Metanorma
|
|
|
128
131
|
xml.relation type: relation_normalise(type) do |r|
|
|
129
132
|
desc.nil? or r.description desc.tr("-", " ")
|
|
130
133
|
fetch_ref(r, doc, nil, **{}) or r.bibitem do |b|
|
|
131
|
-
b
|
|
132
|
-
b
|
|
134
|
+
add_noko_elem(b, "title", id[1] || "--")
|
|
135
|
+
add_noko_elem(b, "docidentifier", id[0])
|
|
133
136
|
end
|
|
134
137
|
end
|
|
135
138
|
end
|
|
@@ -137,7 +140,7 @@ module Metanorma
|
|
|
137
140
|
def metadata_keywords(node, xml)
|
|
138
141
|
node.attr("keywords") or return
|
|
139
142
|
node.attr("keywords").split(/,\s*/).each do |kw|
|
|
140
|
-
xml
|
|
143
|
+
add_noko_elem(xml, "keyword", kw)
|
|
141
144
|
end
|
|
142
145
|
end
|
|
143
146
|
|
|
@@ -145,7 +148,7 @@ module Metanorma
|
|
|
145
148
|
csv_split(node.attr("classification"), ",")&.each do |c|
|
|
146
149
|
vals = c.split(/:/, 2)
|
|
147
150
|
vals.size == 1 and vals = ["default", vals[0]]
|
|
148
|
-
xml
|
|
151
|
+
add_noko_elem(xml, "classification", vals[1], type: vals[0])
|
|
149
152
|
end
|
|
150
153
|
end
|
|
151
154
|
|
|
@@ -204,9 +207,8 @@ module Metanorma
|
|
|
204
207
|
end
|
|
205
208
|
|
|
206
209
|
def add_title_xml(xml, content, language, type)
|
|
207
|
-
xml
|
|
208
|
-
|
|
209
|
-
end
|
|
210
|
+
add_noko_elem(xml, "title", Metanorma::Utils::asciidoc_sub(content),
|
|
211
|
+
language: language, type: type)
|
|
210
212
|
end
|
|
211
213
|
|
|
212
214
|
def title_fallback(node, xml)
|
|
@@ -46,13 +46,13 @@ module Metanorma
|
|
|
46
46
|
committee[:agency_abbrev] = agency
|
|
47
47
|
agency = name
|
|
48
48
|
end
|
|
49
|
-
xml
|
|
49
|
+
add_noko_elem(xml, "name", agency)
|
|
50
50
|
s = committee
|
|
51
51
|
loop do
|
|
52
52
|
contrib_committee_subdiv(xml, s)
|
|
53
53
|
s = s[:subdiv] or break
|
|
54
54
|
end
|
|
55
|
-
|
|
55
|
+
add_noko_elem(xml, "abbreviation", committee[:agency_abbrev])
|
|
56
56
|
full_committee_id(xml.parent)
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -60,9 +60,9 @@ module Metanorma
|
|
|
60
60
|
contributors_committees_filter_empty?(committee) and return
|
|
61
61
|
xml.subdivision **attr_code(type: committee[:subdivtype],
|
|
62
62
|
subtype: committee[:type]) do |o|
|
|
63
|
-
o
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
add_noko_elem(o, "name", committee[:name])
|
|
64
|
+
add_noko_elem(o, "abbreviation", committee[:abbr])
|
|
65
|
+
add_noko_elem(o, "identifier", committee[:ident])
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
|
|
@@ -37,19 +37,19 @@ module Metanorma
|
|
|
37
37
|
type = node.attr("role#{suffix}")&.downcase || "author"
|
|
38
38
|
desc = node.attr("role-description#{suffix}")
|
|
39
39
|
contrib.role type: type do |r|
|
|
40
|
-
|
|
41
|
-
d << desc
|
|
42
|
-
end
|
|
40
|
+
add_noko_elem(r, "description", desc)
|
|
43
41
|
end
|
|
44
42
|
end
|
|
45
43
|
|
|
46
44
|
def personal_contact(node, suffix, person)
|
|
47
|
-
node.attr("phone#{suffix}") and
|
|
45
|
+
node.attr("phone#{suffix}") and
|
|
46
|
+
add_noko_elem(person, "phone", node.attr("phone#{suffix}"))
|
|
48
47
|
node.attr("fax#{suffix}") and
|
|
49
|
-
person
|
|
50
|
-
node.attr("email#{suffix}") and
|
|
48
|
+
add_noko_elem(person, "phone", node.attr("fax#{suffix}"), type: "fax")
|
|
49
|
+
node.attr("email#{suffix}") and
|
|
50
|
+
add_noko_elem(person, "email", node.attr("email#{suffix}"))
|
|
51
51
|
node.attr("contributor-uri#{suffix}") and
|
|
52
|
-
person
|
|
52
|
+
add_noko_elem(person, "uri", node.attr("contributor-uri#{suffix}"))
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def personal_author1(node, xml, suffix)
|
|
@@ -67,25 +67,25 @@ module Metanorma
|
|
|
67
67
|
def person_name(node, _xml, suffix, person)
|
|
68
68
|
person.name do |n|
|
|
69
69
|
if node.attr("fullname#{suffix}")
|
|
70
|
-
n
|
|
70
|
+
add_noko_elem(n, "completename", node.attr("fullname#{suffix}"))
|
|
71
71
|
else
|
|
72
|
-
n
|
|
73
|
-
n
|
|
74
|
-
n
|
|
72
|
+
add_noko_elem(n, "forename", node.attr("givenname#{suffix}"))
|
|
73
|
+
add_noko_elem(n, "initial", node.attr("initials#{suffix}"))
|
|
74
|
+
add_noko_elem(n, "surname", node.attr("surname#{suffix}"))
|
|
75
75
|
end
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
def person_credentials(node, _xml, suffix, person)
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
add_noko_elem(person, "credentials",
|
|
81
|
+
node.attr("contributor-credentials#{suffix}"))
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
def person_affiliation(node, _xml, suffix, person)
|
|
85
85
|
aff = node.attr("affiliation#{suffix}")
|
|
86
86
|
pos = node.attr("contributor-position#{suffix}")
|
|
87
87
|
(aff || pos) and person.affiliation do |a|
|
|
88
|
-
|
|
88
|
+
add_noko_elem(a, "name", pos)
|
|
89
89
|
aff and a.organization do |o|
|
|
90
90
|
person_organization(node, suffix, o)
|
|
91
91
|
end
|
|
@@ -5,7 +5,7 @@ module Metanorma
|
|
|
5
5
|
ics = node.attr("library-ics")
|
|
6
6
|
ics&.split(/,\s*/)&.each do |i|
|
|
7
7
|
xml.ics do |elem|
|
|
8
|
-
elem
|
|
8
|
+
add_noko_elem(elem, "code", i)
|
|
9
9
|
icsdata = Isoics.fetch i
|
|
10
10
|
elem.text_ icsdata.description
|
|
11
11
|
end
|
|
@@ -24,15 +24,15 @@ module Metanorma
|
|
|
24
24
|
def structured_id(node, xml); end
|
|
25
25
|
|
|
26
26
|
def metadata_doctype(node, xml)
|
|
27
|
-
xml
|
|
27
|
+
add_noko_elem(xml, "doctype", doctype(node))
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def metadata_subdoctype(node, xml)
|
|
31
|
-
|
|
31
|
+
add_noko_elem(xml, "subdoctype", node.attr("docsubtype"))
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def metadata_flavor(_node, ext)
|
|
35
|
-
ext
|
|
35
|
+
add_noko_elem(ext, "flavor", processor.new.asciidoctor_backend.to_s)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def metadata_coverpage_images(node, xml)
|
|
@@ -40,7 +40,9 @@ module Metanorma
|
|
|
40
40
|
backpage-image).each do |n|
|
|
41
41
|
if a = node.attr(n)
|
|
42
42
|
xml.send n do |c|
|
|
43
|
-
a.split(",").each
|
|
43
|
+
a.split(",").each do |x|
|
|
44
|
+
c.image src: x
|
|
45
|
+
end
|
|
44
46
|
end
|
|
45
47
|
end
|
|
46
48
|
end
|