isodoc 2.9.3 → 2.9.4
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/function/blocks_example_note.rb +4 -4
- data/lib/isodoc/function/references.rb +1 -1
- data/lib/isodoc/function/utils.rb +0 -1
- data/lib/isodoc/presentation_function/erefs.rb +16 -14
- data/lib/isodoc/presentation_function/terms.rb +1 -1
- data/lib/isodoc/presentation_function/xrefs.rb +14 -8
- data/lib/isodoc/presentation_xml_convert.rb +6 -5
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/postprocess_cover.rb +1 -2
- data/lib/isodoc-yaml/i18n-ar.yaml +1 -0
- data/lib/isodoc-yaml/i18n-de.yaml +1 -0
- 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 +1 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +1 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa1b06e38f973ba312a0f2d90d306c7ffb34e377f2fcc4a59c42775ba9f2a927
|
4
|
+
data.tar.gz: b74dcbe6b71b90da2ec4f205754bb08028d5bd1d45f085f7e35d6c3c47dc55cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cbe711521cc25e29f1879fa47ca42347a5ecfc0f94526166a4acb73f5787d5a5d577d68e3fe756cedce0c862b4aebfb54022fea51f296cbbeeff173e2ad5521
|
7
|
+
data.tar.gz: a07f6c1bdd5457be3cad8fececa4974de6bc95a952c73e31b718e22606a6d4c6807293729a784d55655a4419e10486c7de171dd1630ceb2f275605b263955e5d
|
@@ -58,7 +58,7 @@ module IsoDoc
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def note_p_parse(node, div)
|
61
|
-
name = node
|
61
|
+
name = node.at(ns("./name"))&.remove
|
62
62
|
div.p do |p|
|
63
63
|
name and p.span class: "note_label" do |s|
|
64
64
|
name.children.each { |n| parse(n, s) }
|
@@ -71,10 +71,9 @@ module IsoDoc
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def note_parse1(node, div)
|
74
|
-
name = node.at(ns("./name"))
|
75
|
-
name and div.p do |p|
|
74
|
+
name = node.at(ns("./name")) and div.p do |p|
|
76
75
|
p.span class: "note_label" do |s|
|
77
|
-
name.children.each { |n| parse(n, s) }
|
76
|
+
name.remove.children.each { |n| parse(n, s) }
|
78
77
|
s << note_delim
|
79
78
|
end
|
80
79
|
insert_tab(p, 1)
|
@@ -84,6 +83,7 @@ module IsoDoc
|
|
84
83
|
|
85
84
|
def keep_style(node)
|
86
85
|
ret = ""
|
86
|
+
node["style"] and ret += "#{node['style']};"
|
87
87
|
node["keep-with-next"] == "true" and
|
88
88
|
ret += "page-break-after: avoid;"
|
89
89
|
node["keep-lines-together"] == "true" and
|
@@ -152,7 +152,7 @@ module IsoDoc
|
|
152
152
|
"//bibliography/references[@normative = 'true'] | " \
|
153
153
|
"//bibliography/clause[.//references[@normative = 'true']] | " \
|
154
154
|
"//sections/references[@normative = 'true'] | " \
|
155
|
-
"//sections/clause[.//references[@normative = 'true']]"
|
155
|
+
"//sections/clause[not(@type)][.//references[@normative = 'true']]"
|
156
156
|
end
|
157
157
|
|
158
158
|
def norm_ref(node, out)
|
@@ -214,7 +214,6 @@ module IsoDoc
|
|
214
214
|
note table figure sourcecode).freeze
|
215
215
|
|
216
216
|
def labelled_ancestor(elem)
|
217
|
-
#require "debug"; binding.b
|
218
217
|
#!elem.path.gsub(/\[\d+\]/, "").split(%r{/})[1..-1]
|
219
218
|
!elem.ancestors.map(&:name)
|
220
219
|
.intersection(LABELLED_ANCESTOR_ELEMENTS).empty?
|
@@ -2,6 +2,13 @@ require "metanorma-utils"
|
|
2
2
|
|
3
3
|
module IsoDoc
|
4
4
|
class PresentationXMLConvert < ::IsoDoc::Convert
|
5
|
+
def citeas(xmldoc)
|
6
|
+
xmldoc.xpath(ns("//eref | //origin | //quote/source")).each do |e|
|
7
|
+
e["bibitemid"] && e["citeas"] or next
|
8
|
+
a = @xrefs.anchor(e["bibitemid"], :xref, false) and e["citeas"] = a
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
5
12
|
def expand_citeas(text)
|
6
13
|
text.nil? and return text
|
7
14
|
HTMLEntities.new.decode(text.gsub("&#x", "&#"))
|
@@ -40,7 +47,6 @@ module IsoDoc
|
|
40
47
|
(refs.size > 1 &&
|
41
48
|
refs.all? { |r| r.name == "localityStack" } &&
|
42
49
|
refs.all? { |r| r.xpath(ns("./locality")).size == 1 }) or return false
|
43
|
-
|
44
50
|
first = refs.first.at(ns("./locality/@type")).text
|
45
51
|
refs.all? do |r|
|
46
52
|
r.at(ns("./locality/@type")).text == first
|
@@ -97,8 +103,7 @@ module IsoDoc
|
|
97
103
|
added = eref_locality_stack(r, i, target, node)
|
98
104
|
added.empty? and next
|
99
105
|
added.each { |a| m << a }
|
100
|
-
|
101
|
-
|
106
|
+
i == refs.size - 1 and next
|
102
107
|
m << eref_locality_delimiter(r)
|
103
108
|
end
|
104
109
|
ret.empty? ? ret : [", "] + ret
|
@@ -156,8 +161,7 @@ module IsoDoc
|
|
156
161
|
|
157
162
|
# def eref_localities1(target, type, from, upto, node, lang = "en")
|
158
163
|
def eref_localities1(opt)
|
159
|
-
|
160
|
-
|
164
|
+
opt[:type] == "anchor" and return nil
|
161
165
|
opt[:lang] == "zh" and
|
162
166
|
# return l10n(eref_localities1_zh(target, type, from, upto, node))
|
163
167
|
return l10n(eref_localities1_zh(opt))
|
@@ -168,8 +172,7 @@ module IsoDoc
|
|
168
172
|
end
|
169
173
|
|
170
174
|
def eref_locality_populate(type, node, number)
|
171
|
-
|
172
|
-
|
175
|
+
node["droploc"] == "true" and return ""
|
173
176
|
loc = type.sub(/^locality:/, "")
|
174
177
|
ret = @i18n.locality[loc] || loc
|
175
178
|
number == "pl" and ret = @i18n.inflect(ret, number: "pl")
|
@@ -206,9 +209,8 @@ module IsoDoc
|
|
206
209
|
end
|
207
210
|
|
208
211
|
def suffix_url(url)
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
+
url.nil? || %r{^https?://|^#}.match?(url) and return url
|
213
|
+
File.extname(url).empty? or return url
|
212
214
|
url.sub(/#{File.extname(url)}$/, ".html")
|
213
215
|
end
|
214
216
|
|
@@ -221,10 +223,10 @@ module IsoDoc
|
|
221
223
|
end
|
222
224
|
|
223
225
|
def eref_url(id)
|
224
|
-
@
|
225
|
-
b = @
|
226
|
-
url =
|
227
|
-
|
226
|
+
@bibitem_lookup.nil? and return nil
|
227
|
+
b = @bibitem_lookup[id] or return nil
|
228
|
+
url = b.at(ns("./uri[@type = 'citation'][@language = '#{@lang}']")) ||
|
229
|
+
b.at(ns("./uri[@type = 'citation']")) and return url.text
|
228
230
|
b["hidden"] == "true" and return b.at(ns("./uri"))&.text
|
229
231
|
"##{id}"
|
230
232
|
end
|
@@ -164,7 +164,7 @@ module IsoDoc
|
|
164
164
|
|
165
165
|
def termsource_add_modification_text(mod)
|
166
166
|
mod or return
|
167
|
-
mod.text.strip.empty? or mod.previous = " &#
|
167
|
+
mod.text.strip.empty? or mod.previous = " — "
|
168
168
|
mod.elements.size == 1 and
|
169
169
|
mod.elements[0].replace(mod.elements[0].children)
|
170
170
|
mod.replace(mod.children)
|
@@ -4,7 +4,8 @@ module IsoDoc
|
|
4
4
|
prefix_container?(container, node) or return linkend
|
5
5
|
container_container = @xrefs.anchor(container, :container, false)
|
6
6
|
container_label =
|
7
|
-
prefix_container(container_container,
|
7
|
+
prefix_container(container_container,
|
8
|
+
anchor_xref(node, container, container: true),
|
8
9
|
node, target)
|
9
10
|
l10n(@i18n.nested_xref.sub("%1", container_label)
|
10
11
|
.sub("%2", linkend))
|
@@ -40,8 +41,8 @@ module IsoDoc
|
|
40
41
|
capitalise_xref(node, linkend, anchor_value(node["target"]))
|
41
42
|
end
|
42
43
|
|
43
|
-
def anchor_xref(node, target)
|
44
|
-
x =
|
44
|
+
def anchor_xref(node, target, container: false)
|
45
|
+
x = anchor_xref_short(node, target, container)
|
45
46
|
t = @xrefs.anchor(target, :title)
|
46
47
|
ret = case node["style"]
|
47
48
|
when "basic" then t
|
@@ -52,9 +53,15 @@ module IsoDoc
|
|
52
53
|
ret || x
|
53
54
|
end
|
54
55
|
|
56
|
+
def anchor_xref_short(node, target, container)
|
57
|
+
if (l = node["label"]) && !container
|
58
|
+
@i18n.l10n("#{l} #{anchor_value(target)}")
|
59
|
+
else @xrefs.anchor(target, :xref)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
55
63
|
def anchor_xref_full(num, title)
|
56
64
|
(!title.nil? && !title.empty?) or return nil
|
57
|
-
|
58
65
|
l10n("#{num}, #{title}")
|
59
66
|
end
|
60
67
|
|
@@ -77,7 +84,8 @@ module IsoDoc
|
|
77
84
|
capitalise_xref(node, linkend, anchor_value(node["target"]))
|
78
85
|
end
|
79
86
|
|
80
|
-
# Note % to entry and Note % to entry:
|
87
|
+
# Note % to entry and Note % to entry:
|
88
|
+
# cannot conflate as Note % to entry 1 and 2
|
81
89
|
# So Notes 1 and 3, but Note 1 to entry and Note 3 to entry
|
82
90
|
def combine_conflated_xref_locations(locs)
|
83
91
|
out = if locs.any? { |l| l[:elem]&.include?("%") }
|
@@ -123,8 +131,7 @@ module IsoDoc
|
|
123
131
|
end
|
124
132
|
|
125
133
|
def combine_conn(list)
|
126
|
-
|
127
|
-
|
134
|
+
list.size == 1 and list.first[:label]
|
128
135
|
if list[1..-1].all? { |l| l[:conn] == "and" }
|
129
136
|
@i18n.boolean_conj(list.map { |l| loc2xref(l) }, "and")
|
130
137
|
elsif list[1..-1].all? { |l| l[:conn] == "or" }
|
@@ -154,7 +161,6 @@ module IsoDoc
|
|
154
161
|
linktext[0, 1].match?(/\p{Upper}/) and return linkend
|
155
162
|
node["case"] and
|
156
163
|
return Common::case_with_markup(linkend, node["case"], @script)
|
157
|
-
|
158
164
|
capitalise_xref1(node, linkend)
|
159
165
|
end
|
160
166
|
|
@@ -21,7 +21,6 @@ module IsoDoc
|
|
21
21
|
def convert1(docxml, _filename, _dir)
|
22
22
|
docid_prefixes(docxml) # feeds @xrefs.parse citation processing
|
23
23
|
@xrefs.parse docxml
|
24
|
-
bibitem_lookup(docxml)
|
25
24
|
info docxml, nil
|
26
25
|
conversions(docxml)
|
27
26
|
docxml.root["type"] = "presentation"
|
@@ -29,7 +28,7 @@ module IsoDoc
|
|
29
28
|
end
|
30
29
|
|
31
30
|
def bibitem_lookup(docxml)
|
32
|
-
@
|
31
|
+
@bibitem_lookup ||= docxml.xpath(ns("//references/bibitem"))
|
33
32
|
.each_with_object({}) do |b, m|
|
34
33
|
m[b["id"]] = b
|
35
34
|
end
|
@@ -83,10 +82,12 @@ module IsoDoc
|
|
83
82
|
end
|
84
83
|
|
85
84
|
def inline(docxml)
|
85
|
+
bibitem_lookup(docxml) # feeds citeas
|
86
|
+
citeas docxml # feeds xref, eref, origin, quotesource
|
86
87
|
xref docxml
|
87
|
-
eref docxml # feeds
|
88
|
-
origin docxml # feeds
|
89
|
-
quotesource docxml # feeds
|
88
|
+
eref docxml # feeds eref2link
|
89
|
+
origin docxml # feeds eref2link
|
90
|
+
quotesource docxml # feeds eref2link
|
90
91
|
eref2link docxml
|
91
92
|
mathml docxml
|
92
93
|
ruby docxml
|
data/lib/isodoc/version.rb
CHANGED
@@ -88,8 +88,7 @@ module IsoDoc
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def generate_header(filename, _dir)
|
91
|
-
return nil
|
92
|
-
|
91
|
+
@header or return nil
|
93
92
|
template = IsoDoc::Common.liquid(File.read(@header, encoding: "UTF-8"))
|
94
93
|
meta = @meta.get.merge(@labels ? { labels: @labels } : {})
|
95
94
|
.merge(@meta.labels ? { labels: @meta.labels } : {})
|
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.9.
|
4
|
+
version: 2.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html2doc
|