metanorma-standoc 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/README.adoc +1 -1
- data/lib/metanorma/standoc/base.rb +1 -1
- data/lib/metanorma/standoc/basicdoc.rng +1 -1
- data/lib/metanorma/standoc/blocks.rb +5 -2
- data/lib/metanorma/standoc/blocks_notes.rb +14 -0
- data/lib/metanorma/standoc/cleanup_bibitem.rb +7 -1
- data/lib/metanorma/standoc/cleanup_maths.rb +10 -0
- data/lib/metanorma/standoc/converter.rb +0 -2
- data/lib/metanorma/standoc/isodoc.rng +1 -59
- data/lib/metanorma/standoc/macros_inline.rb +1 -3
- data/lib/metanorma/standoc/macros_note.rb +0 -14
- data/lib/metanorma/standoc/ref.rb +7 -4
- data/lib/metanorma/standoc/ref_queue.rb +4 -2
- data/lib/metanorma/standoc/ref_utility.rb +56 -59
- data/lib/metanorma/standoc/utils.rb +2 -0
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b781bd30313479321cf23297d77787c8500bda06c74a76028853f9b28d30510
|
4
|
+
data.tar.gz: bbdf82ad80d7a6b9f1f21582d7ab6eeb58b365d4aea706a49046d74b4e6309ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 398ae3eaa49e8d22a4612adecf703cc4d3d7ae1b4a056f29289e5e9517be690253a1fadabf67ef1d030763992c5d97b405cc8296275df5a98eb5fc40386b93da
|
7
|
+
data.tar.gz: 994a1d4820b1a68e2768ca5c189788f89a7487c1e9dd63f09178aed9c1dfd558f416a1c8521834c5e8d39b294f9a488a61778f3490e5e3aad04b10d7b5bcc386
|
data/README.adoc
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
image:https://img.shields.io/gem/v/metanorma-standoc.svg["Gem Version", link="https://rubygems.org/gems/metanorma-standoc"]
|
4
4
|
image:https://github.com/metanorma/metanorma-standoc/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-standoc/actions?workflow=rake"]
|
5
|
-
image:https://codeclimate.com/github/metanorma/metanorma-standoc/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-standoc"]
|
5
|
+
// image:https://codeclimate.com/github/metanorma/metanorma-standoc/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-standoc"]
|
6
6
|
image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-standoc.svg["Pull Requests", link="https://github.com/metanorma/metanorma-standoc/pulls"]
|
7
7
|
image:https://img.shields.io/github/commits-since/metanorma/metanorma-standoc/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-standoc/releases"]
|
8
8
|
|
@@ -139,7 +139,7 @@ module Metanorma
|
|
139
139
|
%w(presentation semantic).each do |t|
|
140
140
|
/^#{t}-metadata-/.match?(k) or next
|
141
141
|
k = k.sub(/^#{t}-metadata-/, "")
|
142
|
-
quoted_csv_split(v)&.each do |c|
|
142
|
+
quoted_csv_split(v.gsub("&#", "&#"))&.each do |c|
|
143
143
|
ret << "<#{t}-metadata><#{k}>#{c}</#{k}></#{t}-metadata>"
|
144
144
|
end
|
145
145
|
end
|
@@ -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"/>
|
@@ -161,12 +161,15 @@ module Metanorma
|
|
161
161
|
type: node.attr("type"))))
|
162
162
|
end
|
163
163
|
|
164
|
-
# term sources occasionally turning up as "source source"?
|
164
|
+
# TODO: term sources occasionally turning up as "source source"?
|
165
165
|
def paragraph(node)
|
166
166
|
node.role&.sub(/ .*$/, "") == "source" and return termsource(node)
|
167
|
+
content = node.content
|
168
|
+
content.start_with?("TODO: ") and return todo_prefixed_para(node)
|
169
|
+
content.start_with?("EDITOR: ") and return editor_prefixed_para(node)
|
167
170
|
noko do |xml|
|
168
171
|
xml.p **para_attrs(node) do |xml_t|
|
169
|
-
xml_t <<
|
172
|
+
xml_t << content
|
170
173
|
end
|
171
174
|
end
|
172
175
|
end
|
@@ -46,6 +46,20 @@ module Metanorma
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
# -TO-DO :
|
50
|
+
def todo_prefixed_para(node)
|
51
|
+
node.lines[0].sub!(/^TODO: /, "")
|
52
|
+
todo(node)
|
53
|
+
end
|
54
|
+
|
55
|
+
# EDITOR:
|
56
|
+
def editor_prefixed_para(node)
|
57
|
+
node.lines[0].sub!(/^EDITOR: /, "")
|
58
|
+
node.set_attr("type", "editorial")
|
59
|
+
node.assign_caption "EDITOR"
|
60
|
+
admonition(node)
|
61
|
+
end
|
62
|
+
|
49
63
|
def termnote(node)
|
50
64
|
noko do |xml|
|
51
65
|
xml.termnote **termnote_attrs(node) do |ex|
|
@@ -6,6 +6,9 @@ module Metanorma
|
|
6
6
|
ret = new_bibitem_from_formattedref_spans(b)
|
7
7
|
merge_bibitem_from_formattedref_spans(b, ret)
|
8
8
|
end
|
9
|
+
xmldoc.xpath("//bibitem[@amend]").each do |b|
|
10
|
+
b.delete("amend")
|
11
|
+
end
|
9
12
|
end
|
10
13
|
|
11
14
|
def new_bibitem_from_formattedref_spans(bib)
|
@@ -18,9 +21,12 @@ module Metanorma
|
|
18
21
|
|
19
22
|
def merge_bibitem_from_formattedref_spans(bib, new)
|
20
23
|
new["type"] and bib["type"] = new["type"]
|
21
|
-
if bib.at("./title")
|
24
|
+
if bib.at("./title") && bib["amend"]
|
25
|
+
# there already is a fetched record here: merge
|
22
26
|
bib.children = MergeBibitems
|
23
27
|
.new(bib.to_xml, new.to_xml).merge.to_noko.children
|
28
|
+
elsif bib.at("./title") # replace record
|
29
|
+
bib.children = new.children.to_xml
|
24
30
|
else bib << new.children.to_xml
|
25
31
|
end
|
26
32
|
end
|
@@ -179,6 +179,7 @@ module Metanorma
|
|
179
179
|
end
|
180
180
|
|
181
181
|
def mathml_cleanup(xmldoc)
|
182
|
+
mathml_number_to_mathml(xmldoc)
|
182
183
|
xmldoc.xpath("//stem[@type = 'MathML'][not(@validate = 'false')]")
|
183
184
|
.each do |x|
|
184
185
|
mathml_xml_cleanup(x)
|
@@ -189,6 +190,15 @@ module Metanorma
|
|
189
190
|
mathml_unitsml(xmldoc)
|
190
191
|
end
|
191
192
|
|
193
|
+
def mathml_number_to_mathml(xmldoc)
|
194
|
+
xmldoc.xpath("//mathml-number").each do |n|
|
195
|
+
n.name = "stem"
|
196
|
+
n["type"] = "MathML"
|
197
|
+
n.children =
|
198
|
+
"<math xmlns='#{MATHML_NS}'><mn>#{n.children.to_xml}</mn></math>"
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
192
202
|
include ::Metanorma::Standoc::Regex
|
193
203
|
end
|
194
204
|
end
|
@@ -80,8 +80,6 @@ module Metanorma
|
|
80
80
|
inline_macro Metanorma::Standoc::SourceIncludeInlineMacro
|
81
81
|
block Metanorma::Standoc::ToDoAdmonitionBlock
|
82
82
|
block Metanorma::Standoc::EditorAdmonitionBlock
|
83
|
-
treeprocessor Metanorma::Standoc::EditorInlineAdmonitionBlock
|
84
|
-
treeprocessor Metanorma::Standoc::ToDoInlineAdmonitionBlock
|
85
83
|
block Metanorma::Standoc::PlantUMLBlockMacro
|
86
84
|
block Metanorma::Standoc::PseudocodeBlockMacro
|
87
85
|
block_macro Metanorma::Standoc::ColumnBreakBlockMacro
|
@@ -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">
|
@@ -1094,7 +1042,6 @@ That concept may be defined as a term within the current document, or it may be
|
|
1094
1042
|
<zeroOrMore>
|
1095
1043
|
<choice>
|
1096
1044
|
<ref name="PureTextElement"/>
|
1097
|
-
<ref name="stem"/>
|
1098
1045
|
<ref name="index"/>
|
1099
1046
|
<ref name="index-xref"/>
|
1100
1047
|
</choice>
|
@@ -1107,7 +1054,6 @@ That concept may be defined as a term within the current document, or it may be
|
|
1107
1054
|
<zeroOrMore>
|
1108
1055
|
<choice>
|
1109
1056
|
<ref name="PureTextElement"/>
|
1110
|
-
<ref name="stem"/>
|
1111
1057
|
<ref name="index"/>
|
1112
1058
|
<ref name="index-xref"/>
|
1113
1059
|
</choice>
|
@@ -2025,10 +1971,7 @@ used in document amendments</a:documentation>
|
|
2025
1971
|
<element name="name">
|
2026
1972
|
<a:documentation>The symbolic form of the designation</a:documentation>
|
2027
1973
|
<oneOrMore>
|
2028
|
-
<
|
2029
|
-
<ref name="PureTextElement"/>
|
2030
|
-
<ref name="stem"/>
|
2031
|
-
</choice>
|
1974
|
+
<ref name="PureTextElement"/>
|
2032
1975
|
</oneOrMore>
|
2033
1976
|
</element>
|
2034
1977
|
</element>
|
@@ -2081,7 +2024,6 @@ used in document amendments</a:documentation>
|
|
2081
2024
|
<zeroOrMore>
|
2082
2025
|
<choice>
|
2083
2026
|
<ref name="PureTextElement"/>
|
2084
|
-
<ref name="stem"/>
|
2085
2027
|
<ref name="index"/>
|
2086
2028
|
<ref name="index-xref"/>
|
2087
2029
|
</choice>
|
@@ -233,9 +233,7 @@ module Metanorma
|
|
233
233
|
fmt = format(out, target)
|
234
234
|
fmt.empty? and fmt = "default"
|
235
235
|
fmt = %( number-format="#{fmt}")
|
236
|
-
|
237
|
-
<stem type="MathML"#{fmt}><math xmlns='#{MATHML_NS}'><mn>#{number(target)}</mn></math></stem>
|
238
|
-
OUTPUT
|
236
|
+
"<mathml-number#{fmt}>#{number(target)}</mathml-number>"
|
239
237
|
end
|
240
238
|
end
|
241
239
|
end
|
@@ -14,20 +14,6 @@ module Metanorma
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
class ToDoInlineAdmonitionBlock < Asciidoctor::Extensions::Treeprocessor
|
18
|
-
def process(document)
|
19
|
-
(document.find_by context: :paragraph).each do |para|
|
20
|
-
next unless /^TODO: /.match? para.lines[0]
|
21
|
-
|
22
|
-
para.set_attr("name", "todo")
|
23
|
-
para.set_attr("caption", "TODO")
|
24
|
-
para.lines[0].sub!(/^TODO: /, "")
|
25
|
-
# these will be converted from admonition to annotation downstream
|
26
|
-
para.context = :admonition
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
17
|
class FootnoteBlockInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
|
32
18
|
use_dsl
|
33
19
|
named :footnoteblock
|
@@ -130,10 +130,7 @@ module Metanorma
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def refitem_render(xml, match, code)
|
133
|
-
xml.bibitem **
|
134
|
-
anchor: match[:anchor], suppress_identifier: code[:dropid],
|
135
|
-
hidden: code[:hidden], id: "_#{UUIDTools::UUID.random_create}"
|
136
|
-
) do |t|
|
133
|
+
xml.bibitem **refitem_render_attrs(match, code) do |t|
|
137
134
|
refitem_render_formattedref(t, match[:text])
|
138
135
|
yr_match = refitem1yr(code[:id])
|
139
136
|
refitem_render1(match, code, t)
|
@@ -143,6 +140,12 @@ module Metanorma
|
|
143
140
|
end
|
144
141
|
end
|
145
142
|
|
143
|
+
def refitem_render_attrs(match, code)
|
144
|
+
attr_code(anchor: match[:anchor], suppress_identifier: code[:dropid],
|
145
|
+
amend: code[:amend], hidden: code[:hidden],
|
146
|
+
id: "_#{UUIDTools::UUID.random_create}")
|
147
|
+
end
|
148
|
+
|
146
149
|
def refitem_render_formattedref(bibitem, title)
|
147
150
|
(title.nil? || title.empty?) and title = @i18n.no_information_available
|
148
151
|
bibitem.formattedref format: "application/x-isodoc+xml" do |i|
|
@@ -42,8 +42,9 @@ module Metanorma
|
|
42
42
|
ref, i, doc = results.pop
|
43
43
|
m[i.to_i] = { ref: }
|
44
44
|
if doc.is_a?(RelatonBib::RequestError)
|
45
|
-
@log.add("Bibliography", nil,
|
46
|
-
|
45
|
+
@log.add("Bibliography", nil,
|
46
|
+
"Could not retrieve #{ref[:code]}: " \
|
47
|
+
"no access to online site", severity: 1)
|
47
48
|
else m[i.to_i][:doc] = doc end
|
48
49
|
end
|
49
50
|
end
|
@@ -206,6 +207,7 @@ module Metanorma
|
|
206
207
|
xml.parent.add_child(smart_render_xml(item[:doc], item[:ref][:code],
|
207
208
|
item[:ref]))
|
208
209
|
use_my_anchor(xml, item[:ref][:match][:anchor],
|
210
|
+
amend: item.dig(:ref, :analyse_code, :amend),
|
209
211
|
hidden: item.dig(:ref, :analyse_code, :hidden),
|
210
212
|
dropid: item.dig(:ref, :analyse_code, :dropid))
|
211
213
|
end
|
@@ -32,11 +32,12 @@ module Metanorma
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def use_my_anchor(ref, id, opt)
|
35
|
-
ref.parent.elements.last
|
36
|
-
|
37
|
-
|
38
|
-
a = opt[:
|
39
|
-
|
35
|
+
elem = ref.parent.elements.last
|
36
|
+
elem["anchor"] = id
|
37
|
+
add_id(elem)
|
38
|
+
a = opt[:hidden] and elem["hidden"] = a
|
39
|
+
a = opt[:amend] and elem["amend"] = a
|
40
|
+
a = opt[:dropid] and elem["suppress_identifier"] = a
|
40
41
|
ref
|
41
42
|
end
|
42
43
|
|
@@ -66,40 +67,20 @@ module Metanorma
|
|
66
67
|
.sub(/^hidden\((.+)\)$/, "\\1")
|
67
68
|
.sub(/^nofetch\((.+)\)$/, "\\1")
|
68
69
|
.sub(/^local-file\((.+)\)$/, "\\1")
|
69
|
-
|
70
|
-
|
71
|
-
def analyse_ref_localfile(ret)
|
72
|
-
m = /^local-file\((?:(?<source>[^,)]+),\s*)?(?<id>[^)]+)\)$/
|
73
|
-
.match(ret[:id])
|
74
|
-
m or return ret
|
75
|
-
ret.merge(id: m[:id], localfile: m[:source] || "default")
|
76
|
-
end
|
77
|
-
|
78
|
-
def analyse_ref_nofetch(ret)
|
79
|
-
m = /^nofetch\((?<id>.+)\)$/.match(ret[:id]) or return ret
|
80
|
-
ret.merge(id: m[:id], nofetch: true)
|
81
|
-
end
|
82
|
-
|
83
|
-
def analyse_ref_hidden(ret)
|
84
|
-
m = /^hidden\((?<id>.+)\)$/.match(ret[:id]) or return ret
|
85
|
-
ret.merge(id: m[:id], hidden: true)
|
86
|
-
end
|
87
|
-
|
88
|
-
def analyse_ref_dropid(ret)
|
89
|
-
m = /^dropid\((?<id>.+)\)$/.match(ret[:id]) or return ret
|
90
|
-
ret.merge(id: m[:id], dropid: true)
|
70
|
+
.sub(/^amend\((.+)\)$/, "\\1")
|
91
71
|
end
|
92
72
|
|
93
73
|
def analyse_ref_repo_path(ret)
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
end
|
101
|
-
|
102
|
-
|
74
|
+
%i(repo path attachment).each do |type|
|
75
|
+
ret[type] or next
|
76
|
+
id = if ret[:id].empty?
|
77
|
+
if type == :attachment then "(#{ret[type]})"
|
78
|
+
else ret[type].sub(%r{^[^/]+/}, "")
|
79
|
+
end
|
80
|
+
else ret[:id] end
|
81
|
+
ret.merge!(id: id, type: type.to_s, key: ret[type], nofetch: true)
|
82
|
+
end
|
83
|
+
ret
|
103
84
|
end
|
104
85
|
|
105
86
|
def analyse_ref_numeric(ret)
|
@@ -107,16 +88,6 @@ module Metanorma
|
|
107
88
|
ret.merge(numeric: true)
|
108
89
|
end
|
109
90
|
|
110
|
-
def analyse_ref_dual(ret)
|
111
|
-
m = /^(?<type>merge|dual)\((?<keys>.+)\)$/.match(ret[:id]) or
|
112
|
-
return ret
|
113
|
-
line = CSV.parse_line(m[:keys], liberal_parsing: true) or return ret
|
114
|
-
line.size > 1 or return ret
|
115
|
-
ret[:id] = line.first
|
116
|
-
ret[m[:type].to_sym] = line[1..].map(&:strip)
|
117
|
-
ret
|
118
|
-
end
|
119
|
-
|
120
91
|
def analyse_ref_code(code)
|
121
92
|
ret = { id: code }
|
122
93
|
code.nil? || code.empty? and return ret
|
@@ -166,23 +137,49 @@ module Metanorma
|
|
166
137
|
end
|
167
138
|
end
|
168
139
|
|
140
|
+
def analyse_ref_code_nested(ret)
|
141
|
+
opts, id = parse_ref_code_nested({}, ret[:id])
|
142
|
+
ret[:id] = id
|
143
|
+
ret.merge!(opts)
|
144
|
+
analyse_ref_numeric(ret)
|
145
|
+
analyse_ref_repo_path(ret)
|
146
|
+
ret
|
147
|
+
end
|
148
|
+
|
169
149
|
# ref id = (usrlbl)code[:-]year
|
170
150
|
# code = \[? number \]? | ident | nofetch(code) | hidden(code) |
|
171
|
-
# dropid(code) |
|
151
|
+
# dropid(code) | amend(code) | (repo|path|attachment):(key,code) |
|
172
152
|
# local-file(source,? key) |
|
173
153
|
# merge(code, code) | dual(code, code)
|
174
|
-
def
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
154
|
+
def parse_ref_code_nested(ret, ident)
|
155
|
+
keys = %w(nofetch hidden dropid local-file repo path attachment merge
|
156
|
+
dual amend)
|
157
|
+
if (m = /^(?<key>[a-z-]+):?\((?<val>.*)\)$/.match(ident)) &&
|
158
|
+
keys.include?(m[:key])
|
159
|
+
case m[:key]
|
160
|
+
when "nofetch", "hidden", "dropid", "amend"
|
161
|
+
ret[m[:key].to_sym] = true
|
162
|
+
parse_ref_code_nested(ret, m[:val])
|
163
|
+
when "repo", "path", "attachment"
|
164
|
+
kv = m[:val].split(",", 2).map(&:strip)
|
165
|
+
ret[m[:key].to_sym] = kv[0]
|
166
|
+
parse_ref_code_nested(ret, kv.size == 1 ? "" : kv[1])
|
167
|
+
when "local-file"
|
168
|
+
kv = m[:val].split(",", 2).map(&:strip)
|
169
|
+
source = kv.size == 1 ? "default" : kv[0]
|
170
|
+
ret[:localfile] = source
|
171
|
+
parse_ref_code_nested(ret, kv[-1])
|
172
|
+
when "merge", "dual"
|
173
|
+
line = CSV.parse_line(m[:val],
|
174
|
+
liberal_parsing: true) or return [ret, ident]
|
175
|
+
line.size > 1 or return [ret, ident]
|
176
|
+
ret[:id] = line.first
|
177
|
+
ret[m[:key].to_sym] = line[1..].map(&:strip)
|
178
|
+
[ret, ret[:id]]
|
179
|
+
end
|
180
|
+
|
181
|
+
else [ret, ident]
|
182
|
+
end
|
186
183
|
end
|
187
184
|
|
188
185
|
# if no year is supplied, interpret as no_year reference
|
@@ -87,8 +87,10 @@ module Metanorma
|
|
87
87
|
conv = presentation_xml_converter(EmptyAttr.new)
|
88
88
|
i18n = conv.i18n_init(lang, script, locale, i18nyaml)
|
89
89
|
conv.metadata_init(lang, script, locale, i18n)
|
90
|
+
conv.meta.localdir = @localdir
|
90
91
|
conv.xref_init(lang, script, nil, i18n, {})
|
91
92
|
conv.xrefs.klass.meta = conv.meta
|
93
|
+
conv.xrefs.klass.localdir = @localdir
|
92
94
|
conv
|
93
95
|
end
|
94
96
|
|
data/metanorma-standoc.gemspec
CHANGED
@@ -57,6 +57,6 @@ Gem::Specification.new do |spec|
|
|
57
57
|
spec.add_development_dependency "timecop", "~> 0.9"
|
58
58
|
spec.add_development_dependency "vcr", "~> 6.1.0"
|
59
59
|
spec.add_development_dependency "webmock"
|
60
|
-
spec.add_development_dependency "
|
60
|
+
spec.add_development_dependency "canon"
|
61
61
|
# spec.metadata["rubygems_mfa_required"] = "true"
|
62
62
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-standoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -389,7 +389,7 @@ dependencies:
|
|
389
389
|
- !ruby/object:Gem::Version
|
390
390
|
version: '0'
|
391
391
|
- !ruby/object:Gem::Dependency
|
392
|
-
name:
|
392
|
+
name: canon
|
393
393
|
requirement: !ruby/object:Gem::Requirement
|
394
394
|
requirements:
|
395
395
|
- - ">="
|