isodoc 2.11.1 → 2.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/base_style/all.css +1 -1
- data/lib/isodoc/base_style/reset.css +1 -1
- data/lib/isodoc/base_style/reset.scss +1 -1
- data/lib/isodoc/function/cleanup.rb +2 -1
- data/lib/isodoc/function/section.rb +2 -1
- data/lib/isodoc/function/utils.rb +8 -8
- data/lib/isodoc/gem_tasks.rb +1 -1
- data/lib/isodoc/html_function/postprocess.rb +2 -2
- data/lib/isodoc/html_function/postprocess_cover.rb +6 -4
- data/lib/isodoc/html_function/postprocess_footnotes.rb +52 -47
- data/lib/isodoc/presentation_function/bibdata.rb +4 -5
- data/lib/isodoc/presentation_function/block.rb +5 -3
- data/lib/isodoc/presentation_function/erefs.rb +25 -20
- data/lib/isodoc/presentation_function/image.rb +3 -2
- data/lib/isodoc/presentation_function/inline.rb +4 -1
- data/lib/isodoc/presentation_function/math.rb +2 -0
- data/lib/isodoc/presentation_function/metadata.rb +12 -4
- data/lib/isodoc/presentation_function/section.rb +6 -11
- data/lib/isodoc/presentation_function/terms.rb +1 -1
- data/lib/isodoc/presentation_function/xrefs.rb +5 -5
- data/lib/isodoc/presentation_xml_convert.rb +2 -1
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/postprocess_cover.rb +4 -2
- data/lib/isodoc/xslfo_convert.rb +8 -2
- data/lib/isodoc-yaml/i18n-ar.yaml +4 -4
- data/lib/isodoc-yaml/i18n-de.yaml +4 -4
- data/lib/isodoc-yaml/i18n-en.yaml +5 -8
- data/lib/isodoc-yaml/i18n-es.yaml +4 -4
- data/lib/isodoc-yaml/i18n-fr.yaml +4 -4
- data/lib/isodoc-yaml/i18n-ja.yaml +10 -10
- data/lib/isodoc-yaml/i18n-ru.yaml +4 -7
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +4 -4
- data/lib/nokogiri/xml/node.rb +13 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4228f130d19273b278dcf701d27c405d37a7843b053eed057b424af2d7399b09
|
4
|
+
data.tar.gz: 003b627868c9e53ae1eb6baf7f9cb71a06a3e3e0c09b6102cd5e1dc7c45faee5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e865cfbe5a51e7a78a1562b7d88b7930a0eacf8db22e94c0e4ed0dc12f7c76b75975c98296a0f1624c82d729fdc03a5715f01237a14b68fa8b612a17f297a49
|
7
|
+
data.tar.gz: 533d41c63cf5955bc60f7223716cfea1151d959d0cdec32577154159c88abe4d9c0d81b2c8256fccc3e1b02d2e59dd8dcff613dee425f64ce417e390b77e3fe2
|
@@ -83,7 +83,8 @@ module IsoDoc
|
|
83
83
|
# subclause
|
84
84
|
def symbols_parse(isoxml, out)
|
85
85
|
isoxml.at(ns("./title")) or
|
86
|
-
isoxml.children.first.previous = "<title>#{@i18n.symbols}</title>"
|
86
|
+
#isoxml.children.first.previous = "<title>#{@i18n.symbols}</title>"
|
87
|
+
isoxml.add_first_child "<title>#{@i18n.symbols}</title>"
|
87
88
|
clause_parse(isoxml, out)
|
88
89
|
end
|
89
90
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "metanorma-utils"
|
2
|
+
require_relative "../../nokogiri/xml/node"
|
2
3
|
|
3
4
|
module IsoDoc
|
4
5
|
module Function
|
@@ -27,8 +28,8 @@ module IsoDoc
|
|
27
28
|
[1..count].each { out << tab }
|
28
29
|
end
|
29
30
|
|
30
|
-
def noko(&
|
31
|
-
Metanorma::Utils::noko_html(&
|
31
|
+
def noko(&)
|
32
|
+
Metanorma::Utils::noko_html(&)
|
32
33
|
end
|
33
34
|
|
34
35
|
def attr_code(attributes)
|
@@ -40,8 +41,7 @@ module IsoDoc
|
|
40
41
|
DOCTYPE_HDR = "<!DOCTYPE html SYSTEM " \
|
41
42
|
'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'.freeze
|
42
43
|
|
43
|
-
HUGESTRICT =
|
44
|
-
Nokogiri::XML::ParseOptions::HUGE |
|
44
|
+
HUGESTRICT = Nokogiri::XML::ParseOptions::HUGE |
|
45
45
|
Nokogiri::XML::ParseOptions::STRICT
|
46
46
|
|
47
47
|
def to_xhtml(xml)
|
@@ -62,7 +62,7 @@ module IsoDoc
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def to_xhtml_prep(xml)
|
65
|
-
xml.gsub!(/<\?xml[
|
65
|
+
xml.gsub!(/<\?xml[^<>]*>/, "")
|
66
66
|
xml.include?("<!DOCTYPE ") || (xml = DOCTYPE_HDR + xml)
|
67
67
|
numeric_escapes(xml)
|
68
68
|
end
|
@@ -130,8 +130,8 @@ module IsoDoc
|
|
130
130
|
|
131
131
|
def header_strip(hdr)
|
132
132
|
h1 = to_xhtml_fragment(hdr.to_s.gsub(%r{<br\s*/>}, " ")
|
133
|
-
.gsub(%r{</?p(\s[
|
134
|
-
.gsub(/<\/?h[123456][
|
133
|
+
.gsub(%r{</?p(\s[^<>]+)?>}, "")
|
134
|
+
.gsub(/<\/?h[123456][^<>]*>/, "").gsub(/<\/?b[^<>]*>/, "").dup)
|
135
135
|
h1.traverse do |x|
|
136
136
|
if x.name == "span" && x["style"]&.include?("mso-tab-count")
|
137
137
|
x.replace(" ")
|
@@ -243,7 +243,7 @@ module IsoDoc
|
|
243
243
|
win = !!((RUBY_PLATFORM =~ /(win|w)(32|64)$/) ||
|
244
244
|
(RUBY_PLATFORM =~ /mswin|mingw/))
|
245
245
|
if win
|
246
|
-
path.
|
246
|
+
path.tr!(%{/}, "\\")
|
247
247
|
path[/\s/] ? "\"#{path}\"" : path
|
248
248
|
else path
|
249
249
|
end
|
data/lib/isodoc/gem_tasks.rb
CHANGED
@@ -6,9 +6,9 @@ module IsoDoc
|
|
6
6
|
module HtmlFunction
|
7
7
|
module Html
|
8
8
|
def script_cdata(result)
|
9
|
-
result.gsub(%r{<script([
|
9
|
+
result.gsub(%r{<script([^<>]*)>\s*<!\[CDATA\[}m, "<script\\1>")
|
10
10
|
.gsub(%r{\]\]>\s*</script>}, "</script>")
|
11
|
-
.gsub(%r{<!\[CDATA\[\s*<script([
|
11
|
+
.gsub(%r{<!\[CDATA\[\s*<script([^<>]*)>}m, "<script\\1>")
|
12
12
|
.gsub(%r{</script>\s*\]\]>}, "</script>")
|
13
13
|
end
|
14
14
|
|
@@ -82,7 +82,8 @@ module IsoDoc
|
|
82
82
|
def html_cover(docxml)
|
83
83
|
doc = to_xhtml_fragment(File.read(@htmlcoverpage, encoding: "UTF-8"))
|
84
84
|
d = docxml.at('//div[@class="title-section"]')
|
85
|
-
d.children.first.add_previous_sibling(
|
85
|
+
#d.children.first.add_previous_sibling(
|
86
|
+
d.add_first_child(
|
86
87
|
populate_template(doc.to_xml(encoding: "US-ASCII"), :html),
|
87
88
|
)
|
88
89
|
end
|
@@ -90,7 +91,8 @@ module IsoDoc
|
|
90
91
|
def html_intro(docxml)
|
91
92
|
doc = to_xhtml_fragment(File.read(@htmlintropage, encoding: "UTF-8"))
|
92
93
|
d = docxml.at('//div[@class="prefatory-section"]')
|
93
|
-
d.children.first.add_previous_sibling(
|
94
|
+
#d.children.first.add_previous_sibling(
|
95
|
+
d.add_first_child(
|
94
96
|
populate_template(doc.to_xml(encoding: "US-ASCII"), :html),
|
95
97
|
)
|
96
98
|
end
|
@@ -1,59 +1,64 @@
|
|
1
|
-
module IsoDoc
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
module IsoDoc
|
2
|
+
module HtmlFunction
|
3
|
+
module Html
|
4
|
+
def update_footnote_filter(fnote, xref, idx, seen)
|
5
|
+
if seen[fnote.text]
|
6
|
+
xref.at("./sup").content = seen[fnote.text][:num].to_s
|
7
|
+
fnote.remove unless xref["href"] == seen[fnote.text][:href]
|
8
|
+
xref["href"] = seen[fnote.text][:href]
|
9
|
+
else
|
10
|
+
seen[fnote.text] = { num: idx, href: xref["href"] }
|
11
|
+
xref.at("./sup").content = idx.to_s
|
12
|
+
idx += 1
|
13
|
+
end
|
14
|
+
[idx, seen]
|
12
15
|
end
|
13
|
-
[i, seen]
|
14
|
-
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
def html_footnote_filter(docxml)
|
18
|
+
seen = {}
|
19
|
+
i = 1
|
20
|
+
docxml.xpath('//a[@class = "FootnoteRef"]').each do |x|
|
21
|
+
fn = docxml.at(%<//*[@id = '#{x['href'].sub(/^#/, '')}']>) || next
|
22
|
+
i, seen = update_footnote_filter(fn, x, i, seen)
|
23
|
+
end
|
24
|
+
docxml
|
22
25
|
end
|
23
|
-
docxml
|
24
|
-
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
def footnote_backlinks1(xref, footnote)
|
28
|
+
xdup = xref.dup
|
29
|
+
xdup.remove["id"]
|
30
|
+
if footnote.elements.empty?
|
31
|
+
#footnote.children.empty? and footnote << " "
|
32
|
+
#footnote.children.first.previous = xdup
|
33
|
+
footnote.add_first_child xdup
|
34
|
+
else
|
35
|
+
#footnote.elements.first.children.first.previous = xdup
|
36
|
+
footnote.elements.first.add_first_child xdup
|
37
|
+
end
|
33
38
|
end
|
34
|
-
end
|
35
39
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
def footnote_backlinks(docxml)
|
41
|
+
seen = {}
|
42
|
+
docxml.xpath('//a[@class = "FootnoteRef"]').each_with_index do |x, i|
|
43
|
+
(seen[x["href"]] and next) or seen[x["href"]] = true
|
44
|
+
fn = docxml.at(%<//*[@id = '#{x['href'].sub(/^#/, '')}']>) || next
|
45
|
+
footnote_backlinks1(x, fn)
|
46
|
+
x["id"] ||= "fnref:#{i + 1}"
|
47
|
+
fn.add_child "<a href='##{x['id']}'>↩</a>"
|
48
|
+
end
|
49
|
+
docxml
|
44
50
|
end
|
45
|
-
docxml
|
46
|
-
end
|
47
51
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
def footnote_format(docxml)
|
53
|
+
docxml.xpath("//a[@class = 'FootnoteRef']/sup").each do |x|
|
54
|
+
footnote_reference_format(x)
|
55
|
+
end
|
56
|
+
docxml.xpath("//a[@class = 'TableFootnoteRef'] | "\
|
57
|
+
"//span[@class = 'TableFootnoteRef']").each do |x|
|
58
|
+
table_footnote_reference_format(x)
|
59
|
+
end
|
60
|
+
docxml
|
55
61
|
end
|
56
|
-
docxml
|
57
62
|
end
|
58
63
|
end
|
59
64
|
end
|
@@ -29,11 +29,10 @@ module IsoDoc
|
|
29
29
|
|
30
30
|
def bibdata_current(docxml)
|
31
31
|
a = docxml.at(ns("//bibdata")) or return
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
l.text == @script and l["current"] = "true"
|
32
|
+
{ language: @lang, script: @script, locale: @locale }.each do |k, v|
|
33
|
+
a.xpath(ns("./#{k}")).each do |l|
|
34
|
+
l.text == v and l["current"] = "true"
|
35
|
+
end
|
37
36
|
end
|
38
37
|
a
|
39
38
|
end
|
@@ -16,8 +16,9 @@ module IsoDoc
|
|
16
16
|
def prefix_name(node, delim, number, elem)
|
17
17
|
number.nil? || number.empty? and return
|
18
18
|
unless name = node.at(ns("./#{elem}"))
|
19
|
-
(node.children.empty? and node.add_child("<#{elem}></#{elem}>")) or
|
20
|
-
|
19
|
+
#(node.children.empty? and node.add_child("<#{elem}></#{elem}>")) or
|
20
|
+
# node.children.first.previous = "<#{elem}></#{elem}>"
|
21
|
+
node.add_first_child "<#{elem}></#{elem}>"
|
21
22
|
name = node.children.first
|
22
23
|
end
|
23
24
|
if name.children.empty? then name.add_child(cleanup_entities(number.strip))
|
@@ -118,7 +119,8 @@ module IsoDoc
|
|
118
119
|
end
|
119
120
|
|
120
121
|
def amend1(elem)
|
121
|
-
elem.xpath(ns("./autonumber"
|
122
|
+
elem.xpath(ns("./locality | ./localityStack | ./autonumber | " \
|
123
|
+
"./classification | ./contributor")).each(&:remove)
|
122
124
|
elem.xpath(ns("./newcontent")).each { |a| a.name = "quote" }
|
123
125
|
elem.xpath(ns("./description")).each { |a| a.replace(a.children) }
|
124
126
|
elem.replace(elem.children)
|
@@ -40,7 +40,7 @@ module IsoDoc
|
|
40
40
|
node.delete("droploc") unless droploc
|
41
41
|
eref_localities1({ target:, number: "pl",
|
42
42
|
type: refs.first.at(ns("./locality/@type")).text,
|
43
|
-
from: l10n(ret[1
|
43
|
+
from: l10n(ret[1..].join), node:, lang: @lang })
|
44
44
|
end
|
45
45
|
|
46
46
|
def can_conflate_eref_rendering?(refs)
|
@@ -48,16 +48,13 @@ module IsoDoc
|
|
48
48
|
refs.all? { |r| r.name == "localityStack" } &&
|
49
49
|
refs.all? { |r| r.xpath(ns("./locality")).size == 1 }) or return false
|
50
50
|
first = refs.first.at(ns("./locality/@type")).text
|
51
|
-
refs.all?
|
52
|
-
r.at(ns("./locality/@type")).text == first
|
53
|
-
end
|
51
|
+
refs.all? { |r| r.at(ns("./locality/@type")).text == first }
|
54
52
|
end
|
55
53
|
|
56
54
|
def resolve_eref_connectives(locs)
|
57
55
|
locs = resolve_comma_connectives(locs)
|
58
56
|
locs = resolve_to_connectives(locs)
|
59
|
-
|
60
|
-
|
57
|
+
locs.size < 3 and return locs
|
61
58
|
locs = locs.each_slice(2).with_object([]) do |a, m|
|
62
59
|
m << { conn: a[0], label: a[1] }
|
63
60
|
end
|
@@ -150,7 +147,6 @@ module IsoDoc
|
|
150
147
|
end
|
151
148
|
end
|
152
149
|
|
153
|
-
# def eref_localities1_zh(_target, type, from, upto, node)
|
154
150
|
def eref_localities1_zh(opt)
|
155
151
|
ret = "第#{opt[:from]}" if opt[:from]
|
156
152
|
ret += "–#{opt[:upto]}" if opt[:upto]
|
@@ -159,11 +155,9 @@ module IsoDoc
|
|
159
155
|
ret
|
160
156
|
end
|
161
157
|
|
162
|
-
# def eref_localities1(target, type, from, upto, node, lang = "en")
|
163
158
|
def eref_localities1(opt)
|
164
159
|
opt[:type] == "anchor" and return nil
|
165
160
|
opt[:lang] == "zh" and
|
166
|
-
# return l10n(eref_localities1_zh(target, type, from, upto, node))
|
167
161
|
return l10n(eref_localities1_zh(opt))
|
168
162
|
ret = eref_locality_populate(opt[:type], opt[:node], opt[:number])
|
169
163
|
ret += " #{opt[:from]}" if opt[:from]
|
@@ -188,7 +182,7 @@ module IsoDoc
|
|
188
182
|
.each do |e|
|
189
183
|
href = eref_target(e) or next
|
190
184
|
e.xpath(ns("./locality | ./localityStack")).each(&:remove)
|
191
|
-
if
|
185
|
+
if href[:type] == :anchor then eref2xref(e)
|
192
186
|
else eref2link1(e, href)
|
193
187
|
end
|
194
188
|
end
|
@@ -203,7 +197,9 @@ module IsoDoc
|
|
203
197
|
end
|
204
198
|
|
205
199
|
def eref2link1(node, href)
|
206
|
-
|
200
|
+
url = href[:link]
|
201
|
+
att = href[:type] == :attachment ? "attachment='true'" : ""
|
202
|
+
repl = "<link #{att} target='#{url}'>#{node.children}</link>"
|
207
203
|
node["type"] == "footnote" and repl = "<sup>#{repl}</sup>"
|
208
204
|
node.replace(repl)
|
209
205
|
end
|
@@ -215,20 +211,29 @@ module IsoDoc
|
|
215
211
|
end
|
216
212
|
|
217
213
|
def eref_target(node)
|
218
|
-
|
214
|
+
u = eref_url(node["bibitemid"]) or return nil
|
215
|
+
url = suffix_url(u[:link])
|
219
216
|
anchor = node.at(ns(".//locality[@type = 'anchor']"))
|
220
|
-
|
217
|
+
/^#/.match?(url) || !anchor and return { link: url, type: u[:type] }
|
218
|
+
{ link: "#{url}##{anchor.text.strip}", type: u[:type] }
|
219
|
+
end
|
221
220
|
|
222
|
-
|
221
|
+
def eref_url_prep(id)
|
222
|
+
@bibitem_lookup.nil? and return nil
|
223
|
+
@bibitem_lookup[id]
|
223
224
|
end
|
224
225
|
|
225
226
|
def eref_url(id)
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
"
|
227
|
+
b = eref_url_prep(id) or return nil
|
228
|
+
%i(attachment citation).each do |x|
|
229
|
+
u = b.at(ns("./uri[@type = '#{x}'][@language = '#{@lang}']")) ||
|
230
|
+
b.at(ns("./uri[@type = '#{x}']")) and return { link: u.text, type: x }
|
231
|
+
end
|
232
|
+
if b["hidden"] == "true"
|
233
|
+
u = b.at(ns("./uri")) or return nil
|
234
|
+
{ link: u.text, type: :citation }
|
235
|
+
else { link: "##{id}", type: :anchor }
|
236
|
+
end
|
232
237
|
end
|
233
238
|
end
|
234
239
|
end
|
@@ -38,7 +38,7 @@ module IsoDoc
|
|
38
38
|
|
39
39
|
svg = Base64.strict_decode64(elem["src"]
|
40
40
|
.sub(%r{^data:image/svg\+xml;(charset=[^;]+;)?base64,}, ""))
|
41
|
-
x = Nokogiri::XML.fragment(svg.sub(/<\?xml[
|
41
|
+
x = Nokogiri::XML.fragment(svg.sub(/<\?xml[^<>]*>/, ""), &:huge)
|
42
42
|
elem["src"] = ""
|
43
43
|
elem.children = x
|
44
44
|
end
|
@@ -77,7 +77,8 @@ module IsoDoc
|
|
77
77
|
def svg_emf_double(img)
|
78
78
|
if emf?(img["mimetype"])
|
79
79
|
img = emf_encode(img)
|
80
|
-
img.children.first.previous = emf_to_svg(img)
|
80
|
+
#img.children.first.previous = emf_to_svg(img)
|
81
|
+
img.add_first_child emf_to_svg(img)
|
81
82
|
elsif img["mimetype"] == "image/svg+xml"
|
82
83
|
src = svg_to_emf(img) or return
|
83
84
|
img.add_child("<emf/>")
|
@@ -85,7 +85,10 @@ module IsoDoc
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def identifier(docxml)
|
88
|
-
docxml.xpath(ns("//identifier"))
|
88
|
+
(docxml.xpath(ns("//identifier")) -
|
89
|
+
docxml.xpath(ns("//bibdata/identifier")) -
|
90
|
+
docxml.xpath(ns("//bibitema/identifier")))
|
91
|
+
.each do |n|
|
89
92
|
n.name = "tt"
|
90
93
|
end
|
91
94
|
end
|
@@ -40,6 +40,8 @@ module IsoDoc
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def implicit_number_formatter(num, locale)
|
43
|
+
num.ancestors("formula").empty? or return
|
44
|
+
## by default, no formatting in formulas
|
43
45
|
fmt = { significant: num_totaldigits(num.text) }.compact
|
44
46
|
n = normalise_number(num.text)
|
45
47
|
@numfmt.localized_number(n, locale:, format: fmt,
|
@@ -5,6 +5,12 @@ module IsoDoc
|
|
5
5
|
fonts_metadata(docxml)
|
6
6
|
attachments_extract(docxml)
|
7
7
|
preprocess_xslt_insert(docxml)
|
8
|
+
localized_strings(docxml)
|
9
|
+
a = docxml.at(ns("//metanorma-extension")) or return
|
10
|
+
a.elements.empty? and a.remove
|
11
|
+
end
|
12
|
+
|
13
|
+
def localized_strings(docxml)
|
8
14
|
a = docxml.at(ns("//bibdata")) or return
|
9
15
|
a.next =
|
10
16
|
"<localized-strings>#{i8n_name(trim_hash(@i18n.get), '').join}" \
|
@@ -37,9 +43,11 @@ module IsoDoc
|
|
37
43
|
|
38
44
|
def extension_insert_pt(xml)
|
39
45
|
xml.at(ns("//metanorma-extension")) ||
|
40
|
-
xml.at(ns("//bibdata"))
|
46
|
+
xml.at(ns("//bibdata"))
|
47
|
+
&.after("<metanorma-extension> </metanorma-extension>")
|
41
48
|
&.next_element ||
|
42
|
-
xml.root.elements.first
|
49
|
+
xml.root.elements.first
|
50
|
+
.before("<metanorma-extension> </metanorma-extension>")
|
43
51
|
.previous_element
|
44
52
|
end
|
45
53
|
|
@@ -58,7 +66,7 @@ module IsoDoc
|
|
58
66
|
def fonts_metadata(xmldoc)
|
59
67
|
ins = presmeta_insert_pt(xmldoc)
|
60
68
|
@fontist_fonts and CSV.parse_line(@fontist_fonts, col_sep: ";")
|
61
|
-
.map(&:strip).
|
69
|
+
.map(&:strip).reverse_each do |f|
|
62
70
|
ins.next = presmeta("fonts", f)
|
63
71
|
end
|
64
72
|
@fontlicenseagreement and
|
@@ -67,7 +75,7 @@ module IsoDoc
|
|
67
75
|
|
68
76
|
def presmeta_insert_pt(xmldoc)
|
69
77
|
xmldoc.at(ns("//presentation-metadata")) ||
|
70
|
-
xmldoc
|
78
|
+
extension_insert_pt(xmldoc).children.last
|
71
79
|
end
|
72
80
|
|
73
81
|
def presmeta(name, value)
|
@@ -6,8 +6,7 @@ module IsoDoc
|
|
6
6
|
s = docxml.at(ns("//sections")) or return
|
7
7
|
t = @meta.get[:doctitle]
|
8
8
|
t.nil? || t.empty? and return
|
9
|
-
s.
|
10
|
-
"<p class='zzSTDTitle1'>#{t}</p>"
|
9
|
+
s.add_first_child "<p class='zzSTDTitle1'>#{t}</p>"
|
11
10
|
end
|
12
11
|
|
13
12
|
def clause(docxml)
|
@@ -16,7 +15,6 @@ module IsoDoc
|
|
16
15
|
.each do |f|
|
17
16
|
f.parent.name == "annex" &&
|
18
17
|
@xrefs.klass.single_term_clause?(f.parent) and next
|
19
|
-
|
20
18
|
clause1(f)
|
21
19
|
end
|
22
20
|
end
|
@@ -41,14 +39,13 @@ module IsoDoc
|
|
41
39
|
p = "//clause | //annex | //appendix | //introduction | //foreword | " \
|
42
40
|
"//preface/abstract | //acknowledgements | //terms | " \
|
43
41
|
"//definitions | //references | //colophon | //indexsect"
|
44
|
-
docxml.xpath(ns(p)).each
|
45
|
-
floattitle1(f)
|
46
|
-
end
|
42
|
+
docxml.xpath(ns(p)).each { |f| floattitle1(f) }
|
47
43
|
# top-level
|
48
44
|
docxml.xpath(ns("//sections | //preface | //colophon"))
|
49
45
|
.each { |f| floattitle1(f) }
|
50
46
|
end
|
51
47
|
|
48
|
+
# TODO not currently doing anything with the @depth attribute of floating-title
|
52
49
|
def floattitle1(elem)
|
53
50
|
elem.xpath(ns(".//floating-title")).each do |p|
|
54
51
|
p.name = "p"
|
@@ -67,9 +64,8 @@ module IsoDoc
|
|
67
64
|
|
68
65
|
def annex1(elem)
|
69
66
|
lbl = @xrefs.anchor(elem["id"], :label)
|
70
|
-
|
67
|
+
t = elem.at(ns("./title")) and
|
71
68
|
t.children = "<strong>#{to_xml(t.children)}</strong>"
|
72
|
-
end
|
73
69
|
unnumbered_clause?(elem) and return
|
74
70
|
prefix_name(elem, "<br/><br/>", lbl, "title")
|
75
71
|
end
|
@@ -129,7 +125,7 @@ module IsoDoc
|
|
129
125
|
%w(note admonition p).include?(p.name) or break m
|
130
126
|
m << p
|
131
127
|
end
|
132
|
-
out.reject { |c| c["displayorder"] }.
|
128
|
+
out.reject { |c| c["displayorder"] }.reverse_each do |c|
|
133
129
|
c["displayorder"] = idx
|
134
130
|
idx += 1
|
135
131
|
end
|
@@ -195,7 +191,6 @@ module IsoDoc
|
|
195
191
|
preface.elements.each do |x|
|
196
192
|
((x.name == "floating-title" || x.at(xpath)) &&
|
197
193
|
xpath != "./self::*[not(following-sibling::*)]") or prev = x
|
198
|
-
# after.include?(x.name) or next
|
199
194
|
x.at(xpath) or next
|
200
195
|
clause == prev and break
|
201
196
|
prev ||= preface.children.first
|
@@ -248,7 +243,7 @@ module IsoDoc
|
|
248
243
|
def toc_refs(docxml)
|
249
244
|
docxml.xpath(ns("//toc//xref[text()]")).each do |x|
|
250
245
|
lbl = @xrefs.anchor(x["target"], :label) or next
|
251
|
-
x.
|
246
|
+
x.add_first_child "#{lbl}<tab/>"
|
252
247
|
end
|
253
248
|
end
|
254
249
|
end
|
@@ -116,7 +116,7 @@ module IsoDoc
|
|
116
116
|
node.xpath(ns("./location")).each_with_object([]) do |l, m|
|
117
117
|
type = @xrefs.anchor(l["target"], :type)
|
118
118
|
m << { conn: l["connective"], target: l["target"],
|
119
|
-
type
|
119
|
+
type:, node: l, elem: @xrefs.anchor(l["target"], :elem),
|
120
120
|
container: @xrefs.anchor(l["target"], :container, false) ||
|
121
121
|
%w(termnote).include?(type) }
|
122
122
|
end
|
@@ -132,13 +132,13 @@ module IsoDoc
|
|
132
132
|
|
133
133
|
def combine_conn(list)
|
134
134
|
list.size == 1 and list.first[:label]
|
135
|
-
if list[1
|
135
|
+
if list[1..].all? { |l| l[:conn] == "and" }
|
136
136
|
@i18n.boolean_conj(list.map { |l| loc2xref(l) }, "and")
|
137
|
-
elsif list[1
|
137
|
+
elsif list[1..].all? { |l| l[:conn] == "or" }
|
138
138
|
@i18n.boolean_conj(list.map { |l| loc2xref(l) }, "or")
|
139
139
|
else
|
140
140
|
ret = loc2xref(list[0])
|
141
|
-
list[1
|
141
|
+
list[1..].each { |l| ret = i18n_chain_boolean(ret, l) }
|
142
142
|
ret
|
143
143
|
end
|
144
144
|
end
|
@@ -156,7 +156,7 @@ module IsoDoc
|
|
156
156
|
end
|
157
157
|
|
158
158
|
def capitalise_xref(node, linkend, label)
|
159
|
-
linktext = linkend.gsub(/<[
|
159
|
+
linktext = linkend.gsub(/<[^<>]+>/, "")
|
160
160
|
(label && !label.empty? && /^#{Regexp.escape(label)}/.match?(linktext)) ||
|
161
161
|
linktext[0, 1].match?(/\p{Upper}/) and return linkend
|
162
162
|
node["case"] and
|
@@ -55,7 +55,8 @@ module IsoDoc
|
|
55
55
|
# feeds middle_title
|
56
56
|
# triggers xrefs reparse, so put references before all other sections,
|
57
57
|
# which alter titles and thus can alter xrefs
|
58
|
-
rearrange_clauses docxml # feeds toc, display_order, clausetitle,
|
58
|
+
rearrange_clauses docxml # feeds toc, display_order, clausetitle,
|
59
|
+
# clause, middle_title
|
59
60
|
middle_title docxml
|
60
61
|
annex docxml
|
61
62
|
clause docxml # feeds clausetitle
|
data/lib/isodoc/version.rb
CHANGED
@@ -22,7 +22,8 @@ module IsoDoc
|
|
22
22
|
cover = File.read(@wordcoverpage, encoding: "UTF-8")
|
23
23
|
cover = populate_template(cover, :word)
|
24
24
|
coverxml = to_word_xhtml_fragment(cover)
|
25
|
-
ins.children.first.previous = coverxml.to_xml(encoding: "US-ASCII")
|
25
|
+
#ins.children.first.previous = coverxml.to_xml(encoding: "US-ASCII")
|
26
|
+
ins.add_first_child coverxml.to_xml(encoding: "US-ASCII")
|
26
27
|
end
|
27
28
|
|
28
29
|
def word_intro(docxml, level)
|
@@ -31,7 +32,8 @@ module IsoDoc
|
|
31
32
|
docxml, level)
|
32
33
|
intro = populate_template(intro, :word)
|
33
34
|
introxml = to_word_xhtml_fragment(intro)
|
34
|
-
ins.children.first.previous = introxml.to_xml(encoding: "US-ASCII")
|
35
|
+
#ins.children.first.previous = introxml.to_xml(encoding: "US-ASCII")
|
36
|
+
ins.add_first_child introxml.to_xml(encoding: "US-ASCII")
|
35
37
|
end
|
36
38
|
|
37
39
|
# add namespaces for Word fragments
|
data/lib/isodoc/xslfo_convert.rb
CHANGED
@@ -39,7 +39,13 @@ module IsoDoc
|
|
39
39
|
nil
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
42
|
+
def baseassetpath(filename)
|
43
|
+
!@baseassetpath && filename and
|
44
|
+
@baseassetpath = File.expand_path(Pathname.new(filename).parent.to_s)
|
45
|
+
end
|
46
|
+
|
47
|
+
def pdf_options(_docxml, filename)
|
48
|
+
baseassetpath(filename)
|
43
49
|
ret = {}
|
44
50
|
font_manifest = @options.dig(MN_OPTIONS_KEY, MN2PDF_FONT_MANIFEST) and
|
45
51
|
ret[MN2PDF_FONT_MANIFEST] = font_manifest
|
@@ -61,7 +67,7 @@ module IsoDoc
|
|
61
67
|
@doctype = Nokogiri::XML(file).at(ns("//bibdata/ext/doctype"))&.text
|
62
68
|
::Metanorma::Output::XslfoPdf.new.convert(
|
63
69
|
filename, output_fname || output_filename(input_fname),
|
64
|
-
xsl, pdf_options(docxml)
|
70
|
+
xsl, pdf_options(docxml, input_fname)
|
65
71
|
)
|
66
72
|
end
|
67
73
|
|
@@ -20,17 +20,17 @@ annex: ملحق
|
|
20
20
|
appendix: تذييل
|
21
21
|
continued: واصلت
|
22
22
|
no_terms_boilerplate: |
|
23
|
-
|
23
|
+
لم يتم سرد أي مصطلحات وتعريفات في هذا المستند.
|
24
24
|
internal_terms_boilerplate: |
|
25
|
-
|
25
|
+
لأغراض هذا المستند، تنطبق المصطلحات والتعريفات التالية.
|
26
26
|
norm_with_refs_pref:
|
27
27
|
تتم الإشارة إلى المستندات التالية في النص بحيث يشكل بعض أو كل محتوياتها متطلبات هذا المستند. للحصول على مراجع مؤرخة، تطبق النسخة المشار إليها فقط. بالنسبة للمراجع غير المؤرخة ، تنطبق أحدث طبعة من الوثيقة المشار إليها (بما في ذلك أي تعديلات).
|
28
28
|
norm_empty_pref:
|
29
29
|
لا توجد مراجع معيارية في هذه الوثيقة.
|
30
30
|
external_terms_boilerplate: |
|
31
|
-
|
31
|
+
لأغراض هذا المستند ، تنطبق المصطلحات والتعريفات الواردة في%.
|
32
32
|
internal_external_terms_boilerplate: |
|
33
|
-
|
33
|
+
لأغراض هذه الوثيقة ،تنطبق المصطلحات والتعاريف الواردة في % وما يلي.
|
34
34
|
no_information_available: "[لا توجد معلومات متاحة]"
|
35
35
|
term_defined_in: "(%)"
|
36
36
|
binary_and: "%1 و %2"
|
@@ -20,9 +20,9 @@ annex: Anhang
|
|
20
20
|
appendix: Appendix
|
21
21
|
continued: Fortsetzung
|
22
22
|
no_terms_boilerplate: |
|
23
|
-
|
23
|
+
In diesem Dokument sind keine Begriffe und Definitionen aufgeführt.
|
24
24
|
internal_terms_boilerplate: |
|
25
|
-
|
25
|
+
Für die Zwecke dieses Dokuments gelten die folgenden Begriffe und Definitionen.
|
26
26
|
norm_with_refs_pref:
|
27
27
|
Auf die folgenden Dokumente wird im Text so verwiesen, dass ihr Inhalt ganz oder
|
28
28
|
teilweise Anforderungen dieses Dokuments darstellt. Bei datierten Verweisen gilt
|
@@ -30,9 +30,9 @@ norm_with_refs_pref:
|
|
30
30
|
referenzierten Dokuments (einschließlich eventueller Änderungen).
|
31
31
|
norm_empty_pref: In diesem Dokument sind keine normativen Verweise enthalten.
|
32
32
|
external_terms_boilerplate: |
|
33
|
-
|
33
|
+
Für die Zwecke dieses Dokuments gelten die in % angegebenen Begriffe und Definitionen.
|
34
34
|
internal_external_terms_boilerplate: |
|
35
|
-
|
35
|
+
Für die Zwecke dieses Dokuments gelten die in % und im Folgenden aufgeführten Begriffe und Definitionen.
|
36
36
|
no_information_available: "[KEINE INFORMATION VERFÜGBAR]"
|
37
37
|
term_defined_in: "(%)"
|
38
38
|
binary_and: "%1 und %2"
|
@@ -21,10 +21,9 @@ annex: Annex
|
|
21
21
|
appendix: Appendix
|
22
22
|
continued: continued
|
23
23
|
no_terms_boilerplate: |
|
24
|
-
|
24
|
+
No terms and definitions are listed in this document.
|
25
25
|
internal_terms_boilerplate: |
|
26
|
-
|
27
|
-
the following terms and definitions apply.</p>
|
26
|
+
For the purposes of this document, the following terms and definitions apply.
|
28
27
|
norm_with_refs_pref:
|
29
28
|
The following documents are referred to in the text in such a way
|
30
29
|
that some or all of their content constitutes requirements of this
|
@@ -32,13 +31,11 @@ norm_with_refs_pref:
|
|
32
31
|
For undated references, the latest edition of the referenced
|
33
32
|
document (including any amendments) applies.
|
34
33
|
norm_empty_pref:
|
35
|
-
|
34
|
+
There are no normative references in this document.
|
36
35
|
external_terms_boilerplate: |
|
37
|
-
|
38
|
-
the terms and definitions given in % apply.</p>
|
36
|
+
For the purposes of this document, the terms and definitions given in % apply.
|
39
37
|
internal_external_terms_boilerplate: |
|
40
|
-
|
41
|
-
given in % and the following apply.</p>
|
38
|
+
For the purposes of this document, the terms and definitions given in % and the following apply.
|
42
39
|
no_information_available: "[NO INFORMATION AVAILABLE]"
|
43
40
|
term_defined_in: "(%)"
|
44
41
|
binary_and: "%1 and %2"
|
@@ -20,9 +20,9 @@ annex: Anexo
|
|
20
20
|
appendix: Apéndice
|
21
21
|
continued: continuación
|
22
22
|
no_terms_boilerplate: |
|
23
|
-
|
23
|
+
En este documento no se enumeran términos ni definiciones.
|
24
24
|
internal_terms_boilerplate: |
|
25
|
-
|
25
|
+
Para los propósitos de este documento, se aplican los siguientes términos y definiciones.
|
26
26
|
norm_with_refs_pref:
|
27
27
|
Los siguientes documentos se mencionan en el texto de tal manera que
|
28
28
|
parte o todo su contenido constituye requisitos de este documento.
|
@@ -32,9 +32,9 @@ norm_with_refs_pref:
|
|
32
32
|
norm_empty_pref:
|
33
33
|
No hay referencias normativas en este documento.
|
34
34
|
external_terms_boilerplate: |
|
35
|
-
|
35
|
+
Para los propósitos de este documento, se aplican los términos y definiciones dados en %.
|
36
36
|
internal_external_terms_boilerplate: |
|
37
|
-
|
37
|
+
Para los propósitos de este documento, se aplican los términos y definiciones dados en % y los siguientes.
|
38
38
|
no_information_available: "[NO HAY INFORMACIÓN DISPONIBLE]"
|
39
39
|
term_defined_in: "(%)"
|
40
40
|
binary_and: "%1 y %2"
|
@@ -21,17 +21,17 @@ annex: Annexe
|
|
21
21
|
appendix: Appendice
|
22
22
|
continued: continué
|
23
23
|
no_terms_boilerplate: |
|
24
|
-
|
24
|
+
Aucun terme n’est défini dans le présent document.
|
25
25
|
internal_terms_boilerplate: |
|
26
|
-
|
26
|
+
Pour les besoins du présent document, les termes et définitions suivants s’appliquent.
|
27
27
|
norm_with_refs_pref:
|
28
28
|
Les documents suivants cités dans le texte constituent, pour tout ou partie de leur contenu, des exigences du présent document. Pour les références datées, seule l’édition citée s’applique. Pour les références non datées, la dernière édition du document de référence s’applique (y compris les éventuels amendements).
|
29
29
|
norm_empty_pref:
|
30
30
|
Le présent document ne contient aucune référence normative.
|
31
31
|
external_terms_boilerplate: |
|
32
|
-
|
32
|
+
Pour les besoins du présent document, les termes et définitions de % s’appliquent.
|
33
33
|
internal_external_terms_boilerplate: |
|
34
|
-
|
34
|
+
Pour les besoins du présent document, les termes et définitions de % ainsi que les suivants, s’appliquent.
|
35
35
|
no_information_available: "[PAS D’INFORMATION DISPONIBLE]"
|
36
36
|
term_defined_in: "(%)"
|
37
37
|
binary_and: "%1 et %2"
|
@@ -6,32 +6,32 @@ symbols: 記号
|
|
6
6
|
table_of_contents: 目次
|
7
7
|
introduction: 序文
|
8
8
|
foreword: まえがき
|
9
|
-
abstract:
|
10
|
-
acknowledgements:
|
9
|
+
abstract: はじめに
|
10
|
+
acknowledgements: 謝辞
|
11
11
|
termsdef: 用語及び定義
|
12
12
|
termsdefsymbolsabbrev: 用語及び定義並びに記号及び略語
|
13
13
|
termsdefsymbols: 用語及び定義並びに記号
|
14
14
|
termsdefabbrev: 用語及び定義並びに略語
|
15
15
|
normref: 引用規格
|
16
16
|
bibliography: 参考文献
|
17
|
-
preface:
|
18
|
-
section:
|
17
|
+
preface: 序文
|
18
|
+
section: セクション
|
19
19
|
clause: 箇条
|
20
20
|
annex: 附属書
|
21
21
|
appendix: Appendix
|
22
22
|
continued: 続き
|
23
23
|
no_terms_boilerplate: |
|
24
|
-
|
24
|
+
この規格には,定義する用語はない。
|
25
25
|
internal_terms_boilerplate: |
|
26
|
-
|
26
|
+
この規格で用いる主な用語及び定義は,次による。
|
27
27
|
norm_with_refs_pref:
|
28
28
|
次に掲げる引用規格は,この規格に引用されることによって,その一部又は全部がこの規格の要 求事項を構成している。これらの引用規格のうち,西暦年を付記してあるものは,記載の年の版を適 用し,その後の改正版(追補を含む。)は適用しない。西暦年の付記がない引用規格は,その最新版(追 補を含む。)を適用する。
|
29
29
|
norm_empty_pref:
|
30
30
|
この規格には,引用規格はない。
|
31
31
|
external_terms_boilerplate: |
|
32
|
-
|
32
|
+
この規格で用いる主な用語及び定義は,% による。
|
33
33
|
internal_external_terms_boilerplate: |
|
34
|
-
|
34
|
+
この規格で用いる主な用語及び定義は,次によるほか,% による。
|
35
35
|
no_information_available: "[情報はありません]"
|
36
36
|
term_defined_in: "(%)"
|
37
37
|
binary_and: "%1 and %2"
|
@@ -123,7 +123,7 @@ locality: {
|
|
123
123
|
subclause: 細分箇条,
|
124
124
|
part: 部,
|
125
125
|
paragraph: 段落,
|
126
|
-
chapter:
|
126
|
+
chapter: 第章,
|
127
127
|
page: ページ,
|
128
128
|
table: 表,
|
129
129
|
annex: 附属書,
|
@@ -154,7 +154,7 @@ relatedterms:
|
|
154
154
|
equivalent: equivalent
|
155
155
|
compare: compare
|
156
156
|
contrast: contrast
|
157
|
-
see:
|
157
|
+
see: 参照
|
158
158
|
seealso: see also
|
159
159
|
inflection:
|
160
160
|
Clause:
|
@@ -20,10 +20,9 @@ annex: Дополнение
|
|
20
20
|
appendix: Приложение
|
21
21
|
continued: продолжение
|
22
22
|
no_terms_boilerplate: |
|
23
|
-
|
23
|
+
Термины и определения не перечислены в этом документе.
|
24
24
|
internal_terms_boilerplate: |
|
25
|
-
|
26
|
-
применяются следующие термины и определения.</p>
|
25
|
+
Для целей этого документа применяются следующие термины и определения.
|
27
26
|
norm_with_refs_pref:
|
28
27
|
Следующие документы упоминаются в тексте таким образом,
|
29
28
|
что некоторая часть или все их содержание являются требованиями
|
@@ -33,11 +32,9 @@ norm_with_refs_pref:
|
|
33
32
|
norm_empty_pref:
|
34
33
|
Нет нормативных ссылок в этом документе.
|
35
34
|
external_terms_boilerplate: |
|
36
|
-
|
37
|
-
термины и определения, данные в %.</p>
|
35
|
+
Для целей этого документа применяются термины и определения, данные в %.
|
38
36
|
internal_external_terms_boilerplate: |
|
39
|
-
|
40
|
-
термины и определения, данные в % и следующие.</p>
|
37
|
+
Для целей этого документа применяются термины и определения, данные в % и следующие.
|
41
38
|
no_information_available: "[ИНФОРМАЦИЯ ОТСУТСТВУЕТ]"
|
42
39
|
term_defined_in: "(%)"
|
43
40
|
binary_and: "%1 и %2"
|
@@ -21,9 +21,9 @@ annex: 附件
|
|
21
21
|
appendix: 附录
|
22
22
|
continued: 继续
|
23
23
|
no_terms_boilerplate: |
|
24
|
-
|
24
|
+
本文件不提供术语和定义。
|
25
25
|
internal_terms_boilerplate: |
|
26
|
-
|
26
|
+
下列术语和定义适用于本文件。
|
27
27
|
norm_with_refs_pref:
|
28
28
|
下列文件对于本文件的应用是必不可少的。
|
29
29
|
凡是注日期的引用文件,仅注日期的版本适用于本文件。
|
@@ -31,9 +31,9 @@ norm_with_refs_pref:
|
|
31
31
|
norm_empty_pref:
|
32
32
|
本文件并没有规范性引用文件。
|
33
33
|
external_terms_boilerplate: |
|
34
|
-
|
34
|
+
% 界定的术语和定义适用于本文件。
|
35
35
|
internal_external_terms_boilerplate: |
|
36
|
-
|
36
|
+
% 界定的以及下列术语和定义适用于本文件。
|
37
37
|
no_information_available: "[无资料]"
|
38
38
|
term_defined_in: "(%)"
|
39
39
|
binary_and: "%1和%2"
|
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.11.
|
4
|
+
version: 2.11.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: 2024-
|
11
|
+
date: 2024-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|
@@ -460,6 +460,7 @@ files:
|
|
460
460
|
- lib/metanorma/output/base.rb
|
461
461
|
- lib/metanorma/output/utils.rb
|
462
462
|
- lib/metanorma/output/xslfo.rb
|
463
|
+
- lib/nokogiri/xml/node.rb
|
463
464
|
- lib/relaton/render-isodoc/config.yml
|
464
465
|
- lib/relaton/render-isodoc/general.rb
|
465
466
|
homepage: https://github.com/metanorma/isodoc
|