isodoc 1.8.1 → 1.8.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/Gemfile +2 -0
- data/isodoc.gemspec +1 -1
- data/lib/isodoc/class_utils.rb +1 -1
- data/lib/isodoc/function/cleanup.rb +1 -11
- data/lib/isodoc/function/inline.rb +3 -3
- data/lib/isodoc/function/terms.rb +0 -3
- data/lib/isodoc/function/utils.rb +10 -5
- data/lib/isodoc/i18n.rb +31 -10
- data/lib/isodoc/presentation_function/block.rb +2 -3
- data/lib/isodoc/presentation_function/image.rb +2 -2
- data/lib/isodoc/presentation_function/terms.rb +95 -30
- data/lib/isodoc/presentation_xml_convert.rb +2 -1
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/xref/xref_gen.rb +10 -7
- data/lib/isodoc/xref/xref_gen_seq.rb +159 -148
- data/lib/isodoc/xref/xref_sect_gen.rb +5 -10
- data/lib/isodoc/xref.rb +2 -0
- data/lib/isodoc/xslfo_convert.rb +23 -1
- data/lib/isodoc-yaml/i18n-ar.yaml +3 -0
- data/lib/isodoc-yaml/i18n-de.yaml +3 -0
- data/lib/isodoc-yaml/i18n-en.yaml +8 -5
- data/lib/isodoc-yaml/i18n-es.yaml +3 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +3 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +3 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +3 -0
- data/spec/isodoc/cleanup_spec.rb +0 -129
- data/spec/isodoc/i18n_spec.rb +53 -10
- data/spec/isodoc/inline_spec.rb +33 -43
- data/spec/isodoc/lists_spec.rb +64 -64
- data/spec/isodoc/postproc_spec.rb +0 -73
- data/spec/isodoc/section_spec.rb +12 -12
- data/spec/isodoc/terms_spec.rb +317 -303
- data/spec/isodoc/xref_spec.rb +80 -9
- data/spec/isodoc/xslfo_convert_spec.rb +35 -0
- data/spec/spec_helper.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f13a3c3a1018484dfa9518b6831d188803ca83c2d89ee872ff17723994c0fae7
|
4
|
+
data.tar.gz: b4461e1537e949cbfbc851309cc1f29c974a38fda8728f405591dc586267943c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb0cf999d3a0155a13913543101228f4c1d60c4705dfdd67ca76f4e21fd00e59853040e4bbe516b64d4fc11a0aaf7da3573f8932f6bf7112dd3293ccc82263a2
|
7
|
+
data.tar.gz: c43855701417ffcad7a7e85086b489995ac1af483752c5b9ad1f958fbf944e38a94ca5fd3b4dcf90103608cad6a2d9b6d08fa46a877dffaeef14475212e7056c
|
data/Gemfile
CHANGED
data/isodoc.gemspec
CHANGED
@@ -43,7 +43,7 @@ Gem::Specification.new do |spec|
|
|
43
43
|
spec.add_dependency "twitter_cldr", ">= 6.6.0"
|
44
44
|
spec.add_dependency "uuidtools"
|
45
45
|
|
46
|
-
spec.add_development_dependency "
|
46
|
+
spec.add_development_dependency "debug"
|
47
47
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
48
48
|
spec.add_development_dependency "guard", "~> 2.14"
|
49
49
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
data/lib/isodoc/class_utils.rb
CHANGED
@@ -16,7 +16,7 @@ module IsoDoc
|
|
16
16
|
xpath.gsub(%r{/([a-zA-z])}, "/xmlns:\\1")
|
17
17
|
.gsub(%r{::([a-zA-z])}, "::xmlns:\\1")
|
18
18
|
.gsub(%r{\[([a-zA-z][a-z0-9A-Z@/]* ?=)}, "[xmlns:\\1")
|
19
|
-
.gsub(%r{\[([a-zA-z][a-z0-9A-Z@/]
|
19
|
+
.gsub(%r{\[([a-zA-z][a-z0-9A-Z@/]*[/\]])}, "[xmlns:\\1")
|
20
20
|
end
|
21
21
|
|
22
22
|
def liquid(doc)
|
@@ -2,17 +2,7 @@ module IsoDoc
|
|
2
2
|
module Function
|
3
3
|
module Cleanup
|
4
4
|
def textcleanup(docxml)
|
5
|
-
|
6
|
-
end
|
7
|
-
|
8
|
-
def termref_cleanup(docxml)
|
9
|
-
docxml
|
10
|
-
.gsub(/\s*\[MODIFICATION\]\s*\[\/TERMREF\]/,
|
11
|
-
l10n(", #{@i18n.modified} [/TERMREF]"))
|
12
|
-
.gsub(%r{\s*\[/TERMREF\]\s*</p>\s*<p>\s*\[TERMREF\]}, "; ")
|
13
|
-
.gsub(/\[TERMREF\]\s*/, l10n("[#{@i18n.source}: "))
|
14
|
-
.gsub(%r{\s*\[/TERMREF\]\s*}, l10n("]"))
|
15
|
-
.gsub(/\s*\[MODIFICATION\]/, l10n(", #{@i18n.modified} — "))
|
5
|
+
passthrough_cleanup(docxml)
|
16
6
|
end
|
17
7
|
|
18
8
|
def passthrough_cleanup(docxml)
|
@@ -5,7 +5,7 @@ module IsoDoc
|
|
5
5
|
module Inline
|
6
6
|
def link_parse(node, out)
|
7
7
|
url = node["target"]
|
8
|
-
node["
|
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.text.empty?
|
11
11
|
l << node["target"].sub(/^mailto:/, "")
|
@@ -41,8 +41,8 @@ module IsoDoc
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def eref_target(node)
|
44
|
-
return "##{node['bibitemid']}" unless
|
45
|
-
&.at(ns("./uri[@type = 'citation']"))
|
44
|
+
return "##{node['bibitemid']}" unless (!@bibitems.nil? &&
|
45
|
+
url = @bibitems[node["bibitemid"]]&.at(ns("./uri[@type = 'citation']")))
|
46
46
|
|
47
47
|
href = suffix_url(url.text)
|
48
48
|
anchor = node&.at(ns(".//locality[@type = 'anchor']"))&.text&.strip
|
@@ -6,7 +6,6 @@ module IsoDoc
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def modification_parse(node, out)
|
9
|
-
out << "[MODIFICATION]"
|
10
9
|
para = node.at(ns("./p"))
|
11
10
|
para.children.each { |n| parse(n, out) }
|
12
11
|
end
|
@@ -58,9 +57,7 @@ module IsoDoc
|
|
58
57
|
|
59
58
|
def termref_parse(node, out)
|
60
59
|
out.p do |p|
|
61
|
-
p << "[TERMREF]"
|
62
60
|
node.children.each { |n| parse(n, p) }
|
63
|
-
p << "[/TERMREF]"
|
64
61
|
end
|
65
62
|
end
|
66
63
|
|
@@ -37,10 +37,9 @@ module IsoDoc
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def attr_code(attributes)
|
40
|
-
attributes
|
41
|
-
|
42
|
-
|
43
|
-
end.to_h
|
40
|
+
attributes.compact.transform_values do |v|
|
41
|
+
v.is_a?(String) ? HTMLEntities.new.decode(v) : v
|
42
|
+
end
|
44
43
|
end
|
45
44
|
|
46
45
|
DOCTYPE_HDR = "<!DOCTYPE html SYSTEM "\
|
@@ -188,10 +187,17 @@ module IsoDoc
|
|
188
187
|
end
|
189
188
|
|
190
189
|
def image_localfile(img)
|
190
|
+
case img["src"]
|
191
|
+
when /^data:/
|
192
|
+
save_dataimage(img["src"], false)
|
193
|
+
when %r{^([A-Z]:)?/}
|
194
|
+
img["src"]
|
195
|
+
=begin
|
191
196
|
if /^data:/.match? img["src"]
|
192
197
|
save_dataimage(img["src"], false)
|
193
198
|
elsif %r{^([A-Z]:)?/}.match? img["src"]
|
194
199
|
img["src"]
|
200
|
+
=end
|
195
201
|
else
|
196
202
|
File.join(@localdir, img["src"])
|
197
203
|
end
|
@@ -211,7 +217,6 @@ module IsoDoc
|
|
211
217
|
c = HTMLEntities.new
|
212
218
|
text.split(/([<>])/).each_slice(4).map do |a|
|
213
219
|
a[0] = c.encode(c.decode(a[0]), :hexadecimal)
|
214
|
-
a[2] = c.encode(c.decode(a[2]), :hexadecimal) if a.size >= 3
|
215
220
|
a
|
216
221
|
end.join
|
217
222
|
end
|
data/lib/isodoc/i18n.rb
CHANGED
@@ -55,8 +55,8 @@ module IsoDoc
|
|
55
55
|
@labels = y
|
56
56
|
@labels["language"] = @lang
|
57
57
|
@labels["script"] = @script
|
58
|
-
@labels.each do |k,
|
59
|
-
self.class.send(:define_method, k.downcase) {
|
58
|
+
@labels.each do |k, _v|
|
59
|
+
self.class.send(:define_method, k.downcase) { get[k] }
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -68,19 +68,40 @@ module IsoDoc
|
|
68
68
|
# function localising spaces and punctuation.
|
69
69
|
# Not clear if period needs to be localised for zh
|
70
70
|
def l10n(text, lang = @lang, script = @script)
|
71
|
-
if lang == "zh" && script == "Hans"
|
72
|
-
|
73
|
-
|
74
|
-
|
71
|
+
if lang == "zh" && script == "Hans" then l10n_zh(text)
|
72
|
+
else bidiwrap(text, lang, script)
|
73
|
+
end
|
74
|
+
end
|
75
75
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
76
|
+
def bidiwrap(text, lang, script)
|
77
|
+
my_script, my_rtl, outer_rtl = bidiwrap_vars(lang, script)
|
78
|
+
if my_rtl && !outer_rtl
|
79
|
+
mark = %w(Arab Aran).include?(my_script) ? "؜" : "‏"
|
80
|
+
"#{mark}#{text}#{mark}"
|
81
|
+
elsif !my_rtl && outer_rtl then "‎#{text}‎"
|
80
82
|
else text
|
81
83
|
end
|
82
84
|
end
|
83
85
|
|
86
|
+
def bidiwrap_vars(lang, script)
|
87
|
+
my_script = script || Metanorma::Utils.default_script(lang)
|
88
|
+
[my_script,
|
89
|
+
Metanorma::Utils.rtl_script?(my_script),
|
90
|
+
Metanorma::Utils.rtl_script?(@script || Metanorma::Utils
|
91
|
+
.default_script(@lang))]
|
92
|
+
end
|
93
|
+
|
94
|
+
def l10n_zh(text)
|
95
|
+
xml = Nokogiri::HTML::DocumentFragment.parse(text)
|
96
|
+
xml.traverse do |n|
|
97
|
+
next unless n.text?
|
98
|
+
|
99
|
+
n.replace(n.text.gsub(/ /, "").gsub(/:/, ":").gsub(/,/, "、")
|
100
|
+
.gsub(/\(/, "(").gsub(/\)/, ")").gsub(/\[/, "【").gsub(/\]/, "】"))
|
101
|
+
end
|
102
|
+
xml.to_xml.gsub(/<b>/, "").gsub("</b>", "").gsub(/<\?[^>]+>/, "")
|
103
|
+
end
|
104
|
+
|
84
105
|
def multiple_and(names, andword)
|
85
106
|
return "" if names.empty?
|
86
107
|
return names[0] if names.length == 1
|
@@ -12,11 +12,11 @@ module IsoDoc
|
|
12
12
|
return if number.nil? || number.empty?
|
13
13
|
|
14
14
|
unless name = node.at(ns("./#{elem}"))
|
15
|
-
node.children.empty? and node.add_child("<#{elem}></#{elem}>") or
|
15
|
+
(node.children.empty? and node.add_child("<#{elem}></#{elem}>")) or
|
16
16
|
node.children.first.previous = "<#{elem}></#{elem}>"
|
17
17
|
name = node.children.first
|
18
18
|
end
|
19
|
-
if name.children.empty? then name.add_child(number)
|
19
|
+
if name.children.empty? then name.add_child(cleanup_entities(number))
|
20
20
|
else (name.children.first.previous = "#{number}#{delim}")
|
21
21
|
end
|
22
22
|
end
|
@@ -29,7 +29,6 @@ module IsoDoc
|
|
29
29
|
|
30
30
|
def sourcecode1(elem)
|
31
31
|
return if labelled_ancestor(elem)
|
32
|
-
return unless elem.ancestors("example").empty?
|
33
32
|
|
34
33
|
lbl = @xrefs.anchor(elem["id"], :label, false) or return
|
35
34
|
prefix_name(elem, " — ",
|
@@ -29,8 +29,8 @@ module IsoDoc
|
|
29
29
|
def figure1(elem)
|
30
30
|
return sourcecode1(elem) if elem["class"] == "pseudocode" ||
|
31
31
|
elem["type"] == "pseudocode"
|
32
|
-
return if labelled_ancestor(elem) && elem.ancestors("figure").empty? ||
|
33
|
-
elem.at(ns("./figure")) && !elem.at(ns("./name"))
|
32
|
+
return if (labelled_ancestor(elem) && elem.ancestors("figure").empty?) ||
|
33
|
+
(elem.at(ns("./figure")) && !elem.at(ns("./name")))
|
34
34
|
|
35
35
|
lbl = @xrefs.anchor(elem["id"], :label, false) or return
|
36
36
|
prefix_name(elem, " — ",
|
@@ -28,11 +28,7 @@ module IsoDoc
|
|
28
28
|
ref = node.at(ns("./xref | ./eref | ./termref"))
|
29
29
|
ref && opts[:ref] != "false" and r&.next = " "
|
30
30
|
opts[:ital] == "true" and r&.name = "em"
|
31
|
-
|
32
|
-
ref2 = ref.clone
|
33
|
-
r2 = r.clone
|
34
|
-
r.replace(ref2).children = r2
|
35
|
-
end
|
31
|
+
concept1_linkmention(ref, r, opts)
|
36
32
|
concept1_ref(node, ref, opts)
|
37
33
|
if opts[:ital] == "false"
|
38
34
|
r = node.at(ns(".//renderterm"))
|
@@ -41,6 +37,14 @@ module IsoDoc
|
|
41
37
|
node.replace(node.children)
|
42
38
|
end
|
43
39
|
|
40
|
+
def concept1_linkmention(ref, renderterm, opts)
|
41
|
+
if opts[:linkmention] == "true" && !renderterm.nil? && !ref.nil?
|
42
|
+
ref2 = ref.clone
|
43
|
+
r2 = renderterm.clone
|
44
|
+
renderterm.replace(ref2).children = r2
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
44
48
|
def concept1_ref(_node, ref, opts)
|
45
49
|
ref.nil? and return
|
46
50
|
return ref.remove if opts[:ref] == "false"
|
@@ -78,39 +82,71 @@ module IsoDoc
|
|
78
82
|
end
|
79
83
|
|
80
84
|
def designation(docxml)
|
81
|
-
docxml.xpath(ns("//preferred | //admitted | //deprecates")).each do |p|
|
82
|
-
designation1(p)
|
83
|
-
end
|
84
85
|
docxml.xpath(ns("//term")).each do |t|
|
85
86
|
merge_second_preferred(t)
|
86
87
|
end
|
88
|
+
docxml.xpath(ns("//preferred | //admitted | //deprecates")).each do |p|
|
89
|
+
designation1(p)
|
90
|
+
end
|
87
91
|
end
|
88
92
|
|
89
93
|
def merge_second_preferred(term)
|
90
94
|
pref = nil
|
91
|
-
term.xpath(ns("./preferred")).each_with_index do |p, i|
|
95
|
+
term.xpath(ns("./preferred[expression/name]")).each_with_index do |p, i|
|
92
96
|
if i.zero? then pref = p
|
93
|
-
|
94
|
-
pref
|
97
|
+
elsif merge_preferred_eligible?(pref, p)
|
98
|
+
pref.at(ns("./expression/name")) <<
|
99
|
+
l10n("; #{p.at(ns('./expression/name')).children.to_xml}")
|
95
100
|
p.remove
|
96
101
|
end
|
97
102
|
end
|
98
103
|
end
|
99
104
|
|
105
|
+
def merge_preferred_eligible?(first, second)
|
106
|
+
firstex = first.at(ns("./expression")) || {}
|
107
|
+
secondex = second.at(ns("./expression")) || {}
|
108
|
+
first["geographic-area"] == second["geographic-area"] &&
|
109
|
+
firstex["language"] == secondex["language"] &&
|
110
|
+
!first.at(ns("./pronunciation | ./grammar")) &&
|
111
|
+
!second.at(ns("./pronunciation | ./grammar"))
|
112
|
+
end
|
113
|
+
|
100
114
|
def designation1(desgn)
|
101
115
|
s = desgn.at(ns("./termsource"))
|
102
116
|
name = desgn.at(ns("./expression/name | ./letter-symbol/name | "\
|
103
117
|
"./graphical-symbol")) or return
|
104
118
|
|
119
|
+
designation_annotate(desgn, name)
|
120
|
+
s and desgn.next = s
|
121
|
+
end
|
122
|
+
|
123
|
+
def designation_annotate(desgn, name)
|
124
|
+
designation_boldface(desgn)
|
125
|
+
designation_field(desgn, name)
|
105
126
|
g = desgn.at(ns("./expression/grammar")) and
|
106
|
-
name << " #{designation_grammar(g).join(', ')}"
|
127
|
+
name << ", #{designation_grammar(g).join(', ')}"
|
128
|
+
designation_localization(desgn, name)
|
129
|
+
designation_pronunciation(desgn, name)
|
107
130
|
desgn.children = name.children
|
108
|
-
|
131
|
+
end
|
132
|
+
|
133
|
+
def designation_boldface(desgn)
|
134
|
+
desgn.name == "preferred" or return
|
135
|
+
name = desgn.at(ns("./expression/name | ./letter-symbol/name")) or return
|
136
|
+
name.children = "<strong>#{name.children}</strong>"
|
137
|
+
end
|
138
|
+
|
139
|
+
def designation_field(desgn, name)
|
140
|
+
f = desgn.xpath(ns("./field-of-application | ./usage-info"))
|
141
|
+
&.map { |u| u.children.to_xml }&.join(", ")
|
142
|
+
return nil if f&.empty?
|
143
|
+
|
144
|
+
name << ", <#{f}>"
|
109
145
|
end
|
110
146
|
|
111
147
|
def designation_grammar(grammar)
|
112
148
|
ret = []
|
113
|
-
grammar.xpath(ns("./gender")).each do |x|
|
149
|
+
grammar.xpath(ns("./gender | ./number")).each do |x|
|
114
150
|
ret << @i18n.grammar_abbrevs[x.text]
|
115
151
|
end
|
116
152
|
%w(isPreposition isParticiple isAdjective isVerb isAdverb isNoun)
|
@@ -121,20 +157,28 @@ module IsoDoc
|
|
121
157
|
ret
|
122
158
|
end
|
123
159
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
160
|
+
def designation_localization(desgn, name)
|
161
|
+
loc = [desgn&.at(ns("./expression/@language"))&.text,
|
162
|
+
desgn&.at(ns("./expression/@script"))&.text,
|
163
|
+
desgn&.at(ns("./@geographic-area"))&.text].compact
|
164
|
+
return if loc.empty?
|
165
|
+
|
166
|
+
name << ", #{loc.join(' ')}"
|
167
|
+
end
|
168
|
+
|
169
|
+
def designation_pronunciation(desgn, name)
|
170
|
+
f = desgn.at(ns("./expression/pronunciation")) or return
|
130
171
|
|
131
|
-
|
172
|
+
name << ", /#{f.children.to_xml}/"
|
173
|
+
end
|
174
|
+
|
175
|
+
def termexample(docxml)
|
132
176
|
docxml.xpath(ns("//termexample")).each do |f|
|
133
177
|
example1(f)
|
134
178
|
end
|
135
179
|
end
|
136
180
|
|
137
|
-
|
181
|
+
def termnote(docxml)
|
138
182
|
docxml.xpath(ns("//termnote")).each do |f|
|
139
183
|
termnote1(f)
|
140
184
|
end
|
@@ -155,7 +199,7 @@ module IsoDoc
|
|
155
199
|
def termdefinition1(elem)
|
156
200
|
unwrap_definition(elem)
|
157
201
|
multidef(elem) if elem.xpath(ns("./definition")).size > 1
|
158
|
-
|
202
|
+
end
|
159
203
|
|
160
204
|
def multidef(elem)
|
161
205
|
d = elem.at(ns("./definition"))
|
@@ -167,13 +211,34 @@ module IsoDoc
|
|
167
211
|
d.wrap("<definition></definition>")
|
168
212
|
end
|
169
213
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
v = d&.at(ns("
|
174
|
-
|
175
|
-
d.children = nodes
|
176
|
-
end
|
214
|
+
def unwrap_definition(elem)
|
215
|
+
elem.xpath(ns("./definition")).each do |d|
|
216
|
+
%w(verbal-definition non-verbal-representation).each do |e|
|
217
|
+
v = d&.at(ns("./#{e}"))
|
218
|
+
v&.replace(v.children)
|
177
219
|
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
def termsource(docxml)
|
224
|
+
docxml.xpath(ns("//termsource")).each do |f|
|
225
|
+
termsource1(f)
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
def termsource1(elem)
|
230
|
+
mod = elem.at(ns("./modification")) and
|
231
|
+
termsource_modification(mod)
|
232
|
+
elem.children = l10n("[#{@i18n.source}: #{elem.children.to_xml.strip}]")
|
233
|
+
elem&.next_element&.name == "termsource" and elem.next = "; "
|
234
|
+
end
|
235
|
+
|
236
|
+
def termsource_modification(mod)
|
237
|
+
mod.previous_element.next = ", #{@i18n.modified}"
|
238
|
+
mod.text.strip.empty? or mod.previous = " – "
|
239
|
+
mod.elements.size == 1 and
|
240
|
+
mod.elements[0].replace(mod.elements[0].children)
|
241
|
+
mod.replace(mod.children)
|
242
|
+
end
|
178
243
|
end
|
179
244
|
end
|
@@ -18,7 +18,7 @@ module IsoDoc
|
|
18
18
|
info docxml, nil
|
19
19
|
conversions(docxml)
|
20
20
|
docxml.root["type"] = "presentation"
|
21
|
-
docxml.to_xml
|
21
|
+
docxml.to_xml.gsub(/</, "<").gsub(/>/, ">")
|
22
22
|
end
|
23
23
|
|
24
24
|
def conversions(docxml)
|
@@ -68,6 +68,7 @@ module IsoDoc
|
|
68
68
|
termnote docxml
|
69
69
|
termdefinition docxml
|
70
70
|
designation docxml
|
71
|
+
termsource docxml
|
71
72
|
concept docxml
|
72
73
|
related docxml
|
73
74
|
end
|
data/lib/isodoc/version.rb
CHANGED
data/lib/isodoc/xref/xref_gen.rb
CHANGED
@@ -63,11 +63,8 @@ module IsoDoc
|
|
63
63
|
c.increment(n)
|
64
64
|
idx = increment_label(examples, n, c, false)
|
65
65
|
@anchors[n["id"]] =
|
66
|
-
|
67
|
-
|
68
|
-
# "#{@labels['example_xref']} #{c.print}") }
|
69
|
-
anchor_struct(idx, n,
|
70
|
-
@labels["example_xref"], "termexample", n["unnumbered"])
|
66
|
+
anchor_struct(idx, n, @labels["example_xref"], "termexample",
|
67
|
+
n["unnumbered"])
|
71
68
|
end
|
72
69
|
end
|
73
70
|
end
|
@@ -170,8 +167,7 @@ module IsoDoc
|
|
170
167
|
|
171
168
|
def deflist_term_anchor_names(list, list_anchor)
|
172
169
|
list.xpath(ns("./dt")).each do |li|
|
173
|
-
label = li
|
174
|
-
label = l10n("#{list_anchor[:xref]}: #{label}")
|
170
|
+
label = l10n("#{list_anchor[:xref]}: #{dt2xreflabel(li)}")
|
175
171
|
li["id"] and @anchors[li["id"]] =
|
176
172
|
{ xref: label, type: "deflistitem",
|
177
173
|
container: list_anchor[:container] }
|
@@ -181,6 +177,13 @@ module IsoDoc
|
|
181
177
|
end
|
182
178
|
end
|
183
179
|
|
180
|
+
def dt2xreflabel(dterm)
|
181
|
+
label = dterm.dup
|
182
|
+
label.xpath(ns(".//p")).each { |x| x.replace(x.children) }
|
183
|
+
label.xpath(ns(".//index")).each(&:remove)
|
184
|
+
label.children.to_xml
|
185
|
+
end
|
186
|
+
|
184
187
|
def bookmark_anchor_names(xml)
|
185
188
|
xml.xpath(ns(".//bookmark")).reject { |n| blank?(n["id"]) }.each do |n|
|
186
189
|
parent = nil
|