isodoc 2.5.4 → 2.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/convert.rb +0 -8
- data/lib/isodoc/function/inline.rb +2 -32
- data/lib/isodoc/html_function/html.rb +0 -1
- data/lib/isodoc/presentation_function/block.rb +9 -1
- data/lib/isodoc/presentation_function/concepts.rb +90 -0
- data/lib/isodoc/presentation_function/erefs.rb +49 -0
- data/lib/isodoc/presentation_function/inline.rb +11 -0
- data/lib/isodoc/presentation_function/terms.rb +16 -92
- data/lib/isodoc/presentation_function/xrefs.rb +2 -2
- data/lib/isodoc/presentation_xml_convert.rb +14 -3
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/xref/xref_counter.rb +7 -3
- data/lib/isodoc/xref/xref_gen.rb +14 -5
- data/lib/isodoc-yaml/i18n-ar.yaml +1 -0
- data/lib/isodoc-yaml/i18n-de.yaml +2 -1
- data/lib/isodoc-yaml/i18n-en.yaml +1 -0
- data/lib/isodoc-yaml/i18n-es.yaml +1 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
- data/lib/isodoc-yaml/i18n-ja.yaml +2 -1
- data/lib/isodoc-yaml/i18n-ru.yaml +1 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c7354811120c945f0a478b34503c89e841a49a8cffc6655e0be43f5b565ad35
|
4
|
+
data.tar.gz: 0f9dae634d16cbf5521eb048cbf4ff6de3d2e9d48d2284322183f598df7fc19b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98e9b5625dfe9ab222ba00b03b02216e9f3ee00affa6e655c58be6acbeedb8bb05663b7d6832fbc94a76a8da02bc732a9f1b2c309532e968089990b1f50fe6ba
|
7
|
+
data.tar.gz: 756d64e9edbf24c6ba0ae909421e0a7c0a7f916fff8b5f6622d5792c9952728f05c8d2854888a559d3c6b36aa4a54d394ce7cfeded705fc168c0293240ea04b9
|
data/lib/isodoc/convert.rb
CHANGED
@@ -85,7 +85,6 @@ module IsoDoc
|
|
85
85
|
|
86
86
|
def convert1(docxml, filename, dir)
|
87
87
|
@xrefs.parse docxml
|
88
|
-
bibitem_lookup(docxml)
|
89
88
|
noko do |xml|
|
90
89
|
xml.html lang: @lang.to_s do |html|
|
91
90
|
html.parent.add_namespace("epub", "http://www.idpf.org/2007/ops")
|
@@ -97,13 +96,6 @@ module IsoDoc
|
|
97
96
|
end.join("\n")
|
98
97
|
end
|
99
98
|
|
100
|
-
def bibitem_lookup(docxml)
|
101
|
-
@bibitems = docxml.xpath(ns("//references/bibitem"))
|
102
|
-
.each_with_object({}) do |b, m|
|
103
|
-
m[b["id"]] = b
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
99
|
def convert_init(file, input_filename, debug)
|
108
100
|
docxml = Nokogiri::XML(file) { |config| config.huge }
|
109
101
|
filename, dir = init_file(input_filename, debug)
|
@@ -52,45 +52,15 @@ module IsoDoc
|
|
52
52
|
url.sub(/#{File.extname(url)}$/, ".html")
|
53
53
|
end
|
54
54
|
|
55
|
-
def eref_target(node)
|
56
|
-
url = suffix_url(eref_url(node["bibitemid"]))
|
57
|
-
anchor = node&.at(ns(".//locality[@type = 'anchor']"))
|
58
|
-
return url if url.nil? || /^#/.match?(url) || !anchor
|
59
|
-
|
60
|
-
"#{url}##{anchor.text.strip}"
|
61
|
-
end
|
62
|
-
|
63
|
-
def eref_url(id)
|
64
|
-
@bibitems.nil? and return nil
|
65
|
-
|
66
|
-
b = @bibitems[id]
|
67
|
-
b.nil? and return nil
|
68
|
-
|
69
|
-
url = b.at(ns("./uri[@type = 'citation'][@language = '#{@lang}']")) and
|
70
|
-
return url.text
|
71
|
-
url = b.at(ns("./uri[@type = 'citation']")) and return url.text
|
72
|
-
b["hidden"] == "true" and return b.at(ns("./uri"))&.text
|
73
|
-
"##{id}"
|
74
|
-
end
|
75
|
-
|
76
55
|
def eref_parse(node, out)
|
77
|
-
|
78
|
-
if node["type"] == "footnote"
|
79
|
-
out.sup do |s|
|
80
|
-
s.a(href: href) { |l| no_locality_parse(node, l) }
|
81
|
-
end
|
82
|
-
else
|
83
|
-
out.a(href: href) { |l| no_locality_parse(node, l) }
|
84
|
-
end
|
85
|
-
else no_locality_parse(node, out)
|
86
|
-
end
|
56
|
+
no_locality_parse(node, out)
|
87
57
|
end
|
88
58
|
|
89
59
|
def origin_parse(node, out)
|
90
60
|
if t = node.at(ns("./termref"))
|
91
61
|
termrefelem_parse(t, out)
|
92
62
|
else
|
93
|
-
|
63
|
+
no_locality_parse(node, out)
|
94
64
|
end
|
95
65
|
end
|
96
66
|
|
@@ -140,6 +140,7 @@ module IsoDoc
|
|
140
140
|
def ol(docxml)
|
141
141
|
docxml.xpath(ns("//ol")).each { |f| ol1(f) }
|
142
142
|
@xrefs.list_anchor_names(docxml.xpath(ns(@xrefs.sections_xpath)))
|
143
|
+
docxml.xpath(ns("//ol/li")).each { |f| ol_label(f) }
|
143
144
|
end
|
144
145
|
|
145
146
|
# We don't really want users to specify type of ordered list;
|
@@ -157,6 +158,13 @@ module IsoDoc
|
|
157
158
|
|
158
159
|
def ol1(elem)
|
159
160
|
elem["type"] ||= ol_depth(elem).to_s
|
161
|
+
elem.xpath(ns("./li")).each do |li|
|
162
|
+
li["id"] ||= "_#{UUIDTools::UUID.random_create}"
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def ol_label(elem)
|
167
|
+
elem["label"] = @xrefs.anchor(elem["id"], :label, false)
|
160
168
|
end
|
161
169
|
|
162
170
|
def requirement_render_preprocessing(docxml); end
|
@@ -203,7 +211,7 @@ module IsoDoc
|
|
203
211
|
end
|
204
212
|
|
205
213
|
def source_modification(mod)
|
206
|
-
termsource_modification(mod)
|
214
|
+
termsource_modification(mod.parent)
|
207
215
|
end
|
208
216
|
end
|
209
217
|
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
class PresentationXMLConvert < ::IsoDoc::Convert
|
3
|
+
def concept(docxml)
|
4
|
+
@definition_ids = docxml.xpath(ns("//definitions//dt"))
|
5
|
+
.each_with_object({}) { |x, m| m[x["id"]] = true }
|
6
|
+
docxml.xpath(ns("//concept")).each { |f| concept1(f) }
|
7
|
+
end
|
8
|
+
|
9
|
+
def concept1(node)
|
10
|
+
xref = node&.at(ns("./xref/@target"))&.text or
|
11
|
+
return concept_render(node, ital: "true", ref: "true", bold: "false",
|
12
|
+
linkref: "true", linkmention: "false")
|
13
|
+
if @definition_ids[xref]
|
14
|
+
concept_render(node, ital: "false", ref: "false", bold: "false",
|
15
|
+
linkref: "true", linkmention: "false")
|
16
|
+
else concept_render(node, ital: "true", ref: "true", bold: "false",
|
17
|
+
linkref: "true", linkmention: "false")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def concept_render(node, defaults)
|
22
|
+
opts, render, ref = concept_render_init(node, defaults)
|
23
|
+
node&.at(ns("./refterm"))&.remove
|
24
|
+
ref && opts[:ref] != "false" and render&.next = " "
|
25
|
+
concept1_linkmention(ref, render, opts)
|
26
|
+
concept1_ref(node, ref, opts)
|
27
|
+
concept1_style(node, opts)
|
28
|
+
node.replace(node.children)
|
29
|
+
end
|
30
|
+
|
31
|
+
def concept1_style(node, opts)
|
32
|
+
r = node.at(ns(".//renderterm")) or return
|
33
|
+
opts[:ital] == "true" and r.children = "<em>#{to_xml(r.children)}</em>"
|
34
|
+
opts[:bold] == "true" and
|
35
|
+
r.children = "<strong>#{to_xml(r.children)}</strong>"
|
36
|
+
r.replace(r.children)
|
37
|
+
end
|
38
|
+
|
39
|
+
def concept_render_init(node, defaults)
|
40
|
+
opts = %i(bold ital ref linkref linkmention)
|
41
|
+
.each_with_object({}) { |x, m| m[x] = node[x.to_s] || defaults[x] }
|
42
|
+
[opts, node.at(ns("./renderterm")),
|
43
|
+
node.at(ns("./xref | ./eref | ./termref"))]
|
44
|
+
end
|
45
|
+
|
46
|
+
def concept1_linkmention(ref, renderterm, opts)
|
47
|
+
(opts[:linkmention] == "true" && !renderterm.nil? && !ref.nil?) or return
|
48
|
+
ref2 = ref.clone
|
49
|
+
r2 = renderterm.clone
|
50
|
+
renderterm.replace(ref2).children = r2
|
51
|
+
end
|
52
|
+
|
53
|
+
def concept1_ref(_node, ref, opts)
|
54
|
+
ref.nil? and return
|
55
|
+
opts[:ref] == "false" and return ref.remove
|
56
|
+
concept1_ref_content(ref)
|
57
|
+
%w(xref eref).include? ref.name and get_linkend(ref)
|
58
|
+
opts[:linkref] == "false" && %w(xref eref).include?(ref.name) and
|
59
|
+
ref.replace(ref.children)
|
60
|
+
end
|
61
|
+
|
62
|
+
def concept1_ref_content(ref)
|
63
|
+
prev = "["
|
64
|
+
foll = "]"
|
65
|
+
non_locality_elems(ref).select do |c|
|
66
|
+
!c.text? || /\S/.match(c)
|
67
|
+
end.empty? and
|
68
|
+
(prev, foll = @i18n.term_defined_in.split("%"))
|
69
|
+
ref.previous = prev
|
70
|
+
ref.next = foll
|
71
|
+
end
|
72
|
+
|
73
|
+
def related(docxml)
|
74
|
+
docxml.xpath(ns("//related")).each { |f| related1(f) }
|
75
|
+
end
|
76
|
+
|
77
|
+
def related1(node)
|
78
|
+
p = node.at(ns("./preferred"))
|
79
|
+
ref = node.at(ns("./xref | ./eref | ./termref"))
|
80
|
+
label = @i18n.relatedterms[node["type"]].upcase
|
81
|
+
if p && ref
|
82
|
+
node.replace(l10n("<p><strong>#{label}:</strong> " \
|
83
|
+
"<em>#{to_xml(p)}</em> (#{Common::to_xml(ref)})</p>"))
|
84
|
+
else
|
85
|
+
node.replace(l10n("<p><strong>#{label}:</strong> " \
|
86
|
+
"<strong>**RELATED TERM NOT FOUND**</strong></p>"))
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -179,5 +179,54 @@ module IsoDoc
|
|
179
179
|
end
|
180
180
|
" #{ret}"
|
181
181
|
end
|
182
|
+
|
183
|
+
def eref2link(docxml)
|
184
|
+
docxml.xpath(ns("//eref | //origin[not(termref)] | //quote/source"))
|
185
|
+
.each do |e|
|
186
|
+
href = eref_target(e) or next
|
187
|
+
e.xpath(ns("./locality | ./localityStack")).each(&:remove)
|
188
|
+
if /^#/.match?(href) then eref2xref(e)
|
189
|
+
else eref2link1(e, href)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def eref2xref(node)
|
195
|
+
node.name = "xref"
|
196
|
+
node["target"] = node["bibitemid"]
|
197
|
+
node.delete("bibitemid")
|
198
|
+
node.delete("citeas")
|
199
|
+
node["type"] == "footnote" and node.wrap("<sup></sup>")
|
200
|
+
end
|
201
|
+
|
202
|
+
def eref2link1(node, href)
|
203
|
+
repl = "<link target='#{href}'>#{node.children}</link>"
|
204
|
+
node["type"] == "footnote" and repl = "<sup>#{repl}</sup>"
|
205
|
+
node.replace(repl)
|
206
|
+
end
|
207
|
+
|
208
|
+
def suffix_url(url)
|
209
|
+
return url if url.nil? || %r{^https?://|^#}.match?(url)
|
210
|
+
return url unless File.extname(url).empty?
|
211
|
+
|
212
|
+
url.sub(/#{File.extname(url)}$/, ".html")
|
213
|
+
end
|
214
|
+
|
215
|
+
def eref_target(node)
|
216
|
+
url = suffix_url(eref_url(node["bibitemid"]))
|
217
|
+
anchor = node.at(ns(".//locality[@type = 'anchor']"))
|
218
|
+
return url if url.nil? || /^#/.match?(url) || !anchor
|
219
|
+
|
220
|
+
"#{url}##{anchor.text.strip}"
|
221
|
+
end
|
222
|
+
|
223
|
+
def eref_url(id)
|
224
|
+
@bibitems.nil? and return nil
|
225
|
+
b = @bibitems[id] or return nil
|
226
|
+
url = (b.at(ns("./uri[@type = 'citation'][@language = '#{@lang}']")) ||
|
227
|
+
b.at(ns("./uri[@type = 'citation']"))) and return url.text
|
228
|
+
b["hidden"] == "true" and return b.at(ns("./uri"))&.text
|
229
|
+
"##{id}"
|
230
|
+
end
|
182
231
|
end
|
183
232
|
end
|
@@ -89,6 +89,17 @@ module IsoDoc
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
+
def date(docxml)
|
93
|
+
(docxml.xpath(ns("//date")) -
|
94
|
+
docxml.xpath(ns("//bibdata/date | //bibitem//date"))).each do |d|
|
95
|
+
date1(d)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def date1(elem)
|
100
|
+
elem.replace(@i18n.date(elem["value"], elem["format"].strip))
|
101
|
+
end
|
102
|
+
|
92
103
|
private
|
93
104
|
|
94
105
|
def found_matching_variant_sibling(node)
|
@@ -1,92 +1,5 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
class PresentationXMLConvert < ::IsoDoc::Convert
|
3
|
-
def concept(docxml)
|
4
|
-
@definition_ids = docxml.xpath(ns("//definitions//dt"))
|
5
|
-
.each_with_object({}) { |x, m| m[x["id"]] = true }
|
6
|
-
docxml.xpath(ns("//concept")).each { |f| concept1(f) }
|
7
|
-
end
|
8
|
-
|
9
|
-
def concept1(node)
|
10
|
-
xref = node&.at(ns("./xref/@target"))&.text or
|
11
|
-
return concept_render(node, ital: "true", ref: "true", bold: "false",
|
12
|
-
linkref: "true", linkmention: "false")
|
13
|
-
if @definition_ids[xref]
|
14
|
-
concept_render(node, ital: "false", ref: "false", bold: "false",
|
15
|
-
linkref: "true", linkmention: "false")
|
16
|
-
else concept_render(node, ital: "true", ref: "true", bold: "false",
|
17
|
-
linkref: "true", linkmention: "false")
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def concept_render(node, defaults)
|
22
|
-
opts, render, ref = concept_render_init(node, defaults)
|
23
|
-
node&.at(ns("./refterm"))&.remove
|
24
|
-
ref && opts[:ref] != "false" and render&.next = " "
|
25
|
-
concept1_linkmention(ref, render, opts)
|
26
|
-
concept1_ref(node, ref, opts)
|
27
|
-
concept1_style(node, opts)
|
28
|
-
node.replace(node.children)
|
29
|
-
end
|
30
|
-
|
31
|
-
def concept1_style(node, opts)
|
32
|
-
r = node.at(ns(".//renderterm")) or return
|
33
|
-
opts[:ital] == "true" and r.children = "<em>#{to_xml(r.children)}</em>"
|
34
|
-
opts[:bold] == "true" and
|
35
|
-
r.children = "<strong>#{to_xml(r.children)}</strong>"
|
36
|
-
r.replace(r.children)
|
37
|
-
end
|
38
|
-
|
39
|
-
def concept_render_init(node, defaults)
|
40
|
-
opts = %i(bold ital ref linkref linkmention)
|
41
|
-
.each_with_object({}) { |x, m| m[x] = node[x.to_s] || defaults[x] }
|
42
|
-
[opts, node.at(ns("./renderterm")),
|
43
|
-
node.at(ns("./xref | ./eref | ./termref"))]
|
44
|
-
end
|
45
|
-
|
46
|
-
def concept1_linkmention(ref, renderterm, opts)
|
47
|
-
(opts[:linkmention] == "true" && !renderterm.nil? && !ref.nil?) or return
|
48
|
-
ref2 = ref.clone
|
49
|
-
r2 = renderterm.clone
|
50
|
-
renderterm.replace(ref2).children = r2
|
51
|
-
end
|
52
|
-
|
53
|
-
def concept1_ref(_node, ref, opts)
|
54
|
-
ref.nil? and return
|
55
|
-
opts[:ref] == "false" and return ref.remove
|
56
|
-
concept1_ref_content(ref)
|
57
|
-
%w(xref eref).include? ref.name and get_linkend(ref)
|
58
|
-
opts[:linkref] == "false" && %w(xref eref).include?(ref.name) and
|
59
|
-
ref.replace(ref.children)
|
60
|
-
end
|
61
|
-
|
62
|
-
def concept1_ref_content(ref)
|
63
|
-
prev = "["
|
64
|
-
foll = "]"
|
65
|
-
non_locality_elems(ref).select do |c|
|
66
|
-
!c.text? || /\S/.match(c)
|
67
|
-
end.empty? and
|
68
|
-
(prev, foll = @i18n.term_defined_in.split("%"))
|
69
|
-
ref.previous = prev
|
70
|
-
ref.next = foll
|
71
|
-
end
|
72
|
-
|
73
|
-
def related(docxml)
|
74
|
-
docxml.xpath(ns("//related")).each { |f| related1(f) }
|
75
|
-
end
|
76
|
-
|
77
|
-
def related1(node)
|
78
|
-
p = node.at(ns("./preferred"))
|
79
|
-
ref = node.at(ns("./xref | ./eref | ./termref"))
|
80
|
-
label = @i18n.relatedterms[node["type"]].upcase
|
81
|
-
if p && ref
|
82
|
-
node.replace(l10n("<p><strong>#{label}:</strong> " \
|
83
|
-
"<em>#{to_xml(p)}</em> (#{Common::to_xml(ref)})</p>"))
|
84
|
-
else
|
85
|
-
node.replace(l10n("<p><strong>#{label}:</strong> " \
|
86
|
-
"<strong>**RELATED TERM NOT FOUND**</strong></p>"))
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
3
|
def designation(docxml)
|
91
4
|
docxml.xpath(ns("//term")).each { |t| merge_second_preferred(t) }
|
92
5
|
docxml.xpath(ns("//preferred | //admitted | //deprecates"))
|
@@ -225,9 +138,7 @@ module IsoDoc
|
|
225
138
|
end
|
226
139
|
|
227
140
|
def termsource(docxml)
|
228
|
-
docxml.xpath(ns("//termsource
|
229
|
-
termsource_modification(f)
|
230
|
-
end
|
141
|
+
docxml.xpath(ns("//termsource")).each { |f| termsource_modification(f) }
|
231
142
|
docxml.xpath(ns("//termsource")).each { |f| termsource1(f) }
|
232
143
|
end
|
233
144
|
|
@@ -238,12 +149,25 @@ module IsoDoc
|
|
238
149
|
elem.children = l10n("[#{@i18n.source}: #{to_xml(elem.children).strip}]")
|
239
150
|
end
|
240
151
|
|
241
|
-
def termsource_modification(
|
242
|
-
|
152
|
+
def termsource_modification(elem)
|
153
|
+
origin = elem.at(ns("./origin"))
|
154
|
+
s = termsource_status(elem["status"]) and origin.next = l10n(", #{s}")
|
155
|
+
termsource_add_modification_text(elem.at(ns("./modification")))
|
156
|
+
end
|
157
|
+
|
158
|
+
def termsource_add_modification_text(mod)
|
159
|
+
mod or return
|
243
160
|
mod.text.strip.empty? or mod.previous = " – "
|
244
161
|
mod.elements.size == 1 and
|
245
162
|
mod.elements[0].replace(mod.elements[0].children)
|
246
163
|
mod.replace(mod.children)
|
247
164
|
end
|
165
|
+
|
166
|
+
def termsource_status(status)
|
167
|
+
case status
|
168
|
+
when "modified" then @i18n.modified
|
169
|
+
when "adapted" then @i18n.adapted
|
170
|
+
end
|
171
|
+
end
|
248
172
|
end
|
249
173
|
end
|
@@ -6,8 +6,8 @@ module IsoDoc
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def anchor_value(id)
|
9
|
-
@xrefs.anchor(id, :
|
10
|
-
@xrefs.anchor(id, :xref)
|
9
|
+
@xrefs.anchor(id, :bare_xref) || @xrefs.anchor(id, :value) ||
|
10
|
+
@xrefs.anchor(id, :label) || @xrefs.anchor(id, :xref)
|
11
11
|
end
|
12
12
|
|
13
13
|
def anchor_linkend(node, linkend)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative "presentation_function/block"
|
2
|
+
require_relative "presentation_function/concepts"
|
2
3
|
require_relative "presentation_function/terms"
|
3
4
|
require_relative "presentation_function/xrefs"
|
4
5
|
require_relative "presentation_function/erefs"
|
@@ -17,12 +18,20 @@ module IsoDoc
|
|
17
18
|
|
18
19
|
def convert1(docxml, _filename, _dir)
|
19
20
|
@xrefs.parse docxml
|
21
|
+
bibitem_lookup(docxml)
|
20
22
|
info docxml, nil
|
21
23
|
conversions(docxml)
|
22
24
|
docxml.root["type"] = "presentation"
|
23
25
|
docxml.to_xml.gsub(/</, "<").gsub(/>/, ">")
|
24
26
|
end
|
25
27
|
|
28
|
+
def bibitem_lookup(docxml)
|
29
|
+
@bibitems = docxml.xpath(ns("//references/bibitem"))
|
30
|
+
.each_with_object({}) do |b, m|
|
31
|
+
m[b["id"]] = b
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
26
35
|
def conversions(docxml)
|
27
36
|
semantic_xml_insert(docxml)
|
28
37
|
bibdata docxml
|
@@ -69,12 +78,14 @@ module IsoDoc
|
|
69
78
|
|
70
79
|
def inline(docxml)
|
71
80
|
xref docxml
|
72
|
-
eref docxml
|
73
|
-
origin docxml
|
74
|
-
quotesource docxml
|
81
|
+
eref docxml # feeds docxml
|
82
|
+
origin docxml # feeds docxml
|
83
|
+
quotesource docxml # feeds docxml
|
84
|
+
eref2link docxml
|
75
85
|
mathml docxml
|
76
86
|
variant docxml
|
77
87
|
identifier docxml
|
88
|
+
date docxml
|
78
89
|
end
|
79
90
|
|
80
91
|
def terms(docxml)
|
data/lib/isodoc/version.rb
CHANGED
@@ -107,6 +107,13 @@ module IsoDoc
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def increment_letter
|
110
|
+
clock_letter
|
111
|
+
@letter = (@letter.ord + 1).chr.to_s
|
112
|
+
@skip_i && %w(i I).include?(@letter) and
|
113
|
+
@letter = (@letter.ord + 1).chr.to_s
|
114
|
+
end
|
115
|
+
|
116
|
+
def clock_letter
|
110
117
|
case @letter
|
111
118
|
when "Z"
|
112
119
|
@letter = "@"
|
@@ -115,9 +122,6 @@ module IsoDoc
|
|
115
122
|
@letter = "`"
|
116
123
|
@base = string_inc(@base, "a")
|
117
124
|
end
|
118
|
-
@letter = (@letter.ord + 1).chr.to_s
|
119
|
-
@skip_i && %w(i I).include?(@letter) and
|
120
|
-
@letter = (@letter.ord + 1).chr.to_s
|
121
125
|
end
|
122
126
|
|
123
127
|
def blank?(str)
|
data/lib/isodoc/xref/xref_gen.rb
CHANGED
@@ -171,18 +171,27 @@ module IsoDoc
|
|
171
171
|
refer_list)
|
172
172
|
c = Counter.new(list["start"] ? list["start"].to_i - 1 : 0)
|
173
173
|
list.xpath(ns("./li")).each do |li|
|
174
|
-
label =
|
175
|
-
|
176
|
-
|
174
|
+
bare_label, label =
|
175
|
+
list_item_value(li, c, depth, { list_anchor: list_anchor, prev_label: prev_label,
|
176
|
+
refer_list: refer_list })
|
177
177
|
li["id"] and @anchors[li["id"]] =
|
178
|
-
{
|
179
|
-
|
178
|
+
{ label: bare_label, bare_xref: "#{label})",
|
179
|
+
xref: "#{label})",
|
180
|
+
type: "listitem", refer_list: refer_list,
|
181
|
+
container: list_anchor[:container] }
|
180
182
|
(li.xpath(ns(".//ol")) - li.xpath(ns(".//ol//ol"))).each do |ol|
|
181
183
|
list_item_anchor_names(ol, list_anchor, depth + 1, label, false)
|
182
184
|
end
|
183
185
|
end
|
184
186
|
end
|
185
187
|
|
188
|
+
def list_item_value(entry, counter, depth, opts)
|
189
|
+
label = counter.increment(entry).listlabel(entry.parent, depth)
|
190
|
+
[label,
|
191
|
+
list_item_anchor_label(label, opts[:list_anchor], opts[:prev_label],
|
192
|
+
opts[:refer_list])]
|
193
|
+
end
|
194
|
+
|
186
195
|
def list_item_anchor_label(label, list_anchor, prev_label, refer_list)
|
187
196
|
prev_label.empty? or
|
188
197
|
label = @i18n.list_nested_xref.sub(/%1/, "#{prev_label})")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isodoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html2doc
|
@@ -433,6 +433,7 @@ files:
|
|
433
433
|
- lib/isodoc/pdf_convert.rb
|
434
434
|
- lib/isodoc/presentation_function/bibdata.rb
|
435
435
|
- lib/isodoc/presentation_function/block.rb
|
436
|
+
- lib/isodoc/presentation_function/concepts.rb
|
436
437
|
- lib/isodoc/presentation_function/erefs.rb
|
437
438
|
- lib/isodoc/presentation_function/image.rb
|
438
439
|
- lib/isodoc/presentation_function/inline.rb
|
@@ -473,7 +474,7 @@ homepage: https://github.com/metanorma/isodoc
|
|
473
474
|
licenses:
|
474
475
|
- BSD-2-Clause
|
475
476
|
metadata: {}
|
476
|
-
post_install_message:
|
477
|
+
post_install_message:
|
477
478
|
rdoc_options: []
|
478
479
|
require_paths:
|
479
480
|
- lib
|
@@ -488,8 +489,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
488
489
|
- !ruby/object:Gem::Version
|
489
490
|
version: '0'
|
490
491
|
requirements: []
|
491
|
-
rubygems_version: 3.
|
492
|
-
signing_key:
|
492
|
+
rubygems_version: 3.3.26
|
493
|
+
signing_key:
|
493
494
|
specification_version: 4
|
494
495
|
summary: Convert documents in IsoDoc into Word and HTML in AsciiDoc.
|
495
496
|
test_files: []
|