isodoc 1.7.2 → 1.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/isodoc.gemspec +2 -0
- data/lib/isodoc/convert.rb +1 -0
- data/lib/isodoc/css.rb +3 -3
- data/lib/isodoc/function/blocks_example_note.rb +85 -79
- data/lib/isodoc/function/cleanup.rb +181 -175
- data/lib/isodoc/function/inline.rb +110 -108
- data/lib/isodoc/function/inline_simple.rb +55 -55
- data/lib/isodoc/function/lists.rb +75 -71
- data/lib/isodoc/function/references.rb +165 -160
- data/lib/isodoc/function/reqt.rb +91 -85
- data/lib/isodoc/function/section.rb +140 -190
- data/lib/isodoc/function/section_titles.rb +82 -0
- data/lib/isodoc/function/table.rb +90 -87
- data/lib/isodoc/function/terms.rb +58 -56
- data/lib/isodoc/function/to_word_html.rb +2 -0
- data/lib/isodoc/html_function/mathvariant_to_plain.rb +5 -3
- data/lib/isodoc/presentation_function/block.rb +80 -53
- data/lib/isodoc/presentation_function/inline.rb +48 -16
- data/lib/isodoc/presentation_function/math.rb +9 -0
- data/lib/isodoc/presentation_function/section.rb +12 -1
- data/lib/isodoc/presentation_xml_convert.rb +3 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +5 -5
- data/lib/isodoc/xslfo_convert.rb +2 -2
- data/lib/isodoc.rb +1 -1
- data/spec/assets/outputtest/iso.international-standard.xsl +2 -2
- data/spec/isodoc/blocks_spec.rb +178 -64
- data/spec/isodoc/inline_spec.rb +230 -123
- data/spec/isodoc/postproc_spec.rb +2 -2
- data/spec/isodoc/presentation_xml_spec.rb +84 -0
- data/spec/isodoc/section_spec.rb +764 -0
- data/spec/isodoc/terms_spec.rb +116 -0
- metadata +31 -2
@@ -1,116 +1,119 @@
|
|
1
|
-
module IsoDoc
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
module IsoDoc
|
2
|
+
module Function
|
3
|
+
module Table
|
4
|
+
def table_title_parse(node, out)
|
5
|
+
name = node.at(ns("./name")) or return
|
6
|
+
out.p **{ class: "TableTitle", style: "text-align:center;" } do |p|
|
7
|
+
name&.children&.each { |n| parse(n, p) }
|
8
|
+
end
|
7
9
|
end
|
8
|
-
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
def thead_parse(node, table)
|
12
|
+
thead = node.at(ns("./thead"))
|
13
|
+
if thead
|
14
|
+
table.thead do |h|
|
15
|
+
thead.element_children.each_with_index do |n, i|
|
16
|
+
tr_parse(n, h, i, thead.element_children.size, true)
|
17
|
+
end
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
19
|
-
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
def tbody_parse(node, table)
|
23
|
+
tbody = node.at(ns("./tbody")) || return
|
24
|
+
table.tbody do |h|
|
25
|
+
tbody.element_children.each_with_index do |n, i|
|
26
|
+
tr_parse(n, h, i, tbody.element_children.size, false)
|
27
|
+
end
|
26
28
|
end
|
27
29
|
end
|
28
|
-
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
def tfoot_parse(node, table)
|
32
|
+
tfoot = node.at(ns("./tfoot"))
|
33
|
+
if tfoot
|
34
|
+
table.tfoot do |h|
|
35
|
+
tfoot.element_children.each_with_index do |n, i|
|
36
|
+
tr_parse(n, h, i, tfoot.element_children.size, false)
|
37
|
+
end
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
39
|
-
end
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
42
|
+
def table_attrs(node)
|
43
|
+
width = node["width"] ? "width:#{node['width']};" : nil
|
44
|
+
attr_code(
|
45
|
+
id: node["id"],
|
46
|
+
class: "MsoISOTable",
|
47
|
+
style: "border-width:1px;border-spacing:0;"\
|
48
|
+
"#{width}#{keep_style(node)}",
|
49
|
+
title: node["alt"],
|
50
|
+
)
|
51
|
+
end
|
50
52
|
|
51
|
-
|
52
|
-
|
53
|
+
def tcaption(node, table)
|
54
|
+
return unless node["summary"]
|
53
55
|
|
54
|
-
|
55
|
-
|
56
|
-
|
56
|
+
table.caption do |c|
|
57
|
+
c.span **{ style: "display:none" } do |s|
|
58
|
+
s << node["summary"]
|
59
|
+
end
|
57
60
|
end
|
58
61
|
end
|
59
|
-
end
|
60
62
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
63
|
+
def colgroup(node, table)
|
64
|
+
colgroup = node.at(ns("./colgroup")) or return
|
65
|
+
table.colgroup do |cg|
|
66
|
+
colgroup.xpath(ns("./col")).each do |c|
|
67
|
+
cg.col **{ style: "width: #{c['width']};" }
|
68
|
+
end
|
66
69
|
end
|
67
70
|
end
|
68
|
-
end
|
69
71
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
72
|
+
def table_parse(node, out)
|
73
|
+
@in_table = true
|
74
|
+
table_title_parse(node, out)
|
75
|
+
out.table **table_attrs(node) do |t|
|
76
|
+
tcaption(node, t)
|
77
|
+
colgroup(node, t)
|
78
|
+
thead_parse(node, t)
|
79
|
+
tbody_parse(node, t)
|
80
|
+
tfoot_parse(node, t)
|
81
|
+
(dl = node.at(ns("./dl"))) && parse(dl, out)
|
82
|
+
node.xpath(ns("./note")).each { |n| parse(n, out) }
|
83
|
+
end
|
84
|
+
@in_table = false
|
85
|
+
# out.p { |p| p << " " }
|
81
86
|
end
|
82
|
-
@in_table = false
|
83
|
-
# out.p { |p| p << " " }
|
84
|
-
end
|
85
87
|
|
86
|
-
|
88
|
+
SW = "solid windowtext".freeze
|
87
89
|
|
88
|
-
|
89
|
-
|
90
|
-
|
90
|
+
# def make_tr_attr(td, row, totalrows, cols, totalcols, header)
|
91
|
+
# border-left:#{col.zero? ? "#{SW} 1.5pt;" : "none;"}
|
92
|
+
# border-right:#{SW} #{col == totalcols && !header ? "1.5" : "1.0"}pt;
|
91
93
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
94
|
+
def make_tr_attr(cell, row, totalrows, header)
|
95
|
+
style = cell.name == "th" ? "font-weight:bold;" : ""
|
96
|
+
cell["align"] and style += "text-align:#{cell['align']};"
|
97
|
+
cell["valign"] and style += "vertical-align:#{cell['valign']};"
|
98
|
+
rowmax = cell["rowspan"] ? row + cell["rowspan"].to_i - 1 : row
|
99
|
+
style += <<~STYLE
|
100
|
+
border-top:#{row.zero? ? "#{SW} 1.5pt;" : 'none;'}
|
101
|
+
border-bottom:#{SW} #{rowmax == totalrows ? '1.5' : '1.0'}pt;
|
102
|
+
STYLE
|
103
|
+
header and scope = (cell["colspan"] ? "colgroup" : "col")
|
104
|
+
!header && cell.name == "th" and
|
105
|
+
scope = (cell["rowspan"] ? "rowgroup" : "row")
|
106
|
+
{ rowspan: cell["rowspan"], colspan: cell["colspan"],
|
107
|
+
style: style.gsub(/\n/, ""), scope: scope }
|
108
|
+
end
|
107
109
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
110
|
+
def tr_parse(node, out, ord, totalrows, header)
|
111
|
+
out.tr do |r|
|
112
|
+
node.elements.each do |td|
|
113
|
+
attrs = make_tr_attr(td, ord, totalrows - 1, header)
|
114
|
+
r.send td.name, **attr_code(attrs) do |entry|
|
115
|
+
td.children.each { |n| parse(n, entry) }
|
116
|
+
end
|
114
117
|
end
|
115
118
|
end
|
116
119
|
end
|
@@ -1,77 +1,79 @@
|
|
1
|
-
module IsoDoc
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
module IsoDoc
|
2
|
+
module Function
|
3
|
+
module Terms
|
4
|
+
def definition_parse(node, out)
|
5
|
+
node.children.each { |n| parse(n, out) }
|
6
|
+
end
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
def modification_parse(node, out)
|
9
|
+
out << "[MODIFICATION]"
|
10
|
+
para = node.at(ns("./p"))
|
11
|
+
para.children.each { |n| parse(n, out) }
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
def deprecated_term_parse(node, out)
|
15
|
+
out.p **{ class: "DeprecatedTerms", style: "text-align:left;" } do |p|
|
16
|
+
p << l10n("#{@i18n.deprecated}: ")
|
17
|
+
node.children.each { |c| parse(c, p) }
|
18
|
+
end
|
17
19
|
end
|
18
|
-
end
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
def admitted_term_parse(node, out)
|
22
|
+
out.p **{ class: "AltTerms", style: "text-align:left;" } do |p|
|
23
|
+
node.children.each { |c| parse(c, p) }
|
24
|
+
end
|
23
25
|
end
|
24
|
-
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
def term_parse(node, out)
|
28
|
+
out.p **{ class: "Terms", style: "text-align:left;" } do |p|
|
29
|
+
node.children.each { |c| parse(c, p) }
|
30
|
+
end
|
29
31
|
end
|
30
|
-
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
def para_then_remainder(first, node, para, div)
|
34
|
+
if first.name == "p"
|
35
|
+
first.children.each { |n| parse(n, para) }
|
36
|
+
node.elements.drop(1).each { |n| parse(n, div) }
|
37
|
+
else
|
38
|
+
node.elements.each { |n| parse(n, div) }
|
39
|
+
end
|
38
40
|
end
|
39
|
-
end
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
42
|
+
def termnote_delim
|
43
|
+
l10n(": ")
|
44
|
+
end
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
def termnote_parse(node, out)
|
47
|
+
name = node&.at(ns("./name"))&.remove
|
48
|
+
out.div **note_attrs(node) do |div|
|
49
|
+
div.p do |p|
|
50
|
+
if name
|
51
|
+
name.children.each { |n| parse(n, p) }
|
52
|
+
p << termnote_delim
|
53
|
+
end
|
54
|
+
para_then_remainder(node.first_element_child, node, p, div)
|
52
55
|
end
|
53
|
-
para_then_remainder(node.first_element_child, node, p, div)
|
54
56
|
end
|
55
57
|
end
|
56
|
-
end
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
def termref_parse(node, out)
|
60
|
+
out.p do |p|
|
61
|
+
p << "[TERMREF]"
|
62
|
+
node.children.each { |n| parse(n, p) }
|
63
|
+
p << "[/TERMREF]"
|
64
|
+
end
|
63
65
|
end
|
64
|
-
end
|
65
66
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
def termdef_parse(node, out)
|
68
|
+
name = node&.at(ns("./name"))&.remove
|
69
|
+
out.p **{ class: "TermNum", id: node["id"] } do |p|
|
70
|
+
name&.children&.each { |n| parse(n, p) }
|
71
|
+
end
|
72
|
+
set_termdomain("")
|
73
|
+
node.children.each { |n| parse(n, out) }
|
70
74
|
end
|
71
|
-
set_termdomain("")
|
72
|
-
node.children.each { |n| parse(n, out) }
|
73
|
-
end
|
74
75
|
|
75
|
-
|
76
|
+
def termdocsource_parse(_node, _out); end
|
77
|
+
end
|
76
78
|
end
|
77
79
|
end
|
@@ -212,6 +212,7 @@ module IsoDoc
|
|
212
212
|
when "measurement-target" then requirement_component_parse(node, out)
|
213
213
|
when "verification" then requirement_component_parse(node, out)
|
214
214
|
when "import" then requirement_component_parse(node, out)
|
215
|
+
when "component" then requirement_component_parse(node, out)
|
215
216
|
when "index" then index_parse(node, out)
|
216
217
|
when "index-xref" then index_xref_parse(node, out)
|
217
218
|
when "termref" then termrefelem_parse(node, out)
|
@@ -232,6 +233,7 @@ module IsoDoc
|
|
232
233
|
when "option" then option_parse(node, out)
|
233
234
|
when "textarea" then textarea_parse(node, out)
|
234
235
|
when "toc" then toc_parse(node, out)
|
236
|
+
when "variant-title" then variant_title(node, out)
|
235
237
|
else error_parse(node, out)
|
236
238
|
end
|
237
239
|
end
|
@@ -41,6 +41,7 @@ module IsoDoc
|
|
41
41
|
def convert
|
42
42
|
docxml.xpath("//m:math", MATHML).each do |elem|
|
43
43
|
next if nothing_to_style(elem)
|
44
|
+
|
44
45
|
mathml1(elem)
|
45
46
|
end
|
46
47
|
docxml
|
@@ -49,7 +50,8 @@ module IsoDoc
|
|
49
50
|
private
|
50
51
|
|
51
52
|
def nothing_to_style(elem)
|
52
|
-
!elem.at("./*[@mathvariant][not(@mathvariant = 'normal')]
|
53
|
+
!elem.at("./*[@mathvariant][not(@mathvariant = 'normal')]"\
|
54
|
+
"[not(@mathvariant = 'italic')]")
|
53
55
|
end
|
54
56
|
|
55
57
|
def mathml1(base_elem)
|
@@ -58,7 +60,7 @@ module IsoDoc
|
|
58
60
|
.merge(MATHVARIANT_TO_PLANE_MAPPINGS)
|
59
61
|
.each_pair do |mathvariant_list, plain_font|
|
60
62
|
base_elem.xpath(mathvariant_xpath(mathvariant_list)).each do |elem|
|
61
|
-
|
63
|
+
to_plane(elem, plain_font)
|
62
64
|
end
|
63
65
|
end
|
64
66
|
end
|
@@ -69,7 +71,7 @@ module IsoDoc
|
|
69
71
|
.join
|
70
72
|
end
|
71
73
|
|
72
|
-
def
|
74
|
+
def to_plane(elem, font)
|
73
75
|
elem.traverse do |n|
|
74
76
|
next unless n.text?
|
75
77
|
|
@@ -2,10 +2,10 @@ require "base64"
|
|
2
2
|
|
3
3
|
module IsoDoc
|
4
4
|
class PresentationXMLConvert < ::IsoDoc::Convert
|
5
|
-
def lower2cap(
|
6
|
-
return
|
5
|
+
def lower2cap(text)
|
6
|
+
return text if /^[[:upper:]][[:upper:]]/.match?(text)
|
7
7
|
|
8
|
-
|
8
|
+
text.capitalize
|
9
9
|
end
|
10
10
|
|
11
11
|
def figure(docxml)
|
@@ -13,8 +13,7 @@ module IsoDoc
|
|
13
13
|
docxml.xpath(ns("//figure")).each { |f| figure1(f) }
|
14
14
|
docxml.xpath(ns("//svgmap")).each do |s|
|
15
15
|
if f = s.at(ns("./figure")) then s.replace(f)
|
16
|
-
else
|
17
|
-
s.remove
|
16
|
+
else s.remove
|
18
17
|
end
|
19
18
|
end
|
20
19
|
end
|
@@ -30,26 +29,28 @@ module IsoDoc
|
|
30
29
|
elem.replace(x)
|
31
30
|
end
|
32
31
|
|
33
|
-
def figure1(
|
34
|
-
return sourcecode1(
|
35
|
-
|
36
|
-
return if
|
32
|
+
def figure1(elem)
|
33
|
+
return sourcecode1(elem) if elem["class"] == "pseudocode" ||
|
34
|
+
elem["type"] == "pseudocode"
|
35
|
+
return if labelled_ancestor(elem) && elem.ancestors("figure").empty? ||
|
36
|
+
elem.at(ns("./figure")) && !elem.at(ns("./name"))
|
37
37
|
|
38
|
-
lbl = @xrefs.anchor(
|
39
|
-
prefix_name(
|
38
|
+
lbl = @xrefs.anchor(elem["id"], :label, false) or return
|
39
|
+
prefix_name(elem, " — ",
|
40
40
|
l10n("#{lower2cap @i18n.figure} #{lbl}"), "name")
|
41
41
|
end
|
42
42
|
|
43
|
-
def prefix_name(
|
43
|
+
def prefix_name(node, delim, number, elem)
|
44
44
|
return if number.nil? || number.empty?
|
45
45
|
|
46
|
-
unless name =
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
unless name = node.at(ns("./#{elem}"))
|
47
|
+
node.children.empty? and node.add_child("<#{elem}></#{elem}>") or
|
48
|
+
node.children.first.previous = "<#{elem}></#{elem}>"
|
49
|
+
name = node.children.first
|
50
|
+
end
|
51
|
+
if name.children.empty? then name.add_child(number)
|
52
|
+
else (name.children.first.previous = "#{number}#{delim}")
|
50
53
|
end
|
51
|
-
name.children.empty? ? name.add_child(number) :
|
52
|
-
( name.children.first.previous = "#{number}#{delim}" )
|
53
54
|
end
|
54
55
|
|
55
56
|
def sourcecode(docxml)
|
@@ -58,12 +59,13 @@ module IsoDoc
|
|
58
59
|
end
|
59
60
|
end
|
60
61
|
|
61
|
-
def sourcecode1(
|
62
|
-
return if labelled_ancestor(
|
63
|
-
return unless
|
62
|
+
def sourcecode1(elem)
|
63
|
+
return if labelled_ancestor(elem)
|
64
|
+
return unless elem.ancestors("example").empty?
|
64
65
|
|
65
|
-
lbl = @xrefs.anchor(
|
66
|
-
prefix_name(
|
66
|
+
lbl = @xrefs.anchor(elem["id"], :label, false) or return
|
67
|
+
prefix_name(elem, " — ",
|
68
|
+
l10n("#{lower2cap @i18n.figure} #{lbl}"), "name")
|
67
69
|
end
|
68
70
|
|
69
71
|
def formula(docxml)
|
@@ -73,9 +75,9 @@ module IsoDoc
|
|
73
75
|
end
|
74
76
|
|
75
77
|
# introduce name element
|
76
|
-
def formula1(
|
77
|
-
lbl = @xrefs.anchor(
|
78
|
-
prefix_name(
|
78
|
+
def formula1(elem)
|
79
|
+
lbl = @xrefs.anchor(elem["id"], :label, false)
|
80
|
+
prefix_name(elem, "", lbl, "name")
|
79
81
|
end
|
80
82
|
|
81
83
|
def example(docxml)
|
@@ -90,11 +92,14 @@ module IsoDoc
|
|
90
92
|
end
|
91
93
|
end
|
92
94
|
|
93
|
-
def example1(
|
94
|
-
n = @xrefs.get[
|
95
|
-
lbl =
|
96
|
-
|
97
|
-
|
95
|
+
def example1(elem)
|
96
|
+
n = @xrefs.get[elem["id"]]
|
97
|
+
lbl = if n.nil? || n[:label].nil? || n[:label].empty?
|
98
|
+
@i18n.example
|
99
|
+
else
|
100
|
+
l10n("#{@i18n.example} #{n[:label]}")
|
101
|
+
end
|
102
|
+
prefix_name(elem, " — ", lbl, "name")
|
98
103
|
end
|
99
104
|
|
100
105
|
def note(docxml)
|
@@ -104,13 +109,16 @@ module IsoDoc
|
|
104
109
|
end
|
105
110
|
|
106
111
|
# introduce name element
|
107
|
-
def note1(
|
108
|
-
return if
|
112
|
+
def note1(elem)
|
113
|
+
return if elem.parent.name == "bibitem"
|
109
114
|
|
110
|
-
n = @xrefs.get[
|
111
|
-
lbl =
|
112
|
-
|
113
|
-
|
115
|
+
n = @xrefs.get[elem["id"]]
|
116
|
+
lbl = if n.nil? || n[:label].nil? || n[:label].empty?
|
117
|
+
@i18n.note
|
118
|
+
else
|
119
|
+
l10n("#{@i18n.note} #{n[:label]}")
|
120
|
+
end
|
121
|
+
prefix_name(elem, "", lbl, "name")
|
114
122
|
end
|
115
123
|
|
116
124
|
def termnote(docxml)
|
@@ -120,9 +128,27 @@ module IsoDoc
|
|
120
128
|
end
|
121
129
|
|
122
130
|
# introduce name element
|
123
|
-
def termnote1(
|
124
|
-
lbl = l10n(@xrefs.anchor(
|
125
|
-
prefix_name(
|
131
|
+
def termnote1(elem)
|
132
|
+
lbl = l10n(@xrefs.anchor(elem["id"], :label) || "???")
|
133
|
+
prefix_name(elem, "", lower2cap(lbl), "name")
|
134
|
+
end
|
135
|
+
|
136
|
+
def termdefinition(docxml)
|
137
|
+
docxml.xpath(ns("//term[definition]")).each do |f|
|
138
|
+
termdefinition1(f)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def termdefinition1(elem)
|
143
|
+
return unless elem.xpath(ns("./definition")).size > 1
|
144
|
+
|
145
|
+
d = elem.at(ns("./definition"))
|
146
|
+
d = d.replace("<ol><li>#{d.children.to_xml}</li></ol>").first
|
147
|
+
elem.xpath(ns("./definition")).each do |f|
|
148
|
+
f = f.replace("<li>#{f.children.to_xml}</li>").first
|
149
|
+
d << f
|
150
|
+
end
|
151
|
+
d.wrap("<definition></definition>")
|
126
152
|
end
|
127
153
|
|
128
154
|
def recommendation(docxml)
|
@@ -144,10 +170,10 @@ module IsoDoc
|
|
144
170
|
end
|
145
171
|
|
146
172
|
# introduce name element
|
147
|
-
def recommendation1(
|
148
|
-
n = @xrefs.anchor(
|
173
|
+
def recommendation1(elem, type)
|
174
|
+
n = @xrefs.anchor(elem["id"], :label, false)
|
149
175
|
lbl = (n.nil? ? type : l10n("#{type} #{n}"))
|
150
|
-
prefix_name(
|
176
|
+
prefix_name(elem, "", lbl, "name")
|
151
177
|
end
|
152
178
|
|
153
179
|
def table(docxml)
|
@@ -156,12 +182,13 @@ module IsoDoc
|
|
156
182
|
end
|
157
183
|
end
|
158
184
|
|
159
|
-
def table1(
|
160
|
-
return if labelled_ancestor(
|
161
|
-
return if
|
185
|
+
def table1(elem)
|
186
|
+
return if labelled_ancestor(elem)
|
187
|
+
return if elem["unnumbered"] && !elem.at(ns("./name"))
|
162
188
|
|
163
|
-
n = @xrefs.anchor(
|
164
|
-
prefix_name(
|
189
|
+
n = @xrefs.anchor(elem["id"], :label, false)
|
190
|
+
prefix_name(elem, " — ", l10n("#{lower2cap @i18n.table} #{n}"),
|
191
|
+
"name")
|
165
192
|
end
|
166
193
|
|
167
194
|
# we use this to eliminate the semantic amend blocks from rendering
|
@@ -171,11 +198,11 @@ module IsoDoc
|
|
171
198
|
end
|
172
199
|
end
|
173
200
|
|
174
|
-
def amend1(
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
201
|
+
def amend1(elem)
|
202
|
+
elem.xpath(ns("./autonumber")).each(&:remove)
|
203
|
+
elem.xpath(ns("./newcontent")).each { |a| a.name = "quote" }
|
204
|
+
elem.xpath(ns("./description")).each { |a| a.replace(a.children) }
|
205
|
+
elem.replace(elem.children)
|
179
206
|
end
|
180
207
|
end
|
181
208
|
end
|