metanorma-ieee 1.4.3 → 1.4.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/html2doc/ieee_wp/lists.rb +2 -1
- data/lib/isodoc/ieee/ieee.amendment.xsl +165 -40
- data/lib/isodoc/ieee/ieee.standard.xsl +165 -40
- data/lib/isodoc/ieee/presentation_concepts.rb +167 -0
- data/lib/isodoc/ieee/presentation_terms.rb +35 -341
- data/lib/isodoc/ieee/presentation_xml_convert.rb +14 -11
- data/lib/isodoc/ieee/xref.rb +8 -15
- data/lib/metanorma/ieee/basicdoc.rng +14 -8
- data/lib/metanorma/ieee/biblio-standoc.rng +37 -7
- data/lib/metanorma/ieee/biblio.rng +30 -18
- data/lib/metanorma/ieee/front.rb +1 -2
- data/lib/metanorma/ieee/ieee.rng +0 -32
- data/lib/metanorma/ieee/isodoc.rng +115 -96
- data/lib/metanorma/ieee/relaton-ieee.rng +34 -37
- data/lib/metanorma/ieee/reqt.rng +7 -6
- data/lib/metanorma/ieee/validate.rb +2 -4
- data/lib/metanorma/ieee/version.rb +1 -1
- metadata +3 -2
@@ -1,7 +1,7 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module Ieee
|
3
3
|
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
|
4
|
-
def multidef(
|
4
|
+
def multidef(_elem, defn, fmt_defn)
|
5
5
|
ctr = IsoDoc::XrefGen::Counter.new("@")
|
6
6
|
coll = defn.each_with_object([]) do |d, m|
|
7
7
|
ctr.increment(d)
|
@@ -10,73 +10,21 @@ module IsoDoc
|
|
10
10
|
.first.add_first_child("<strong>(#{ctr.print})</strong> ")
|
11
11
|
m << ret
|
12
12
|
end
|
13
|
-
#require "debug"; binding.b
|
14
13
|
fmt_defn << coll.map { |c| to_xml(c) }.join(" ")
|
15
|
-
#coll.each { |x| unwrap_definition1(x) }
|
16
|
-
#fmt_defn << unwrap_multidef(coll)
|
17
14
|
end
|
18
15
|
|
19
16
|
def unwrap_multidef(coll)
|
20
17
|
if coll.all? do |c|
|
21
18
|
c.elements.size == 1 && c.elements.first.name == "p"
|
22
19
|
end
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
ret = coll.map do |c|
|
21
|
+
c.children = c.elements.first.children
|
22
|
+
end
|
23
|
+
return "<p>#{ret.map { |x| to_xml(x) }.join}</p>"
|
27
24
|
end
|
28
25
|
coll.map { |c| to_xml(c.children) }.join(" ")
|
29
26
|
end
|
30
27
|
|
31
|
-
=begin
|
32
|
-
def unwrap_definition(elem)
|
33
|
-
elem.xpath(ns("./definition")).each do |d|
|
34
|
-
%w(verbal-definition non-verbal-representation).each do |e|
|
35
|
-
v = d&.at(ns("./#{e}"))
|
36
|
-
v&.replace(v.children)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
to
|
42
|
-
|
43
|
-
def unwrap_definition(_elem, fmt_defn)
|
44
|
-
fmt_defn.xpath(ns(".//semx[@element = 'definition']")).each do |d|
|
45
|
-
%w(verbal-definition non-verbal-representation).each do |e|
|
46
|
-
v = d&.at(ns("./#{e}"))
|
47
|
-
v&.replace(v.children)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
en
|
51
|
-
|
52
|
-
=end
|
53
|
-
|
54
|
-
def designation(docxml)
|
55
|
-
super
|
56
|
-
end
|
57
|
-
|
58
|
-
def deprecates(desgn)
|
59
|
-
desgn.remove
|
60
|
-
end
|
61
|
-
|
62
|
-
def designation_boldface(desgn)
|
63
|
-
#desgn["element"] == "preferred" or return
|
64
|
-
name = desgn.at(ns("./expression/name | ./letter-symbol/name")) or return
|
65
|
-
name.children = "<strong>#{name.children}</strong>"
|
66
|
-
end
|
67
|
-
|
68
|
-
def unwrap_definition(docxml)
|
69
|
-
docxml.xpath(ns(".//definition/verbal-definition")).each do |v|
|
70
|
-
v.elements.all? { |e| %w(termsource p).include?(e.name) } or next
|
71
|
-
p = v.xpath(ns("./p"))
|
72
|
-
s = v.xpath(ns('./termsource'))
|
73
|
-
s.empty? or s = " (#{s.map { |x| to_xml(x) }.join("\n")})"
|
74
|
-
v.children =
|
75
|
-
"<p>#{p.map(&:children).map { |x| to_xml(x) }.join("\n")}#{s}</p>"
|
76
|
-
end
|
77
|
-
super
|
78
|
-
end
|
79
|
-
|
80
28
|
def unwrap_definition(_elem, fmt_defn)
|
81
29
|
fmt_defn.xpath(ns(".//semx[@element = 'definition']")).each do |d|
|
82
30
|
unwrap_definition1(d)
|
@@ -84,201 +32,32 @@ end
|
|
84
32
|
end
|
85
33
|
|
86
34
|
def unwrap_definition1(d)
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
end
|
35
|
+
%w(verbal-definition non-verbal-representation).each do |e|
|
36
|
+
v = d.at(ns("./#{e}")) or next
|
37
|
+
if v.elements.all? { |n| %w(termsource p).include?(n.name) }
|
38
|
+
p = v.xpath(ns("./p"))
|
39
|
+
s = v.xpath(ns("./termsource"))
|
40
|
+
s.empty? or s = " (#{s.map { |x| to_xml(x) }.join})"
|
41
|
+
v.children =
|
42
|
+
"#{p.map(&:children).map { |x| to_xml(x) }.join("\n")}#{s}"
|
43
|
+
else
|
44
|
+
s = v.xpath(ns("./termsource"))
|
45
|
+
unless s.empty?
|
46
|
+
s[0].previous = " ("
|
47
|
+
s[-1].next = ")"
|
101
48
|
end
|
102
|
-
v.replace(v.children)
|
103
49
|
end
|
104
|
-
|
105
|
-
|
106
|
-
def related_designation1(desgn)
|
107
|
-
super
|
108
|
-
end
|
109
|
-
|
110
|
-
def related(docxml)
|
111
|
-
insert_related_type(docxml)
|
112
|
-
admitted_to_related docxml
|
113
|
-
term_reorder(docxml)
|
114
|
-
docxml.xpath(ns("//term[fmt-related/semx]")).each { |f| related_term(f) }
|
115
|
-
end
|
116
|
-
|
117
|
-
# temporarily insert related/@type to fmt-related/semx, for sorting
|
118
|
-
def insert_related_type(docxml)
|
119
|
-
docxml.xpath(ns("//fmt-related/semx")).each do |r|
|
120
|
-
orig = semx_orig(r)
|
121
|
-
r["type"] = orig["type"]
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
def related_term(term)
|
126
|
-
#require "debug"; binding.b
|
127
|
-
#coll = term_related_reorder(term.xpath(ns("./fmt-related/semx")))
|
128
|
-
r = term.at(ns("./fmt-related"))
|
129
|
-
r.xpath(ns(".//xref | .//eref | .//termref")).each(&:remove)
|
130
|
-
coll = sort_related(r.xpath(ns("./semx")))
|
131
|
-
r.children = term_related_collapse(coll)
|
132
|
-
end
|
133
|
-
|
134
|
-
def term_related_collapse(coll)
|
135
|
-
prev = 0
|
136
|
-
coll[0].wrap("<p></p>")
|
137
|
-
coll[1..-1].each_with_index do |r, i|
|
138
|
-
if coll[prev]["type"] != r["type"]
|
139
|
-
prev = i
|
140
|
-
r.wrap("<p></p>")
|
141
|
-
next
|
142
|
-
end
|
143
|
-
|
144
|
-
#coll[prev].at(ns("./preferred")) << "; #{to_xml(r.at(ns('./preferred'))
|
145
|
-
#.children)}"
|
146
|
-
coll[prev] << "; #{to_xml(r)}"
|
147
|
-
r.remove
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
def term_related_collapse(coll)
|
152
|
-
prev = 0
|
153
|
-
ret = [[coll[0]]]
|
154
|
-
coll[1..-1].each do |r|
|
155
|
-
if ret[-1][0]["type"] != r["type"]
|
156
|
-
ret << [r]
|
157
|
-
next
|
158
|
-
end
|
159
|
-
ret[-1] << r
|
160
|
-
end
|
161
|
-
ret.map { |x| x.map { |y| to_xml(y) }.join("; ") }.map { |x| "<p>#{x}</p>" }.join("\n")
|
162
|
-
end
|
163
|
-
|
164
|
-
def sort_terms_key(term)
|
165
|
-
d = term.at(ns("./preferred/expression/name | " \
|
166
|
-
"./preferred/letter-symbol/name | " \
|
167
|
-
"./preferred/graphical-symbol/figure/name | " \
|
168
|
-
"./preferred/graphical-symbol/figure/@id | " \
|
169
|
-
"./preferred | ./fmt-preferred//semx"))
|
170
|
-
f = term.at(ns("./field-of-application")) || term.at(ns("./domain"))
|
171
|
-
@c.decode("#{sort_terms_key1(d)} :: #{sort_terms_key1(f)}")
|
172
|
-
end
|
173
|
-
|
174
|
-
def sort_terms_key1(elem)
|
175
|
-
elem.nil? and return "zzzz"
|
176
|
-
dup = elem.dup
|
177
|
-
dup.xpath(ns(".//asciimath | .//latexmath")).each(&:remove)
|
178
|
-
dup.text&.strip&.downcase || "zzzz"
|
179
|
-
end
|
180
|
-
|
181
|
-
#KILL
|
182
|
-
def term_related_reorder(coll)
|
183
|
-
ins = coll.first.previous_element
|
184
|
-
ret = sort_related(coll)
|
185
|
-
coll.each(&:remove)
|
186
|
-
ret.reverse_each { |t| ins.next = t }
|
187
|
-
ins.parent.xpath(ns("./related"))
|
188
|
-
end
|
189
|
-
|
190
|
-
def sort_related(coll)
|
191
|
-
coll.sort do |a, b|
|
192
|
-
sort_related_key(a) <=> sort_related_key(b)
|
50
|
+
v.replace(v.children)
|
193
51
|
end
|
194
52
|
end
|
195
53
|
|
196
|
-
def sort_related_key(related)
|
197
|
-
type = case related["type"]
|
198
|
-
when "contrast" then 1
|
199
|
-
when "equivalent" then 2
|
200
|
-
when "see" then 3
|
201
|
-
when "seealso" then 4
|
202
|
-
else "5-#{related['type']}"
|
203
|
-
end
|
204
|
-
"#{type} :: #{sort_terms_key(related)}"
|
205
|
-
end
|
206
|
-
|
207
54
|
def termcleanup(docxml)
|
208
55
|
collapse_term docxml
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
def admitted_to_related(docxml)
|
214
|
-
docxml.xpath(ns("//term")).each do |t|
|
215
|
-
t.xpath(ns("./fmt-admitted/semx | ./fmt-preferred/semx")).each_with_index do |a, i|
|
216
|
-
orig = semx_orig(a)
|
217
|
-
(i.zero? ||
|
218
|
-
orig.at(ns("./abbreviation-type | ./graphical-symbol"))) and next
|
219
|
-
out = t.at(ns("./fmt-related")) || t.at(ns("./definition")).before("<fmt-related/>").previous
|
220
|
-
admitted_to_related1(a, t.at(ns("./fmt-preferred/semx")), out)
|
221
|
-
a.parent.name == "fmt-preferred" and a.remove
|
222
|
-
end
|
223
|
-
t.at(ns("./fmt-admitted"))&.remove
|
224
|
-
end
|
225
|
-
#term_reorder(docxml)
|
226
|
-
end
|
227
|
-
|
228
|
-
def admitted_to_related1(adm, pref, out)
|
229
|
-
new = adm.dup
|
230
|
-
adm["type"] = "equivalent"
|
231
|
-
adm.name = "related"
|
232
|
-
adm.children = "<preferred>#{to_xml(adm.children)}</preferred>"
|
233
|
-
adm.parent.next = <<~TERM
|
234
|
-
<term><preferred>#{to_xml(new.children)}</preferred>
|
235
|
-
<related type='see'><preferred>#{to_xml(pref.children)}</preferred></related></term>
|
236
|
-
TERM
|
237
|
-
end
|
238
|
-
|
239
|
-
def admitted_to_related1(adm, pref, out)
|
240
|
-
out << <<~TERM
|
241
|
-
<semx element='related' source='#{adm['source']}' type='equivalent'><fmt-preferred>#{to_xml(adm)}</p></semx></fmt-preferred>
|
242
|
-
TERM
|
243
|
-
out.parent.next = <<~TERM
|
244
|
-
<term><fmt-preferred>#{to_xml(adm)}</fmt-preferred>
|
245
|
-
<fmt-related>
|
246
|
-
<semx element="related" source="#{pref['source']}" type="see"><fmt-preferred>#{to_xml(pref)}</fmt-preferred></semx>
|
247
|
-
</fmt-related>
|
248
|
-
<fmt-definition></fmt-definition></term>
|
249
|
-
TERM
|
250
|
-
end
|
251
|
-
|
252
|
-
#KILL
|
253
|
-
def related1(node)
|
254
|
-
require "debug"; binding.b
|
255
|
-
p, ref, orig = related1_prep(node)
|
256
|
-
label = @i18n.relatedterms[orig["type"]].upcase
|
257
|
-
if p
|
258
|
-
node.children =(l10n("<p><strong>#{label}:</strong> " \
|
259
|
-
"<em>#{to_xml(p)}</em></p>"))
|
260
|
-
else
|
261
|
-
node.children = (l10n("<p><strong>#{label}:</strong> " \
|
262
|
-
"<strong>**RELATED TERM NOT FOUND**</strong></p>"))
|
263
|
-
end
|
264
|
-
end
|
265
|
-
|
266
|
-
def term_reorder(xmldoc)
|
267
|
-
xmldoc.xpath(ns("//terms")).each { |t| term_reorder1(t) }
|
268
|
-
end
|
269
|
-
|
270
|
-
def term_reorder1(terms)
|
271
|
-
ins = terms.at(ns("./term"))&.previous_element or return
|
272
|
-
coll = terms.xpath(ns("./term"))
|
273
|
-
ret = sort_terms(coll)
|
274
|
-
coll.each(&:remove)
|
275
|
-
ret.reverse_each { |t| ins.next = t }
|
276
|
-
end
|
277
|
-
|
278
|
-
def sort_terms(terms)
|
279
|
-
terms.sort do |a, b|
|
280
|
-
sort_terms_key(a) <=> sort_terms_key(b)
|
56
|
+
# temp attribute from insert_related_type
|
57
|
+
docxml.xpath(ns("//term//semx[@type]")).each do |x|
|
58
|
+
x.delete("type")
|
281
59
|
end
|
60
|
+
super
|
282
61
|
end
|
283
62
|
|
284
63
|
def termcontainers(docxml)
|
@@ -293,13 +72,6 @@ TERM
|
|
293
72
|
end
|
294
73
|
|
295
74
|
def collapse_term1(term)
|
296
|
-
#pref = term.xpath(ns("./fmt-preferred//semx")).each_with_index.with_object([]) do |(a, i), m|
|
297
|
-
#orig = semx_orig(a, term)
|
298
|
-
#if i.zero? || orig.at(ns("./abbreviation-type | ./graphical-symbol"))
|
299
|
-
#m << a
|
300
|
-
#end
|
301
|
-
#end
|
302
|
-
|
303
75
|
ret = collapse_term_template(
|
304
76
|
pref: term.at(ns("./fmt-preferred")),
|
305
77
|
def: term.at(ns("./fmt-definition")),
|
@@ -312,20 +84,9 @@ TERM
|
|
312
84
|
ins.children = ret
|
313
85
|
end
|
314
86
|
|
315
|
-
def collapse_term_related(rels)
|
316
|
-
ret = rels.map do |r|
|
317
|
-
p = r.at(ns("./preferred"))
|
318
|
-
rel = p ? to_xml(p.children) : "**RELATED TERM NOT FOUND**"
|
319
|
-
"<em>#{@i18n.relatedterms[r['type']]}:</em> #{rel}"
|
320
|
-
end.join(". ")
|
321
|
-
ret += "." unless ret.empty?
|
322
|
-
ret
|
323
|
-
end
|
324
|
-
|
325
87
|
def collapse_term_related(rels)
|
326
88
|
rels or return
|
327
89
|
rels.xpath(ns("./p")).each do |p|
|
328
|
-
#require "debug"; binding.b
|
329
90
|
orig = p.at(ns(".//semx[@element = 'related']"))
|
330
91
|
reln = "<em>#{@i18n.relatedterms[orig['type']]}:</em> "
|
331
92
|
p.add_first_child reln
|
@@ -333,29 +94,23 @@ TERM
|
|
333
94
|
r.at(ns("./fmt-preferred")) or r.add_first_child "**RELATED TERM NOT FOUND**"
|
334
95
|
end
|
335
96
|
end
|
336
|
-
ret = rels.xpath(ns("./p")).map
|
97
|
+
ret = rels.xpath(ns("./p")).map do |x|
|
98
|
+
to_xml(x.children).strip
|
99
|
+
end.join(". ")
|
337
100
|
ret += "." unless ret.empty?
|
338
101
|
ret
|
339
102
|
end
|
340
103
|
|
341
104
|
def collapse_term_template(opt)
|
342
105
|
defn, multiblock = collapse_unwrap_definition(opt[:def])
|
343
|
-
#
|
344
|
-
src = nil
|
106
|
+
#src = nil
|
345
107
|
opt[:source] and src = "(#{to_xml(opt[:source].remove.children).strip})"
|
346
108
|
t = collapse_term_pref(opt)
|
347
|
-
#require "debug"; opt[:pref].nil? and binding.b
|
348
|
-
#require "debug"; opt[:rels].empty? or binding.b
|
349
109
|
tail = "#{collapse_term_related(opt[:rels])} #{src}"
|
350
110
|
if multiblock
|
351
111
|
tail = tail.strip.empty? ? "" : "<p>#{tail}</p>"
|
352
|
-
|
353
|
-
|
354
|
-
TERM
|
355
|
-
else
|
356
|
-
<<~TERM
|
357
|
-
<p>#{t}: #{defn} #{tail}</p>
|
358
|
-
TERM
|
112
|
+
"<p>#{t}:</p> #{defn}#{tail}"
|
113
|
+
else "<p>#{t}: #{defn} #{tail}</p>"
|
359
114
|
end
|
360
115
|
end
|
361
116
|
|
@@ -369,11 +124,9 @@ TERM
|
|
369
124
|
end
|
370
125
|
p.xpath(ns(".//fmt-termsource")).each { |x| x.replace(x.children) }
|
371
126
|
to_xml(p.children).strip
|
372
|
-
|
373
127
|
end
|
374
128
|
|
375
129
|
def collapse_unwrap_definition(defn)
|
376
|
-
#require "debug"; binding.b
|
377
130
|
defn.nil? and return nil, nil
|
378
131
|
s = defn.xpath(ns(".//fmt-termsource"))
|
379
132
|
p = defn.at(ns(".//p"))
|
@@ -381,25 +134,17 @@ TERM
|
|
381
134
|
.map { |x| to_xml(x) }.join
|
382
135
|
# fmt-definition/semx/p
|
383
136
|
elems = defn.at(ns("./semx")) || defn
|
384
|
-
multiblock = elems.at(ns("./table | ./formula | ./dl | ./ol | ./ul")) ||
|
137
|
+
multiblock = elems.at(ns("./table | ./formula | ./dl | ./ol | ./ul")) ||
|
138
|
+
elems.xpath(ns("./p")).size > 1
|
385
139
|
[defn.elements, multiblock]
|
386
140
|
end
|
387
141
|
|
388
|
-
|
389
|
-
def termsource1xx(elem)
|
390
|
-
while elem&.next_element&.name == "termsource"
|
391
|
-
elem << "; #{to_xml(elem.next_element.remove.children)}"
|
392
|
-
end
|
142
|
+
def termsource_label(elem, sources)
|
393
143
|
adapt = termsource_adapt(elem["status"]) and
|
394
|
-
|
144
|
+
sources = "#{adapt}#{sources}"
|
145
|
+
elem.replace(l10n(sources))
|
395
146
|
end
|
396
147
|
|
397
|
-
def termsource_label(elem, sources)
|
398
|
-
adapt = termsource_adapt(elem["status"]) and
|
399
|
-
sources = "#{adapt}#{sources}"
|
400
|
-
elem.replace(l10n(sources))
|
401
|
-
end
|
402
|
-
|
403
148
|
def termsource_adapt(status)
|
404
149
|
case status
|
405
150
|
when "adapted" then @i18n.adapted_from
|
@@ -407,53 +152,7 @@ TERM
|
|
407
152
|
end
|
408
153
|
|
409
154
|
# domain is rendered in designation_field instead
|
410
|
-
def termdomain(elem, domain)
|
411
|
-
#d = elem.at(ns(".//domain")) or return
|
412
|
-
#d["hidden"] = "true"
|
413
|
-
end
|
414
|
-
|
415
|
-
def designation_field(desgn, name, orig)
|
416
|
-
if desgn["element"] == "preferred"
|
417
|
-
f = orig.parent.xpath(ns("./domain | ./subject"))
|
418
|
-
.map { |u| to_xml(semx_fmt_dup(u)) }.join(", ")
|
419
|
-
#require 'debug'; binding.b
|
420
|
-
name << "<span class='fmt-designation-field'>, <#{f}></span>" unless f.empty?
|
421
|
-
end
|
422
|
-
super
|
423
|
-
end
|
424
|
-
|
425
|
-
def merge_second_preferred(term)
|
426
|
-
pref =
|
427
|
-
term.at(ns("./preferred[not(abbreviation-type)]/expression/name"))
|
428
|
-
x = term.xpath(ns("./preferred[expression/name][abbreviation-type] | " \
|
429
|
-
"./admitted[expression/name][abbreviation-type]"))
|
430
|
-
(pref && !x.empty?) or return
|
431
|
-
tail = x.map do |p|
|
432
|
-
to_xml(p.remove.at(ns("./expression/name")).children).strip
|
433
|
-
end.join(", ")
|
434
|
-
pref << " (#{tail})"
|
435
|
-
end
|
436
|
-
|
437
|
-
def merge_second_preferred(term)
|
438
|
-
term.name == "fmt-admitted" and return
|
439
|
-
pref =
|
440
|
-
term.parent.at(ns("./preferred[not(abbreviation-type)][expression/name]"))
|
441
|
-
x = term.parent.xpath(ns("./preferred[expression/name][abbreviation-type] | " \
|
442
|
-
"./admitted[expression/name][abbreviation-type]"))
|
443
|
-
(pref && !x.empty?) or return
|
444
|
-
fmt_pref = term.parent.at(ns(".//semx[@source = '#{pref['id']}']"))
|
445
|
-
fdf = fmt_pref.at(ns(".//span[@class = 'fmt-designation-field']"))&.text
|
446
|
-
out = to_xml(fmt_pref)
|
447
|
-
tail = x.map do |p|
|
448
|
-
#require "debug"; binding.b
|
449
|
-
ret = term.parent.at(ns(".//semx[@source = '#{p['id']}']")).remove
|
450
|
-
fdf1 = ret.at(ns(".//span[@class = 'fmt-designation-field']"))
|
451
|
-
fdf1 && (fdf1&.text == fdf) and fdf1.remove # repetition of domain suppressed
|
452
|
-
to_xml(ret).strip
|
453
|
-
end.join(", ")
|
454
|
-
out += " (#{tail})"
|
455
|
-
term.children = out
|
456
|
-
end
|
155
|
+
def termdomain(elem, domain); end
|
457
156
|
|
458
157
|
def termnote1(elem)
|
459
158
|
lbl = termnote_label(elem)
|
@@ -466,11 +165,6 @@ fdf = fmt_pref.at(ns(".//span[@class = 'fmt-designation-field']"))&.text
|
|
466
165
|
end
|
467
166
|
|
468
167
|
def term(docxml); end
|
469
|
-
|
470
|
-
def concept1(node)
|
471
|
-
concept_render(node, ital: "false", ref: "false", bold: "false",
|
472
|
-
linkref: "false", linkmention: "false")
|
473
|
-
end
|
474
168
|
end
|
475
169
|
end
|
476
170
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative "init"
|
2
2
|
require_relative "presentation_bibdata"
|
3
3
|
require_relative "presentation_terms"
|
4
|
+
require_relative "presentation_concepts"
|
4
5
|
require_relative "presentation_ref"
|
5
6
|
require "isodoc"
|
6
7
|
|
@@ -35,7 +36,7 @@ module IsoDoc
|
|
35
36
|
end
|
36
37
|
|
37
38
|
def subclause?(target, type, from)
|
38
|
-
(from&.
|
39
|
+
(from&.include?(".") && type == "clause") ||
|
39
40
|
target&.gsub(/<[^<>]+>/, "")&.match?(/^IEV$|^IEC 60050-/)
|
40
41
|
end
|
41
42
|
|
@@ -104,16 +105,7 @@ module IsoDoc
|
|
104
105
|
end
|
105
106
|
|
106
107
|
def annex_delim(_elem)
|
107
|
-
|
108
|
-
end
|
109
|
-
|
110
|
-
# KILL
|
111
|
-
def annex1_default(elem)
|
112
|
-
lbl = @xrefs.anchor(elem["id"], :label)
|
113
|
-
if t = elem.at(ns("./title"))
|
114
|
-
t.children = "<strong>#{to_xml(t.children)}</strong>"
|
115
|
-
end
|
116
|
-
prefix_name(elem, { caption: "<br/>" }, lbl, "title")
|
108
|
+
"<br/>"
|
117
109
|
end
|
118
110
|
|
119
111
|
def amend1(elem)
|
@@ -184,6 +176,8 @@ module IsoDoc
|
|
184
176
|
end
|
185
177
|
end
|
186
178
|
|
179
|
+
# overrides IsoDoc:: XrefGen::OlTypeProvider: we trigger
|
180
|
+
# @xrefs.list_anchor_names after this is called, with elem["type"] set
|
187
181
|
def ol_depth_rotate(node, idx)
|
188
182
|
depth = node.ancestors("ol").size + idx
|
189
183
|
type = :alphabet
|
@@ -192,6 +186,15 @@ module IsoDoc
|
|
192
186
|
type
|
193
187
|
end
|
194
188
|
|
189
|
+
def ul_label_list(_elem)
|
190
|
+
if @doctype == "whitepaper" ||
|
191
|
+
%w(icap industry-connection-report).include?(@subdoctype)
|
192
|
+
%w(▪ —)
|
193
|
+
else
|
194
|
+
%w(–)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
195
198
|
def middle_title(docxml)
|
196
199
|
s = middle_title_insert(docxml) or return
|
197
200
|
s.previous = middle_title_body
|
data/lib/isodoc/ieee/xref.rb
CHANGED
@@ -50,13 +50,14 @@ module IsoDoc
|
|
50
50
|
"#{@klass.norm_ref_xpath} | //sections/terms | " \
|
51
51
|
"//sections/definitions | //clause[parent::sections]"
|
52
52
|
if @hierarchical_assets
|
53
|
-
hierarchical_asset_names(doc.xpath("//xmlns:preface/child::*"),
|
53
|
+
hierarchical_asset_names(doc.xpath("//xmlns:preface/child::*"),
|
54
|
+
"Preface")
|
54
55
|
doc.xpath(ns(middle_sections)).each do |c|
|
55
56
|
hierarchical_asset_names(c, @anchors[c["id"]][:label])
|
56
57
|
end
|
57
58
|
else
|
58
|
-
sequential_asset_names(doc.xpath(ns("//preface/* | "
|
59
|
-
#sequential_asset_names(doc.xpath(ns(middle_sections)))
|
59
|
+
sequential_asset_names(doc.xpath(ns("//preface/* | #{middle_sections}")))
|
60
|
+
# sequential_asset_names(doc.xpath(ns(middle_sections)))
|
60
61
|
end
|
61
62
|
end
|
62
63
|
|
@@ -77,20 +78,12 @@ module IsoDoc
|
|
77
78
|
sequence = UUIDTools::UUID.random_create.to_s
|
78
79
|
notes = t.xpath(ns("./termnote"))
|
79
80
|
notes.noblank.each do |n|
|
80
|
-
|
81
|
-
{ label: termnote_label(n, increment_label(notes, n, c)),
|
81
|
+
@anchors[n["id"]] =
|
82
|
+
{ label: termnote_label(n, increment_label(notes, n, c)),
|
82
83
|
value: c.print, elem: @labels["termnote"],
|
83
|
-
container: t["id"],
|
84
|
+
container: t["id"], type: "termnote",
|
84
85
|
xref: anchor_struct_xref(c.print, n, @labels["note_xref"]) }
|
85
|
-
.merge(sequence: sequence)
|
86
|
-
=begin
|
87
|
-
anchor_struct(
|
88
|
-
termnote_label(n, increment_label(notes, n, c)),
|
89
|
-
#labelled_autonum(@labels["termnote"], increment_label(notes, n, c)),
|
90
|
-
#"#{@labels['termnote']} #{increment_label(notes, n, c)}",
|
91
|
-
n, @labels["note_xref"], "termnote", { container: true })
|
92
86
|
.merge(sequence: sequence)
|
93
|
-
=end
|
94
87
|
end
|
95
88
|
end
|
96
89
|
end
|
@@ -111,7 +104,7 @@ module IsoDoc
|
|
111
104
|
if @doctype == "whitepaper"
|
112
105
|
title = Common::case_with_markup(@labels["annex"], "capital",
|
113
106
|
@script)
|
114
|
-
|
107
|
+
l10n(labelled_autonum(title, num))
|
115
108
|
else super
|
116
109
|
end
|
117
110
|
end
|
@@ -1701,16 +1701,22 @@ which can be bookmarks as well as block or section references</a:documentation>
|
|
1701
1701
|
<a:documentation>Inline reference to a paragraph or paragraphs, appearing as a footnote.
|
1702
1702
|
The target of a footnote is the location it is embedded in within the text</a:documentation>
|
1703
1703
|
<element name="fn">
|
1704
|
-
<
|
1705
|
-
|
1706
|
-
</attribute>
|
1707
|
-
<oneOrMore>
|
1708
|
-
<ref name="paragraph">
|
1709
|
-
<a:documentation>The content of the footnote</a:documentation>
|
1710
|
-
</ref>
|
1711
|
-
</oneOrMore>
|
1704
|
+
<ref name="FnAttributes"/>
|
1705
|
+
<ref name="FnBody"/>
|
1712
1706
|
</element>
|
1713
1707
|
</define>
|
1708
|
+
<define name="FnBody">
|
1709
|
+
<oneOrMore>
|
1710
|
+
<ref name="paragraph">
|
1711
|
+
<a:documentation>The content of the footnote</a:documentation>
|
1712
|
+
</ref>
|
1713
|
+
</oneOrMore>
|
1714
|
+
</define>
|
1715
|
+
<define name="FnAttributes">
|
1716
|
+
<attribute name="reference">
|
1717
|
+
<a:documentation>The number of the footnote, used to identify it visually</a:documentation>
|
1718
|
+
</attribute>
|
1719
|
+
</define>
|
1714
1720
|
<define name="callout">
|
1715
1721
|
<a:documentation>Inline reference to a paragraph or paragraphs, appearing as annotation of source code</a:documentation>
|
1716
1722
|
<element name="callout">
|