isodoc 2.9.3 → 2.10.0
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 +21 -2
- data/lib/isodoc/function/blocks_example_note.rb +4 -4
- data/lib/isodoc/function/inline.rb +1 -1
- 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/math.rb +12 -2
- 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/body.rb +8 -0
- data/lib/isodoc/word_function/postprocess.rb +9 -4
- data/lib/isodoc/word_function/postprocess_cover.rb +22 -10
- data/lib/isodoc/xref/xref_gen.rb +4 -4
- data/lib/isodoc/xref/xref_sect_gen.rb +6 -5
- 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: 9d98a917ee770ef1034262fa29628010e3254f3ddb5d8dfe63be54c57c3d58c0
|
4
|
+
data.tar.gz: 64b2107fddc44c0096653fc0319c7b0df81285327ab83600471b1b99971f3dbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b1ac5b466169fd9f2698b79617ef4d2c6dd9dbf35b0cca715102ddddfcb2a0013be3bd02153263da42a7f3cde0150ccffa4f3e16e7b750dd0f73be23420e4b1
|
7
|
+
data.tar.gz: 26338d106c6e1cb5133c305c97ec5a8bb1c75292120ce2928efb93572ea6ff79b203eef4a6d73419d097cad76d6a0e22e71beac64a0f483dc09919e8d7d25e86
|
data/lib/isodoc/convert.rb
CHANGED
@@ -10,7 +10,8 @@ require "mn-requirements"
|
|
10
10
|
module IsoDoc
|
11
11
|
class Convert < ::IsoDoc::Common
|
12
12
|
attr_accessor :options, :i18n, :meta, :xrefs, :reqt_models,
|
13
|
-
:requirements_processor, :doctype, :bibrender
|
13
|
+
:requirements_processor, :doctype, :bibrender,
|
14
|
+
:tempfile_cache, :wordcoverpage, :wordintropage
|
14
15
|
|
15
16
|
# htmlstylesheet: Generic stylesheet for HTML
|
16
17
|
# htmlstylesheet_override: Override stylesheet for HTML
|
@@ -89,11 +90,15 @@ module IsoDoc
|
|
89
90
|
i18nhash: @i18n.get))
|
90
91
|
end
|
91
92
|
|
93
|
+
def convert1_namespaces(html)
|
94
|
+
html.add_namespace("epub", "http://www.idpf.org/2007/ops")
|
95
|
+
end
|
96
|
+
|
92
97
|
def convert1(docxml, filename, dir)
|
93
98
|
@xrefs.parse docxml
|
94
99
|
noko do |xml|
|
95
100
|
xml.html lang: @lang.to_s do |html|
|
96
|
-
html.parent
|
101
|
+
convert1_namespaces(html.parent)
|
97
102
|
info docxml, nil
|
98
103
|
populate_css
|
99
104
|
html.head { |head| define_head head, filename, dir }
|
@@ -177,5 +182,19 @@ module IsoDoc
|
|
177
182
|
else "##{node['target']}"
|
178
183
|
end
|
179
184
|
end
|
185
|
+
|
186
|
+
# use a different class than self for rendering, as a result
|
187
|
+
# of document-specific criteria
|
188
|
+
# but pass on any singleton methods defined on top of the self instance
|
189
|
+
def swap_renderer(oldklass, newklass, file, input_filename, debug)
|
190
|
+
ref = oldklass # avoid oldklass == self for indirection of methods
|
191
|
+
oldklass.singleton_methods.each do |x|
|
192
|
+
newklass.define_singleton_method(x) do |*args|
|
193
|
+
ref.public_send(x, *args)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
oldklass.singleton_methods.empty? or
|
197
|
+
newklass.convert_init(file, input_filename, debug)
|
198
|
+
end
|
180
199
|
end
|
181
200
|
end
|
@@ -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
|
@@ -8,7 +8,7 @@ module IsoDoc
|
|
8
8
|
node["update-type"] == "true" and url = suffix_url(url)
|
9
9
|
out.a **attr_code(href: url, title: node["alt"]) do |l|
|
10
10
|
if node.elements.empty? && node.text.strip.empty?
|
11
|
-
l << node["target"].sub(/^mailto:/, "")
|
11
|
+
l << @c.encode(node["target"].sub(/^mailto:/, ""), :basic, :hexadecimal)
|
12
12
|
else node.children.each { |n| parse(n, l) }
|
13
13
|
end
|
14
14
|
end
|
@@ -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
|
@@ -100,7 +100,7 @@ module IsoDoc
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def maths_just_numeral(node)
|
103
|
-
mn = node.at("
|
103
|
+
mn = node.at(".//m:mn", MATHML).children
|
104
104
|
if node.parent.name == "stem"
|
105
105
|
node.parent.replace(mn)
|
106
106
|
else
|
@@ -127,12 +127,22 @@ module IsoDoc
|
|
127
127
|
end
|
128
128
|
|
129
129
|
def mathml_number(node, locale)
|
130
|
-
justnumeral = node
|
130
|
+
justnumeral = numeric_mathml?(node)
|
131
131
|
justnumeral or asciimath_dup(node)
|
132
132
|
localize_maths(node, locale)
|
133
133
|
justnumeral and maths_just_numeral(node)
|
134
134
|
end
|
135
135
|
|
136
|
+
def numeric_mathml?(node)
|
137
|
+
m = {}
|
138
|
+
node.traverse do |x|
|
139
|
+
%w(mstyle mrow math text).include?(x.name) and next
|
140
|
+
m[x.name] ||= 0
|
141
|
+
m[x.name] += 1
|
142
|
+
end
|
143
|
+
m.keys.size == 1 && m["mn"] == 1
|
144
|
+
end
|
145
|
+
|
136
146
|
def mathml_style_inherit(node)
|
137
147
|
node.at("./ancestor::xmlns:strong") or return
|
138
148
|
node.children =
|
@@ -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
@@ -5,6 +5,14 @@ require_relative "lists"
|
|
5
5
|
module IsoDoc
|
6
6
|
module WordFunction
|
7
7
|
module Body
|
8
|
+
def convert1_namespaces(html)
|
9
|
+
super
|
10
|
+
html.add_namespace("v", "urn:schemas-microsoft-com:vml")
|
11
|
+
html.add_namespace("o", "urn:schemas-microsoft-com:office:office")
|
12
|
+
html.add_namespace("w", "urn:schemas-microsoft-com:office:word")
|
13
|
+
html.add_namespace("m", "http://schemas.microsoft.com/office/2004/12/omml")
|
14
|
+
end
|
15
|
+
|
8
16
|
def define_head(head, filename, _dir)
|
9
17
|
head.style do |style|
|
10
18
|
loc = File.join(File.dirname(__FILE__), "..", "base_style",
|
@@ -7,17 +7,21 @@ module IsoDoc
|
|
7
7
|
module WordFunction
|
8
8
|
module Postprocess
|
9
9
|
def postprocess(result, filename, dir)
|
10
|
+
result = postprocess_cleanup(result)
|
10
11
|
filename = filename.sub(/\.doc$/, "")
|
11
12
|
header = generate_header(filename, dir)
|
12
|
-
|
13
|
+
@wordstylesheet = wordstylesheet_update
|
13
14
|
toWord(result, filename, dir, header)
|
14
15
|
@files_to_delete.each { |f| FileUtils.rm_f f }
|
15
16
|
end
|
16
17
|
|
17
|
-
def
|
18
|
-
result =
|
18
|
+
def postprocess_cleanup(result)
|
19
|
+
result = cleanup(to_xhtml(textcleanup(result)))
|
20
|
+
from_xhtml(word_cleanup(result))
|
19
21
|
.gsub("-DOUBLE_HYPHEN_ESCAPE-", "--")
|
20
|
-
|
22
|
+
end
|
23
|
+
|
24
|
+
def toWord(result, filename, dir, header)
|
21
25
|
Html2Doc.new(
|
22
26
|
filename: filename, imagedir: @localdir,
|
23
27
|
stylesheet: @wordstylesheet&.path,
|
@@ -60,6 +64,7 @@ module IsoDoc
|
|
60
64
|
word_tab_clean(docxml)
|
61
65
|
authority_cleanup(docxml)
|
62
66
|
word_footnote_format(docxml)
|
67
|
+
word_remove_empty_sections(docxml)
|
63
68
|
docxml
|
64
69
|
end
|
65
70
|
|
@@ -6,21 +6,30 @@ module IsoDoc
|
|
6
6
|
word_intro(docxml, @wordToClevels) if @wordintropage
|
7
7
|
end
|
8
8
|
|
9
|
+
def word_remove_empty_sections(docxml)
|
10
|
+
%w(WordSection1 WordSection2).each do |x|
|
11
|
+
ins = docxml.at("//div[@class='#{x}']") or next
|
12
|
+
@c.decode(ins.text).gsub(/\p{Z}|\p{C}/, "").strip.empty? or next
|
13
|
+
ins.next_element.remove
|
14
|
+
ins.remove
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
9
18
|
def word_cover(docxml)
|
19
|
+
ins = docxml.at('//div[@class="WordSection1"]') or return
|
10
20
|
cover = File.read(@wordcoverpage, encoding: "UTF-8")
|
11
21
|
cover = populate_template(cover, :word)
|
12
22
|
coverxml = to_word_xhtml_fragment(cover)
|
13
|
-
|
14
|
-
coverxml.to_xml(encoding: "US-ASCII")
|
23
|
+
ins.children.first.previous = coverxml.to_xml(encoding: "US-ASCII")
|
15
24
|
end
|
16
25
|
|
17
26
|
def word_intro(docxml, level)
|
27
|
+
ins = docxml.at('//div[@class="WordSection2"]') or return
|
18
28
|
intro = insert_toc(File.read(@wordintropage, encoding: "UTF-8"),
|
19
29
|
docxml, level)
|
20
30
|
intro = populate_template(intro, :word)
|
21
31
|
introxml = to_word_xhtml_fragment(intro)
|
22
|
-
|
23
|
-
introxml.to_xml(encoding: "US-ASCII")
|
32
|
+
ins.children.first.previous = introxml.to_xml(encoding: "US-ASCII")
|
24
33
|
end
|
25
34
|
|
26
35
|
# add namespaces for Word fragments
|
@@ -88,13 +97,9 @@ module IsoDoc
|
|
88
97
|
end
|
89
98
|
|
90
99
|
def generate_header(filename, _dir)
|
91
|
-
return nil
|
92
|
-
|
100
|
+
@header or return nil
|
93
101
|
template = IsoDoc::Common.liquid(File.read(@header, encoding: "UTF-8"))
|
94
|
-
|
95
|
-
.merge(@meta.labels ? { labels: @meta.labels } : {})
|
96
|
-
meta[:filename] = filename
|
97
|
-
params = meta.transform_keys(&:to_s)
|
102
|
+
params = header_params(filename)
|
98
103
|
Tempfile.open(%w(header html),
|
99
104
|
mode: File::BINARY | File::SHARE_DELETE,
|
100
105
|
encoding: "utf-8") do |f|
|
@@ -103,6 +108,13 @@ module IsoDoc
|
|
103
108
|
end
|
104
109
|
end
|
105
110
|
|
111
|
+
def header_params(filename)
|
112
|
+
meta = @meta.get.merge(@labels ? { labels: @labels } : {})
|
113
|
+
.merge(@meta.labels ? { labels: @meta.labels } : {})
|
114
|
+
meta[:filename] = filename
|
115
|
+
meta.transform_keys(&:to_s)
|
116
|
+
end
|
117
|
+
|
106
118
|
def word_section_breaks(docxml)
|
107
119
|
@landscapestyle = ""
|
108
120
|
word_section_breaks1(docxml, "WordSection2")
|
data/lib/isodoc/xref/xref_gen.rb
CHANGED
@@ -88,6 +88,7 @@ module IsoDoc
|
|
88
88
|
|
89
89
|
def admonition_anchor_names(sections)
|
90
90
|
sections.each do |s|
|
91
|
+
s.at(ns(".//admonition[@type = 'box']")) or next
|
91
92
|
notes = s.xpath(child_asset_path("admonition[@type = 'box']"))
|
92
93
|
admonition_anchor_names1(notes, Counter.new)
|
93
94
|
admonition_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
|
@@ -132,20 +133,19 @@ module IsoDoc
|
|
132
133
|
end
|
133
134
|
end
|
134
135
|
|
135
|
-
def list_item_anchor_names(list, list_anchor, depth, prev_label,
|
136
|
-
refer_list)
|
136
|
+
def list_item_anchor_names(list, list_anchor, depth, prev_label, refer_list)
|
137
137
|
c = Counter.new(list["start"] ? list["start"].to_i - 1 : 0)
|
138
138
|
list.xpath(ns("./li")).each do |li|
|
139
139
|
bare_label, label =
|
140
140
|
list_item_value(li, c, depth, { list_anchor: list_anchor, prev_label: prev_label,
|
141
|
-
refer_list: refer_list })
|
141
|
+
refer_list: depth == 1 ? refer_list : nil })
|
142
142
|
li["id"] and @anchors[li["id"]] =
|
143
143
|
{ label: bare_label, bare_xref: "#{label})",
|
144
144
|
xref: "#{label})",
|
145
145
|
type: "listitem", refer_list: refer_list,
|
146
146
|
container: list_anchor[:container] }
|
147
147
|
(li.xpath(ns(".//ol")) - li.xpath(ns(".//ol//ol"))).each do |ol|
|
148
|
-
list_item_anchor_names(ol, list_anchor, depth + 1, label,
|
148
|
+
list_item_anchor_names(ol, list_anchor, depth + 1, label, refer_list)
|
149
149
|
end
|
150
150
|
end
|
151
151
|
end
|
@@ -105,11 +105,12 @@ module IsoDoc
|
|
105
105
|
termnote_anchor_names(doc)
|
106
106
|
termexample_anchor_names(doc)
|
107
107
|
note_anchor_names(doc.xpath(ns("//table | //figure")))
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
108
|
+
sections = doc.xpath(ns(sections_xpath))
|
109
|
+
note_anchor_names(sections)
|
110
|
+
admonition_anchor_names(sections)
|
111
|
+
example_anchor_names(sections)
|
112
|
+
list_anchor_names(sections)
|
113
|
+
deflist_anchor_names(sections)
|
113
114
|
bookmark_anchor_names(doc)
|
114
115
|
end
|
115
116
|
|
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.
|
4
|
+
version: 2.10.0
|
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-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html2doc
|