isodoc 3.4.5 → 3.4.6
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.devel +2 -0
- data/isodoc.gemspec +1 -1
- data/lib/isodoc/base_style/all.css +5 -0
- data/lib/isodoc/base_style/reset.css +5 -0
- data/lib/isodoc/base_style/reset.scss +3 -0
- data/lib/isodoc/function/blocks.rb +13 -9
- data/lib/isodoc/function/blocks_example_note.rb +32 -15
- data/lib/isodoc/function/footnotes.rb +2 -2
- data/lib/isodoc/function/form.rb +3 -3
- data/lib/isodoc/function/inline.rb +37 -13
- data/lib/isodoc/function/inline_simple.rb +2 -2
- data/lib/isodoc/function/lists.rb +9 -9
- data/lib/isodoc/function/references.rb +1 -1
- data/lib/isodoc/function/reqt.rb +4 -4
- data/lib/isodoc/function/section.rb +10 -10
- data/lib/isodoc/function/section_titles.rb +3 -3
- data/lib/isodoc/function/table.rb +2 -2
- data/lib/isodoc/function/terms.rb +15 -10
- data/lib/isodoc/function/to_word_html.rb +1 -1
- data/lib/isodoc/function/utils.rb +20 -5
- data/lib/isodoc/html_function/form.rb +11 -11
- data/lib/isodoc/html_function/html.rb +120 -22
- data/lib/isodoc/html_function/postprocess.rb +7 -3
- data/lib/isodoc/presentation_function/designations.rb +23 -2
- data/lib/isodoc/presentation_function/ids.rb +3 -1
- data/lib/isodoc/presentation_function/image.rb +2 -1
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +8 -4
- data/lib/isodoc/word_function/inline.rb +3 -3
- data/lib/isodoc/word_function/lists.rb +5 -5
- data/lib/isodoc/word_function/postprocess.rb +3 -1
- data/lib/isodoc/word_function/table.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1dfc380b722c0dbf909171f7dccc2f5b69680919557e4ec2be439bf6c4688936
|
|
4
|
+
data.tar.gz: a904964e3515b179f4bc5bdf7d7475852f891515465a0d841848ec8cf14e5588
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2f86e6318d8da11758a70fb48d212b542cf978a1e0f96ab38ce8fecf6730c07c05da9300c1eaff665202d0690cd82ebc5271df083ac2f35809a6385fcf6bf899
|
|
7
|
+
data.tar.gz: 9bb507861832387cd2b0968d85fa704656ea204a3097e9da05c4793ee6705fef9e4251ab5b042711aed35d50e1f2a55fdb26cb5da3f4fae9c34595ac66727214
|
data/Gemfile.devel
ADDED
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 "benchmark"
|
|
47
47
|
spec.add_development_dependency "debug"
|
|
48
48
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
|
49
49
|
spec.add_development_dependency "guard", "~> 2.14"
|
|
@@ -23,7 +23,7 @@ module IsoDoc
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def figure_parse1(node, out)
|
|
26
|
-
out.figure
|
|
26
|
+
out.figure(**figure_attrs(node)) do |div|
|
|
27
27
|
node.children.each do |n|
|
|
28
28
|
parse(n, div) unless n.name == "fmt-name"
|
|
29
29
|
end
|
|
@@ -35,11 +35,15 @@ module IsoDoc
|
|
|
35
35
|
attr_code(id: node["id"], class: "pseudocode", style: keep_style(node))
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
+
def pseudocode_tag
|
|
39
|
+
"div"
|
|
40
|
+
end
|
|
41
|
+
|
|
38
42
|
def pseudocode_parse(node, out)
|
|
39
43
|
@in_figure = true
|
|
40
44
|
name = node.at(ns("./fmt-name"))
|
|
41
45
|
s = node.at(ns("./fmt-figure")) || node
|
|
42
|
-
out.
|
|
46
|
+
out.send pseudocode_tag, **pseudocode_attrs(node) do |div|
|
|
43
47
|
s.children.each { |n| parse(n, div) unless n.name == "fmt-name" }
|
|
44
48
|
sourcecode_name_parse(node, div, name)
|
|
45
49
|
end
|
|
@@ -61,7 +65,7 @@ module IsoDoc
|
|
|
61
65
|
name = node.at(ns("./fmt-name"))
|
|
62
66
|
n = node.at(ns("./fmt-sourcecode"))
|
|
63
67
|
s = n || node
|
|
64
|
-
out.p
|
|
68
|
+
out.p(**sourcecode_attrs(node)) do |div|
|
|
65
69
|
sourcecode_parse1(s, div)
|
|
66
70
|
end
|
|
67
71
|
annotation_parse(s, out)
|
|
@@ -81,7 +85,7 @@ module IsoDoc
|
|
|
81
85
|
end
|
|
82
86
|
|
|
83
87
|
def pre_parse(node, out)
|
|
84
|
-
out.pre
|
|
88
|
+
out.pre(node.text, **attr_code(id: node["id"]))
|
|
85
89
|
end
|
|
86
90
|
|
|
87
91
|
def annotation_parse(node, out)
|
|
@@ -93,7 +97,7 @@ module IsoDoc
|
|
|
93
97
|
end
|
|
94
98
|
|
|
95
99
|
def formula_parse1(node, out)
|
|
96
|
-
out.div
|
|
100
|
+
out.div(**attr_code(class: "formula")) do |div|
|
|
97
101
|
div.p do |_p|
|
|
98
102
|
parse(node.at(ns("./fmt-stem")), div)
|
|
99
103
|
if lbl = node&.at(ns("./fmt-name"))&.text
|
|
@@ -109,7 +113,7 @@ module IsoDoc
|
|
|
109
113
|
end
|
|
110
114
|
|
|
111
115
|
def formula_parse(node, out)
|
|
112
|
-
out.div
|
|
116
|
+
out.div(**formula_attrs(node)) do |div|
|
|
113
117
|
formula_parse1(node, div)
|
|
114
118
|
node.children.each do |n|
|
|
115
119
|
%w(stem fmt-name fmt-stem).include? n.name and next
|
|
@@ -120,7 +124,7 @@ module IsoDoc
|
|
|
120
124
|
|
|
121
125
|
def key_parse(node, out)
|
|
122
126
|
klass = "key #{node['class']}".strip
|
|
123
|
-
out.div
|
|
127
|
+
out.div(**attr_code(class: klass)) do |div|
|
|
124
128
|
node.children.each do |n|
|
|
125
129
|
if n.name == "name"
|
|
126
130
|
key_name_parse(n, div)
|
|
@@ -160,7 +164,7 @@ module IsoDoc
|
|
|
160
164
|
end
|
|
161
165
|
|
|
162
166
|
def para_parse(node, out)
|
|
163
|
-
out.p
|
|
167
|
+
out.p(**attr_code(para_attrs(node))) do |p|
|
|
164
168
|
para_prefix(node, p)
|
|
165
169
|
node.children.each { |n| parse(n, p) unless n.name == "note" }
|
|
166
170
|
end
|
|
@@ -178,7 +182,7 @@ module IsoDoc
|
|
|
178
182
|
def quote_parse(node, out)
|
|
179
183
|
attrs = para_attrs(node)
|
|
180
184
|
attrs[:class] = "Quote"
|
|
181
|
-
out.div
|
|
185
|
+
out.div(**attr_code(attrs)) do |p|
|
|
182
186
|
node.children.each { |n| parse(n, p) unless n.name == "source" }
|
|
183
187
|
end
|
|
184
188
|
end
|
|
@@ -18,7 +18,7 @@ module IsoDoc
|
|
|
18
18
|
|
|
19
19
|
# used if we are boxing examples
|
|
20
20
|
def example_div_parse(node, out)
|
|
21
|
-
out.div
|
|
21
|
+
out.div(**example_div_attr(node)) do |div|
|
|
22
22
|
example_label(node, div, node.at(ns("./fmt-name")))
|
|
23
23
|
node.children.each do |n|
|
|
24
24
|
parse(n, div) unless n.name == "fmt-name"
|
|
@@ -36,12 +36,12 @@ module IsoDoc
|
|
|
36
36
|
{ style: "vertical-align:top;padding:0;", class: "example" }.freeze
|
|
37
37
|
|
|
38
38
|
def example_table_parse(node, out)
|
|
39
|
-
out.table
|
|
39
|
+
out.table(**example_table_attr(node)) do |t|
|
|
40
40
|
t.tr do |tr|
|
|
41
|
-
tr.td
|
|
41
|
+
tr.td(**EXAMPLE_TBL_ATTR) do |td|
|
|
42
42
|
example_label(node, td, node.at(ns("./fmt-name")))
|
|
43
43
|
end
|
|
44
|
-
tr.td
|
|
44
|
+
tr.td(**EXAMPLE_TD_ATTR) do |td|
|
|
45
45
|
node.children.each do |n|
|
|
46
46
|
parse(n, td) unless n.name == "fmt-name"
|
|
47
47
|
end
|
|
@@ -64,10 +64,10 @@ module IsoDoc
|
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
def starts_with_para?(node)
|
|
67
|
-
elem = block_body_first_elem(node) or return
|
|
67
|
+
elem = block_body_first_elem(node) or return false
|
|
68
68
|
elem.name == "p" || block_body_first_elem(elem)&.name == "p" ||
|
|
69
|
-
elem.elements.first&.name == "semx" &&
|
|
70
|
-
block_body_first_elem(elem.elements.first)&.name == "p"
|
|
69
|
+
(elem.elements.first&.name == "semx" &&
|
|
70
|
+
block_body_first_elem(elem.elements.first)&.name == "p")
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
def note_p_class
|
|
@@ -77,7 +77,7 @@ module IsoDoc
|
|
|
77
77
|
def note_p_parse(node, div)
|
|
78
78
|
name = node.at(ns("./fmt-name"))
|
|
79
79
|
para = node.at(ns("./p")) || node.at(ns("./semx/p"))
|
|
80
|
-
div.p
|
|
80
|
+
div.p(**attr_code(class: note_p_class)) do |p|
|
|
81
81
|
name and p.span class: "note_label" do |s|
|
|
82
82
|
name.children.each { |n| parse(n, s) }
|
|
83
83
|
end
|
|
@@ -88,7 +88,7 @@ module IsoDoc
|
|
|
88
88
|
|
|
89
89
|
def note_parse1(node, div)
|
|
90
90
|
name = node.at(ns("./fmt-name")) and
|
|
91
|
-
div.p
|
|
91
|
+
div.p(**attr_code(class: note_p_class)) do |p|
|
|
92
92
|
p.span class: "note_label" do |s|
|
|
93
93
|
name.remove.children.each { |n| parse(n, s) }
|
|
94
94
|
end
|
|
@@ -115,7 +115,7 @@ module IsoDoc
|
|
|
115
115
|
|
|
116
116
|
def note_parse(node, out)
|
|
117
117
|
@note = true
|
|
118
|
-
out.div
|
|
118
|
+
out.div(**note_attrs(node)) do |div|
|
|
119
119
|
if starts_with_para?(node)
|
|
120
120
|
note_p_parse(node, div)
|
|
121
121
|
else
|
|
@@ -125,14 +125,31 @@ module IsoDoc
|
|
|
125
125
|
@note = false
|
|
126
126
|
end
|
|
127
127
|
|
|
128
|
-
def admonition_name_parse(
|
|
129
|
-
div.p class: "AdmonitionTitle",
|
|
128
|
+
def admonition_name_parse(node, div, name)
|
|
129
|
+
div.p class: "AdmonitionTitle #{admonition_subclass(node)}".strip,
|
|
130
|
+
style: "text-align:center;" do |p|
|
|
130
131
|
children_parse(name, p)
|
|
131
132
|
end
|
|
132
133
|
end
|
|
133
134
|
|
|
134
|
-
def admonition_class(
|
|
135
|
-
"Admonition"
|
|
135
|
+
def admonition_class(node)
|
|
136
|
+
"Admonition #{admonition_subclass(node)}".strip
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def admonition_subclass(node)
|
|
140
|
+
case node["type"]
|
|
141
|
+
when "important" then "AdmonitionImportant"
|
|
142
|
+
when "warning" then "AdmonitionWarning"
|
|
143
|
+
when "caution" then "AdmonitionCaution"
|
|
144
|
+
when "todo" then "AdmonitionTodo"
|
|
145
|
+
when "editor" then "AdmonitionEditor"
|
|
146
|
+
when "editorial" then "AdmonitionEditorial"
|
|
147
|
+
when "tip" then "AdmonitionTip"
|
|
148
|
+
when "statement" then "AdmonitionStatement"
|
|
149
|
+
when "box" then "AdmonitionBox"
|
|
150
|
+
when "safety-precaution" then "AdmonitionSafetyPrecaution"
|
|
151
|
+
else "AdmonitionOther"
|
|
152
|
+
end
|
|
136
153
|
end
|
|
137
154
|
|
|
138
155
|
def admonition_name(node, _type)
|
|
@@ -145,7 +162,7 @@ module IsoDoc
|
|
|
145
162
|
end
|
|
146
163
|
|
|
147
164
|
def admonition_parse(node, out)
|
|
148
|
-
out.div
|
|
165
|
+
out.div(**admonition_attrs(node)) do |div|
|
|
149
166
|
if starts_with_para?(node)
|
|
150
167
|
admonition_p_parse(node, div)
|
|
151
168
|
else
|
|
@@ -4,7 +4,7 @@ module IsoDoc
|
|
|
4
4
|
def make_table_footnote_link(out, fnid, node)
|
|
5
5
|
attrs = { href: "##{fnid}", class: "TableFootnoteRef" }
|
|
6
6
|
sup = node.at(ns(".//sup")) and sup.replace(sup.children)
|
|
7
|
-
out.a
|
|
7
|
+
out.a(**attrs) do |a|
|
|
8
8
|
children_parse(node, a)
|
|
9
9
|
end
|
|
10
10
|
end
|
|
@@ -52,7 +52,7 @@ module IsoDoc
|
|
|
52
52
|
fn = node["target"] # || UUIDTools::UUID.random_create.to_s
|
|
53
53
|
attrs = { class: "FootnoteRef", href: "#fn:#{fn}" }
|
|
54
54
|
f = node.at(ns("./fmt-fn-label"))
|
|
55
|
-
out.a
|
|
55
|
+
out.a(**attrs) do |a|
|
|
56
56
|
children_parse(f, a)
|
|
57
57
|
end
|
|
58
58
|
end
|
data/lib/isodoc/function/form.rb
CHANGED
|
@@ -2,8 +2,8 @@ module IsoDoc
|
|
|
2
2
|
module Function
|
|
3
3
|
module Form
|
|
4
4
|
def form_parse(node, out)
|
|
5
|
-
out.div
|
|
6
|
-
id: node["id"]) do |div|
|
|
5
|
+
out.div(**attr_code(class: node["class"],
|
|
6
|
+
id: node["id"])) do |div|
|
|
7
7
|
children_parse(node, div)
|
|
8
8
|
end
|
|
9
9
|
end
|
|
@@ -38,7 +38,7 @@ module IsoDoc
|
|
|
38
38
|
def option_parse(node, out); end
|
|
39
39
|
|
|
40
40
|
def textarea_parse(_node, out)
|
|
41
|
-
out.table
|
|
41
|
+
out.table(**{ border: 1, width: "50%" }) do |t|
|
|
42
42
|
t.tr do |tr|
|
|
43
43
|
tr.td do |td|
|
|
44
44
|
end
|
|
@@ -5,8 +5,8 @@ module IsoDoc
|
|
|
5
5
|
module Inline
|
|
6
6
|
def link_parse(node, out)
|
|
7
7
|
url = link_parse_url(node)
|
|
8
|
-
out.a
|
|
9
|
-
class: node["style"]) do |l|
|
|
8
|
+
out.a(**attr_code(href: url, title: node["alt"],
|
|
9
|
+
class: node["style"])) do |l|
|
|
10
10
|
if node.elements.empty? && node.text.strip.empty?
|
|
11
11
|
l << @c.encode(node["target"].sub(/^mailto:/, ""), :basic,
|
|
12
12
|
:hexadecimal)
|
|
@@ -30,8 +30,8 @@ module IsoDoc
|
|
|
30
30
|
def span_parse(node, out)
|
|
31
31
|
klass = node["style"] || node["class"]
|
|
32
32
|
if klass && !SPAN_UNWRAP_CLASSES.include?(klass)
|
|
33
|
-
out.span
|
|
34
|
-
class: node["class"]) do |s|
|
|
33
|
+
out.span(**attr_code(style: node["style"],
|
|
34
|
+
class: node["class"])) do |s|
|
|
35
35
|
children_parse(node, s)
|
|
36
36
|
end
|
|
37
37
|
else children_parse(node, out)
|
|
@@ -92,7 +92,7 @@ module IsoDoc
|
|
|
92
92
|
ret = node.at(ns("./semx[@element = 'stem']")) || node
|
|
93
93
|
ooml, text_only = stem_parse1(ret, node["type"])
|
|
94
94
|
klass = text_only ? {} : { class: "stem" }
|
|
95
|
-
out.span
|
|
95
|
+
out.span(**klass) do |span|
|
|
96
96
|
span.parent.add_child ooml
|
|
97
97
|
end
|
|
98
98
|
end
|
|
@@ -127,17 +127,41 @@ module IsoDoc
|
|
|
127
127
|
[HTMLEntities.new.encode(a), /^[[0-9,.+-]]*$/.match?(a)]
|
|
128
128
|
end
|
|
129
129
|
|
|
130
|
+
def image_attrs(node)
|
|
131
|
+
{ src: node["src"],
|
|
132
|
+
height: node["height"] || "auto",
|
|
133
|
+
width: node["width"] || "auto",
|
|
134
|
+
title: node["title"],
|
|
135
|
+
alt: node["alt"] }
|
|
136
|
+
end
|
|
137
|
+
|
|
130
138
|
def image_parse(node, out)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
139
|
+
image_body_parse(node, image_attrs(node), out)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def image_body_parse(node, attrs, out)
|
|
143
|
+
n = select_altsource(node)
|
|
144
|
+
if n.empty?
|
|
145
|
+
out.img(**attr_code(attrs))
|
|
146
|
+
else
|
|
147
|
+
image_parse(n.first, out)
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def select_altsource(node)
|
|
152
|
+
ret = node.xpath(ns("./altsource")).each_with_object([]) do |a, m|
|
|
153
|
+
tags = a["tag"].split(/,\s*/)
|
|
154
|
+
select_altsource?(a, tags) and m << a
|
|
155
|
+
end
|
|
156
|
+
ret.empty? and
|
|
157
|
+
ret = node.xpath(ns("./altsource")).each_with_object([]) do |a, m|
|
|
158
|
+
a["tag"] == "default" and m << a
|
|
159
|
+
end
|
|
160
|
+
ret
|
|
137
161
|
end
|
|
138
162
|
|
|
139
|
-
def
|
|
140
|
-
|
|
163
|
+
def select_altsource?(_altsource, tags)
|
|
164
|
+
tags.include?("doc")
|
|
141
165
|
end
|
|
142
166
|
|
|
143
167
|
def smallcap_parse(node, xml)
|
|
@@ -26,7 +26,7 @@ module IsoDoc
|
|
|
26
26
|
def index_xref_parse(node, out); end
|
|
27
27
|
|
|
28
28
|
def bookmark_parse(node, out)
|
|
29
|
-
out.a
|
|
29
|
+
out.a(**attr_code(id: node["id"]))
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def keyword_parse(node, out)
|
|
@@ -73,7 +73,7 @@ module IsoDoc
|
|
|
73
73
|
|
|
74
74
|
def underline_parse(node, out)
|
|
75
75
|
node["style"] and style = "text-decoration: #{node['style']}"
|
|
76
|
-
out.u
|
|
76
|
+
out.u(**attr_code(style: style)) do |e|
|
|
77
77
|
children_parse(node, e)
|
|
78
78
|
end
|
|
79
79
|
end
|
|
@@ -13,9 +13,9 @@ module IsoDoc
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def ul_parse(node, out)
|
|
16
|
-
out.div
|
|
16
|
+
out.div(**attr_code(class: "ul_wrap")) do |div|
|
|
17
17
|
list_title_parse(node, div)
|
|
18
|
-
div.ul
|
|
18
|
+
div.ul(**attr_code(ul_attrs(node))) do |ul|
|
|
19
19
|
node.children.each { |n| n.name == "fmt-name" or parse(n, ul) }
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -42,9 +42,9 @@ module IsoDoc
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def ol_parse(node, out)
|
|
45
|
-
out.div
|
|
45
|
+
out.div(**attr_code(class: "ol_wrap")) do |div|
|
|
46
46
|
list_title_parse(node, div)
|
|
47
|
-
div.ol
|
|
47
|
+
div.ol(**attr_code(ol_attrs(node))) do |ol|
|
|
48
48
|
node.children.each { |n| n.name == "fmt-name" or parse(n, ol) }
|
|
49
49
|
end
|
|
50
50
|
end
|
|
@@ -62,7 +62,7 @@ module IsoDoc
|
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
def li_parse(node, out)
|
|
65
|
-
out.li
|
|
65
|
+
out.li(**attr_code(id: node["id"])) do |li|
|
|
66
66
|
li << li_checkbox(node)
|
|
67
67
|
node.children.each do |n|
|
|
68
68
|
n.name == "fmt-name" and next
|
|
@@ -90,9 +90,9 @@ module IsoDoc
|
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
def dl_parse(node, out)
|
|
93
|
-
out.div
|
|
93
|
+
out.div(**attr_code(class: "figdl")) do |div|
|
|
94
94
|
list_title_parse(node, div)
|
|
95
|
-
div.dl
|
|
95
|
+
div.dl(**dl_attrs(node)) do |v|
|
|
96
96
|
node.elements.select { |n| dt_dd? n }.each_slice(2) do |dt, dd|
|
|
97
97
|
dl_parse1(v, dt, dd)
|
|
98
98
|
end
|
|
@@ -107,10 +107,10 @@ module IsoDoc
|
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
def dl_parse1(dlist, dterm, ddef)
|
|
110
|
-
dlist.dt
|
|
110
|
+
dlist.dt(**attr_code(id: dterm["id"])) do |term|
|
|
111
111
|
dt_parse(dterm, term)
|
|
112
112
|
end
|
|
113
|
-
dlist.dd
|
|
113
|
+
dlist.dd(**attr_code(id: ddef["id"])) do |listitem|
|
|
114
114
|
ddef.children.each { |n| parse(n, listitem) }
|
|
115
115
|
end
|
|
116
116
|
end
|
|
@@ -2,7 +2,7 @@ module IsoDoc
|
|
|
2
2
|
module Function
|
|
3
3
|
module References
|
|
4
4
|
def bibitem_entry(list, bib, _ordinal, biblio)
|
|
5
|
-
list.p
|
|
5
|
+
list.p(**attr_code(iso_bibitem_entry_attrs(bib, biblio))) do |ref|
|
|
6
6
|
children_parse(bib.at(ns("./biblio-tag")), ref)
|
|
7
7
|
reference_format(bib, ref)
|
|
8
8
|
end
|
data/lib/isodoc/function/reqt.rb
CHANGED
|
@@ -14,7 +14,7 @@ module IsoDoc
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def recommendation_parse(node, out)
|
|
17
|
-
out.div
|
|
17
|
+
out.div(**reqt_attrs(node, "recommend")) do |t|
|
|
18
18
|
recommendation_parse1(node, t)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
@@ -28,19 +28,19 @@ module IsoDoc
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def requirement_parse(node, out)
|
|
31
|
-
out.div
|
|
31
|
+
out.div(**reqt_attrs(node, "require")) do |t|
|
|
32
32
|
recommendation_parse1(node, t)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def permission_parse(node, out)
|
|
37
|
-
out.div
|
|
37
|
+
out.div(**reqt_attrs(node, "permission")) do |t|
|
|
38
38
|
recommendation_parse1(node, t)
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def div_parse(node, out)
|
|
43
|
-
out.div
|
|
43
|
+
out.div(**reqt_attrs(node, node["type"])) do |div|
|
|
44
44
|
children_parse(node, div)
|
|
45
45
|
end
|
|
46
46
|
end
|
|
@@ -9,7 +9,7 @@ module IsoDoc
|
|
|
9
9
|
|
|
10
10
|
# used for subclauses
|
|
11
11
|
def clause_parse(node, out)
|
|
12
|
-
out.div
|
|
12
|
+
out.div(**attr_code(clause_attrs(node))) do |div|
|
|
13
13
|
clause_parse_title(node, div, node.at(ns("./fmt-title")), out)
|
|
14
14
|
node.children.reject { |c1| c1.name == "fmt-title" }.each do |c1|
|
|
15
15
|
parse(c1, div)
|
|
@@ -18,7 +18,7 @@ module IsoDoc
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def clause(node, out)
|
|
21
|
-
out.div
|
|
21
|
+
out.div(**attr_code(clause_attrs(node))) do |s|
|
|
22
22
|
clause_name(node, node.at(ns("./fmt-title")), s, nil)
|
|
23
23
|
node.elements.reject { |c1| c1.name == "fmt-title" }.each do |c1|
|
|
24
24
|
parse(c1, s)
|
|
@@ -32,7 +32,7 @@ module IsoDoc
|
|
|
32
32
|
|
|
33
33
|
def annex(node, out)
|
|
34
34
|
page_break(out)
|
|
35
|
-
out.div
|
|
35
|
+
out.div(**attr_code(annex_attrs(node))) do |s|
|
|
36
36
|
node.elements.each do |c1|
|
|
37
37
|
if c1.name == "fmt-title" then annex_name(node, c1, s)
|
|
38
38
|
else parse(c1, s)
|
|
@@ -50,7 +50,7 @@ module IsoDoc
|
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def scope(node, out)
|
|
53
|
-
out.div
|
|
53
|
+
out.div(**attr_code(id: node["id"])) do |div|
|
|
54
54
|
clause_name(node, node.at(ns("./fmt-title")), div, nil)
|
|
55
55
|
node.elements.each do |e|
|
|
56
56
|
parse(e, div) unless e.name == "fmt-title"
|
|
@@ -62,7 +62,7 @@ module IsoDoc
|
|
|
62
62
|
"//sections/clause[descendant::terms]".freeze
|
|
63
63
|
|
|
64
64
|
def terms_defs(node, out)
|
|
65
|
-
out.div
|
|
65
|
+
out.div(**attr_code(id: node["id"])) do |div|
|
|
66
66
|
clause_name(node, node.at(ns("./fmt-title")), div, nil)
|
|
67
67
|
node.elements.each do |e|
|
|
68
68
|
parse(e, div) unless %w{fmt-title source}.include? e.name
|
|
@@ -76,7 +76,7 @@ module IsoDoc
|
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
def symbols_abbrevs(node, out)
|
|
79
|
-
out.div
|
|
79
|
+
out.div(**attr_code(id: node["id"], class: "Symbols")) do |div|
|
|
80
80
|
clause_name(node, node.at(ns("./fmt-title")), div, nil)
|
|
81
81
|
node.elements.each do |e|
|
|
82
82
|
parse(e, div) unless e.name == "fmt-title"
|
|
@@ -102,7 +102,7 @@ module IsoDoc
|
|
|
102
102
|
|
|
103
103
|
def foreword(clause, out)
|
|
104
104
|
page_break(out)
|
|
105
|
-
out.div
|
|
105
|
+
out.div(**attr_code(id: clause["id"])) do |s|
|
|
106
106
|
clause_name(clause, clause.at(ns("./fmt-title")), s,
|
|
107
107
|
{ class: "ForewordTitle" })
|
|
108
108
|
clause.elements.each { |e| parse(e, s) unless e.name == "fmt-title" }
|
|
@@ -122,7 +122,7 @@ module IsoDoc
|
|
|
122
122
|
|
|
123
123
|
def abstract(clause, out)
|
|
124
124
|
page_break(out)
|
|
125
|
-
out.div
|
|
125
|
+
out.div(**attr_code(id: clause["id"])) do |s|
|
|
126
126
|
clause_name(clause, clause.at(ns("./fmt-title")), s,
|
|
127
127
|
{ class: "AbstractTitle" })
|
|
128
128
|
clause.elements.each { |e| parse(e, s) unless e.name == "fmt-title" }
|
|
@@ -144,7 +144,7 @@ module IsoDoc
|
|
|
144
144
|
|
|
145
145
|
def preface_normal(clause, out)
|
|
146
146
|
page_break(out)
|
|
147
|
-
out.div
|
|
147
|
+
out.div(**attr_code(preface_attrs(clause))) do |div|
|
|
148
148
|
clause_name(clause, clause.at(ns("./fmt-title")), div,
|
|
149
149
|
{ class: "IntroTitle" })
|
|
150
150
|
clause.elements.each do |e|
|
|
@@ -156,7 +156,7 @@ module IsoDoc
|
|
|
156
156
|
def table_of_contents(clause, out)
|
|
157
157
|
@bare and return
|
|
158
158
|
page_break(out)
|
|
159
|
-
out.div
|
|
159
|
+
out.div(**attr_code(preface_attrs(clause))) do |div|
|
|
160
160
|
clause_name(clause, clause.at(ns("./fmt-title")), div,
|
|
161
161
|
{ class: "IntroTitle" })
|
|
162
162
|
clause.elements.each do |e|
|
|
@@ -69,7 +69,7 @@ module IsoDoc
|
|
|
69
69
|
# top level clause names
|
|
70
70
|
def clause_name(_node, title, div, header_class)
|
|
71
71
|
header_class = {} if header_class.nil?
|
|
72
|
-
div.h1
|
|
72
|
+
div.h1(**attr_code(header_class)) do |h1|
|
|
73
73
|
if title.is_a?(String) then h1 << title
|
|
74
74
|
elsif title
|
|
75
75
|
children_parse(title, h1)
|
|
@@ -88,8 +88,8 @@ module IsoDoc
|
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
def variant_title(node, out)
|
|
91
|
-
out.p
|
|
92
|
-
class: "variant-title-#{node['type']}") do |p|
|
|
91
|
+
out.p(**attr_code(style: "display:none;",
|
|
92
|
+
class: "variant-title-#{node['type']}")) do |p|
|
|
93
93
|
children_parse(node, p)
|
|
94
94
|
end
|
|
95
95
|
end
|
|
@@ -81,7 +81,7 @@ module IsoDoc
|
|
|
81
81
|
|
|
82
82
|
def table_parse(node, out)
|
|
83
83
|
@in_table = true
|
|
84
|
-
out.table
|
|
84
|
+
out.table(**table_attrs(node)) do |t|
|
|
85
85
|
table_title_parse(node, t)
|
|
86
86
|
table_parse_core(node, t)
|
|
87
87
|
table_parse_tail(node, t)
|
|
@@ -140,7 +140,7 @@ module IsoDoc
|
|
|
140
140
|
|
|
141
141
|
def tr_parse(node, out, ord, totalrows, header)
|
|
142
142
|
bordered = table_bordered?(node)
|
|
143
|
-
out.tr
|
|
143
|
+
out.tr(**attr_code(style: node["style"])) do |r|
|
|
144
144
|
node.elements.each do |td|
|
|
145
145
|
attrs = make_tr_attr(td, ord, totalrows - 1, header, bordered)
|
|
146
146
|
r.send td.name, **attr_code(attrs) do |entry|
|