isodoc 1.7.1 → 1.7.2
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/isodoc.gemspec +1 -1
- data/lib/isodoc.rb +1 -0
- data/lib/isodoc/function/blocks.rb +180 -168
- data/lib/isodoc/function/to_word_html.rb +206 -204
- data/lib/isodoc/html_convert.rb +0 -4
- data/lib/isodoc/version.rb +1 -1
- data/lib/metanorma/output.rb +7 -0
- data/lib/metanorma/output/base.rb +13 -0
- data/lib/metanorma/output/utils.rb +17 -0
- data/lib/metanorma/output/xslfo.rb +21 -0
- data/spec/assets/outputtest/a.xml +66 -0
- data/spec/assets/outputtest/iso.international-standard.xsl +3011 -0
- data/spec/isodoc/blocks_spec.rb +327 -243
- metadata +8 -18
- data/lib/isodoc/html_function/sectionsplit.rb +0 -244
- data/spec/isodoc/sectionsplit_spec.rb +0 -190
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d69468979c5c216cf0ecfb59a2422cbea3f4ff78be413543e550782ecc75aa55
|
4
|
+
data.tar.gz: a8e5c30097afed0414ca7a6ecb5129d3c3fcd1a24df8c6e9d51222d644bf07ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 637dc353b19c3a6fcbbf70280604979320760af8c2e552aa80d9752a55948c07285c7f887d1461da541e8425c53749246f4d2f1141c09497caf886209b03dccb
|
7
|
+
data.tar.gz: 74e114b5ffb25828b465b213c9ca05994e6f5f22ef0711407eb2928d21a64c7a47ecd4e3c8548813c2e96bc81079db6e66f84c438b646df33d3b9e05c89378cb
|
data/isodoc.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_dependency "html2doc", "~> 1.1.1"
|
33
33
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
34
34
|
spec.add_dependency "liquid", "~> 4"
|
35
|
-
spec.add_dependency "metanorma", ">= 1.2.0"
|
35
|
+
#spec.add_dependency "metanorma", ">= 1.2.0"
|
36
36
|
spec.add_dependency "nokogiri", "~> 1.11.0"
|
37
37
|
spec.add_dependency "relaton-cli"
|
38
38
|
spec.add_dependency "roman-numerals"
|
data/lib/isodoc.rb
CHANGED
@@ -1,231 +1,243 @@
|
|
1
1
|
require_relative "blocks_example_note"
|
2
2
|
|
3
|
-
module IsoDoc
|
4
|
-
module
|
5
|
-
|
3
|
+
module IsoDoc
|
4
|
+
module Function
|
5
|
+
module Blocks
|
6
|
+
@annotation = false
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
def middle_title(_isoxml, out)
|
9
|
+
out.p(**{ class: "zzSTDTitle1" }) { |p| p << @meta.get[:doctitle] }
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def middle_admonitions(isoxml, out)
|
13
|
+
isoxml.xpath(ns("//sections/note | //sections/admonition")).each do |x|
|
14
|
+
parse(x, out)
|
15
|
+
end
|
14
16
|
end
|
15
|
-
end
|
16
17
|
|
17
|
-
|
18
|
-
|
18
|
+
def figure_name_parse(_node, div, name)
|
19
|
+
return if name.nil?
|
19
20
|
|
20
|
-
|
21
|
-
|
21
|
+
div.p **{ class: "FigureTitle", style: "text-align:center;" } do |p|
|
22
|
+
name.children.each { |n| parse(n, p) }
|
23
|
+
end
|
22
24
|
end
|
23
|
-
end
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
def figure_key(out)
|
27
|
+
out.p **{ style: "page-break-after:avoid;" } do |p|
|
28
|
+
p.b { |b| b << @i18n.key }
|
29
|
+
end
|
28
30
|
end
|
29
|
-
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
def figure_attrs(node)
|
33
|
+
attr_code(id: node["id"], class: "figure", style: keep_style(node))
|
34
|
+
end
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
def figure_parse(node, out)
|
37
|
+
return pseudocode_parse(node, out) if node["class"] == "pseudocode" ||
|
38
|
+
node["type"] == "pseudocode"
|
39
|
+
|
40
|
+
@in_figure = true
|
41
|
+
figure_parse1(node, out)
|
42
|
+
@in_figure = false
|
43
|
+
end
|
38
44
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
45
|
+
def figure_parse1(node, out)
|
46
|
+
out.div **figure_attrs(node) do |div|
|
47
|
+
node.children.each do |n|
|
48
|
+
figure_key(out) if n.name == "dl"
|
49
|
+
parse(n, div) unless n.name == "name"
|
50
|
+
end
|
51
|
+
figure_name_parse(node, div, node.at(ns("./name")))
|
44
52
|
end
|
45
|
-
figure_name_parse(node, div, node.at(ns("./name")))
|
46
53
|
end
|
47
|
-
@in_figure = false
|
48
|
-
end
|
49
54
|
|
50
|
-
|
51
|
-
|
52
|
-
|
55
|
+
def pseudocode_attrs(node)
|
56
|
+
attr_code(id: node["id"], class: "pseudocode", style: keep_style(node))
|
57
|
+
end
|
53
58
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
59
|
+
def pseudocode_parse(node, out)
|
60
|
+
@in_figure = true
|
61
|
+
name = node.at(ns("./name"))
|
62
|
+
out.div **pseudocode_attrs(node) do |div|
|
63
|
+
node.children.each { |n| parse(n, div) unless n.name == "name" }
|
64
|
+
sourcecode_name_parse(node, div, name)
|
65
|
+
end
|
66
|
+
@in_figure = false
|
60
67
|
end
|
61
|
-
@in_figure = false
|
62
|
-
end
|
63
68
|
|
64
|
-
|
65
|
-
|
69
|
+
def sourcecode_name_parse(_node, div, name)
|
70
|
+
return if name.nil?
|
66
71
|
|
67
|
-
|
68
|
-
|
72
|
+
div.p **{ class: "SourceTitle", style: "text-align:center;" } do |p|
|
73
|
+
name.children.each { |n| parse(n, p) }
|
74
|
+
end
|
69
75
|
end
|
70
|
-
end
|
71
76
|
|
72
|
-
|
73
|
-
|
74
|
-
|
77
|
+
def admonition_name_parse(_node, div, name)
|
78
|
+
div.p **{ class: "AdmonitionTitle", style: "text-align:center;" } do |p|
|
79
|
+
name.children.each { |n| parse(n, p) }
|
80
|
+
end
|
75
81
|
end
|
76
|
-
end
|
77
82
|
|
78
|
-
|
79
|
-
|
80
|
-
|
83
|
+
def sourcecode_attrs(node)
|
84
|
+
attr_code(id: node["id"], class: "Sourcecode", style: keep_style(node))
|
85
|
+
end
|
81
86
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
87
|
+
def sourcecode_parse(node, out)
|
88
|
+
name = node.at(ns("./name"))
|
89
|
+
out.p **sourcecode_attrs(node) do |div|
|
90
|
+
@sourcecode = true
|
91
|
+
node.children.each { |n| parse(n, div) unless n.name == "name" }
|
92
|
+
@sourcecode = false
|
93
|
+
end
|
94
|
+
sourcecode_name_parse(node, out, name)
|
88
95
|
end
|
89
|
-
sourcecode_name_parse(node, out, name)
|
90
|
-
end
|
91
96
|
|
92
|
-
|
93
|
-
|
94
|
-
|
97
|
+
def pre_parse(node, out)
|
98
|
+
out.pre node.text, **attr_code(id: node["id"])
|
99
|
+
end
|
95
100
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
101
|
+
def annotation_parse(node, out)
|
102
|
+
@sourcecode = false
|
103
|
+
@annotation = true
|
104
|
+
node.at("./preceding-sibling::*[local-name() = 'annotation']") or
|
105
|
+
out << "<br/>"
|
106
|
+
callout = node.at(ns("//callout[@target='#{node['id']}']"))
|
107
|
+
out << "<br/><#{callout.text}> "
|
108
|
+
out << node&.children&.text&.strip
|
109
|
+
@annotation = false
|
110
|
+
end
|
106
111
|
|
107
|
-
|
108
|
-
|
109
|
-
|
112
|
+
def admonition_class(_node)
|
113
|
+
"Admonition"
|
114
|
+
end
|
110
115
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
116
|
+
def admonition_name(node, type)
|
117
|
+
name = node&.at(ns("./name")) and return name
|
118
|
+
name = Nokogiri::XML::Node.new("name", node.document)
|
119
|
+
return unless type && @i18n.admonition[type]
|
115
120
|
|
116
|
-
|
117
|
-
|
118
|
-
|
121
|
+
name << @i18n.admonition[type]&.upcase
|
122
|
+
name
|
123
|
+
end
|
119
124
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
125
|
+
def admonition_attrs(node)
|
126
|
+
attr_code(id: node["id"], class: admonition_class(node),
|
127
|
+
style: keep_style(node))
|
128
|
+
end
|
124
129
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
130
|
+
def admonition_parse(node, out)
|
131
|
+
type = node["type"]
|
132
|
+
name = admonition_name(node, type)
|
133
|
+
out.div **admonition_attrs(node) do |t|
|
134
|
+
admonition_name_parse(node, t, name) if name
|
135
|
+
node.children.each { |n| parse(n, t) unless n.name == "name" }
|
136
|
+
end
|
131
137
|
end
|
132
|
-
end
|
133
138
|
|
134
|
-
|
135
|
-
|
139
|
+
def formula_where(dlist, out)
|
140
|
+
return unless dlist
|
136
141
|
|
137
|
-
|
138
|
-
|
142
|
+
out.p **{ style: "page-break-after:avoid;" } do |p|
|
143
|
+
p << @i18n.where
|
144
|
+
end
|
145
|
+
parse(dlist, out)
|
146
|
+
out.parent.at("./dl")["class"] = "formula_dl"
|
139
147
|
end
|
140
|
-
parse(dl, out)
|
141
|
-
out.parent.at("./dl")["class"] = "formula_dl"
|
142
|
-
end
|
143
148
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
149
|
+
def formula_parse1(node, out)
|
150
|
+
out.div **attr_code(class: "formula") do |div|
|
151
|
+
div.p do |_p|
|
152
|
+
parse(node.at(ns("./stem")), div)
|
153
|
+
if lbl = node&.at(ns("./name"))&.text
|
154
|
+
insert_tab(div, 1)
|
155
|
+
div << "(#{lbl})"
|
156
|
+
end
|
151
157
|
end
|
152
158
|
end
|
153
159
|
end
|
154
|
-
end
|
155
160
|
|
156
|
-
|
157
|
-
|
158
|
-
|
161
|
+
def formula_attrs(node)
|
162
|
+
attr_code(id: node["id"], style: keep_style(node))
|
163
|
+
end
|
159
164
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
165
|
+
def formula_parse(node, out)
|
166
|
+
out.div **formula_attrs(node) do |div|
|
167
|
+
formula_parse1(node, div)
|
168
|
+
formula_where(node.at(ns("./dl")), div)
|
169
|
+
node.children.each do |n|
|
170
|
+
next if %w(stem dl name).include? n.name
|
166
171
|
|
167
|
-
|
172
|
+
parse(n, div)
|
173
|
+
end
|
168
174
|
end
|
169
175
|
end
|
170
|
-
end
|
171
176
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
177
|
+
def para_class(_node)
|
178
|
+
classtype = nil
|
179
|
+
classtype = "MsoCommentText" if in_comment
|
180
|
+
classtype = "Sourcecode" if @annotation
|
181
|
+
classtype
|
182
|
+
end
|
178
183
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
184
|
+
def para_attrs(node)
|
185
|
+
attrs = { class: para_class(node), id: node["id"] }
|
186
|
+
s = node["align"].nil? ? "" : "text-align:#{node['align']};"
|
187
|
+
s = "#{s}#{keep_style(node)}"
|
188
|
+
attrs[:style] = s unless s.empty?
|
189
|
+
attrs
|
190
|
+
end
|
186
191
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
+
def para_parse(node, out)
|
193
|
+
out.p **attr_code(para_attrs(node)) do |p|
|
194
|
+
unless @termdomain.empty?
|
195
|
+
p << "<#{@termdomain}> "
|
196
|
+
@termdomain = ""
|
197
|
+
end
|
198
|
+
node.children.each { |n| parse(n, p) }
|
192
199
|
end
|
193
|
-
node.children.each { |n| parse(n, p) }
|
194
200
|
end
|
195
|
-
end
|
196
201
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
202
|
+
def quote_attribution(node, out)
|
203
|
+
author = node.at(ns("./author"))
|
204
|
+
source = node.at(ns("./source"))
|
205
|
+
return if author.nil? && source.nil?
|
201
206
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
207
|
+
out.p **{ class: "QuoteAttribution" } do |p|
|
208
|
+
p << "— #{author.text}" if author
|
209
|
+
p << ", " if author && source
|
210
|
+
eref_parse(source, p) if source
|
211
|
+
end
|
206
212
|
end
|
207
|
-
end
|
208
213
|
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
214
|
+
def quote_parse(node, out)
|
215
|
+
attrs = para_attrs(node)
|
216
|
+
attrs[:class] = "Quote"
|
217
|
+
out.div **attr_code(attrs) do |p|
|
218
|
+
node.children.each do |n|
|
219
|
+
parse(n, p) unless %w(author source).include? n.name
|
220
|
+
end
|
221
|
+
quote_attribution(node, out)
|
215
222
|
end
|
216
|
-
quote_attribution(node, out)
|
217
223
|
end
|
218
|
-
end
|
219
224
|
|
220
|
-
|
221
|
-
|
222
|
-
|
225
|
+
def passthrough_parse(node, out)
|
226
|
+
return if node["format"] &&
|
227
|
+
!(node["format"].split(",").include? @format.to_s)
|
223
228
|
|
224
|
-
|
225
|
-
|
229
|
+
out.passthrough node.text
|
230
|
+
end
|
226
231
|
|
227
|
-
|
228
|
-
|
232
|
+
def svg_parse(node, out)
|
233
|
+
out.parent.add_child(node)
|
234
|
+
end
|
235
|
+
|
236
|
+
def toc_parse(node, out)
|
237
|
+
out.div **{ class: "toc" } do |div|
|
238
|
+
node.children.each { |n| parse(n, div) }
|
239
|
+
end
|
240
|
+
end
|
229
241
|
end
|
230
242
|
end
|
231
243
|
end
|
@@ -1,237 +1,239 @@
|
|
1
1
|
require "fileutils"
|
2
2
|
require "pathname"
|
3
3
|
|
4
|
-
module IsoDoc
|
5
|
-
module
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
module IsoDoc
|
5
|
+
module Function
|
6
|
+
module ToWordHtml
|
7
|
+
def set_termdomain(termdomain)
|
8
|
+
@termdomain = termdomain
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
def in_sourcecode
|
12
|
+
@sourcecode
|
13
|
+
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
def note?
|
16
|
+
@note
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
19
|
+
def init_file(filename, debug)
|
20
|
+
filepath = Pathname.new(filename)
|
21
|
+
filename = filepath.sub_ext("").sub(/\.presentation$/, "").to_s
|
22
|
+
dir = init_dir(filename, debug)
|
23
|
+
@filename = filename
|
24
|
+
@localdir = "#{filepath.parent}/"
|
25
|
+
@sourcedir = @localdir
|
26
|
+
@sourcefilename and
|
27
|
+
@sourcedir = "#{Pathname.new(@sourcefilename).parent}/"
|
28
|
+
[filename, dir]
|
29
|
+
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
def init_dir(filename, debug)
|
32
|
+
dir = "#{filename}_files"
|
33
|
+
unless debug
|
34
|
+
Dir.mkdir(dir, 0o777) unless File.exists?(dir)
|
35
|
+
FileUtils.rm_rf "#{dir}/*"
|
36
|
+
end
|
37
|
+
dir
|
36
38
|
end
|
37
|
-
dir
|
38
|
-
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
# tmp image dir is same directory as @filename
|
41
|
+
def tmpimagedir
|
42
|
+
@filename + tmpimagedir_suffix
|
43
|
+
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
def rel_tmpimagedir
|
46
|
+
Pathname.new(@filename).basename.to_s + tmpimagedir_suffix
|
47
|
+
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
49
|
+
# isodoc.css overrides any CSS injected by Html2Doc, which
|
50
|
+
# is inserted before this CSS.
|
51
|
+
def define_head(head, _filename, _dir)
|
52
|
+
if @standardstylesheet
|
53
|
+
head.style do |style|
|
54
|
+
@standardstylesheet.open
|
55
|
+
stylesheet = @standardstylesheet.read
|
56
|
+
style.comment "\n#{stylesheet}\n"
|
57
|
+
end
|
57
58
|
end
|
58
59
|
end
|
59
|
-
end
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
|
-
def make_body(xml, docxml)
|
66
|
-
xml.body **body_attr do |body|
|
67
|
-
make_body1(body, docxml)
|
68
|
-
make_body2(body, docxml)
|
69
|
-
make_body3(body, docxml)
|
61
|
+
def body_attr
|
62
|
+
{ lang: @lang.to_s }
|
70
63
|
end
|
71
|
-
end
|
72
64
|
|
73
|
-
|
74
|
-
|
75
|
-
|
65
|
+
def make_body(xml, docxml)
|
66
|
+
xml.body **body_attr do |body|
|
67
|
+
make_body1(body, docxml)
|
68
|
+
make_body2(body, docxml)
|
69
|
+
make_body3(body, docxml)
|
70
|
+
end
|
76
71
|
end
|
77
|
-
section_break(body)
|
78
|
-
end
|
79
72
|
|
80
|
-
|
81
|
-
|
82
|
-
|
73
|
+
def make_body1(body, _docxml)
|
74
|
+
body.div **{ class: "title-section" } do |div1|
|
75
|
+
div1.p { |p| p << " " } # placeholder
|
76
|
+
end
|
77
|
+
section_break(body)
|
83
78
|
end
|
84
|
-
section_break(body)
|
85
|
-
end
|
86
79
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
foreword docxml, div3
|
93
|
-
introduction docxml, div3
|
94
|
-
acknowledgements docxml, div3
|
95
|
-
middle docxml, div3
|
96
|
-
footnotes div3
|
97
|
-
comments div3
|
80
|
+
def make_body2(body, _docxml)
|
81
|
+
body.div **{ class: "prefatory-section" } do |div2|
|
82
|
+
div2.p { |p| p << " " } # placeholder
|
83
|
+
end
|
84
|
+
section_break(body)
|
98
85
|
end
|
99
|
-
end
|
100
86
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
@meta.keywords isoxml, out
|
115
|
-
@meta.note isoxml, out
|
116
|
-
@meta.get
|
117
|
-
end
|
87
|
+
def make_body3(body, docxml)
|
88
|
+
body.div **{ class: "main-section" } do |div3|
|
89
|
+
boilerplate docxml, div3
|
90
|
+
preface_block docxml, div3
|
91
|
+
abstract docxml, div3
|
92
|
+
foreword docxml, div3
|
93
|
+
introduction docxml, div3
|
94
|
+
acknowledgements docxml, div3
|
95
|
+
middle docxml, div3
|
96
|
+
footnotes div3
|
97
|
+
comments div3
|
98
|
+
end
|
99
|
+
end
|
118
100
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
101
|
+
def info(isoxml, out)
|
102
|
+
@meta.title isoxml, out
|
103
|
+
@meta.subtitle isoxml, out
|
104
|
+
@meta.docstatus isoxml, out
|
105
|
+
@meta.docid isoxml, out
|
106
|
+
@meta.otherid isoxml, out
|
107
|
+
@meta.docnumeric isoxml, out
|
108
|
+
@meta.doctype isoxml, out
|
109
|
+
@meta.author isoxml, out
|
110
|
+
@meta.bibdate isoxml, out
|
111
|
+
@meta.relations isoxml, out
|
112
|
+
@meta.version isoxml, out
|
113
|
+
@meta.url isoxml, out
|
114
|
+
@meta.keywords isoxml, out
|
115
|
+
@meta.note isoxml, out
|
116
|
+
@meta.get
|
117
|
+
end
|
130
118
|
|
131
|
-
|
132
|
-
|
119
|
+
def middle(isoxml, out)
|
120
|
+
middle_title(isoxml, out)
|
121
|
+
middle_admonitions(isoxml, out)
|
122
|
+
i = scope isoxml, out, 0
|
123
|
+
i = norm_ref isoxml, out, i
|
124
|
+
i = terms_defs isoxml, out, i
|
125
|
+
symbols_abbrevs isoxml, out, i
|
126
|
+
clause isoxml, out
|
127
|
+
annex isoxml, out
|
128
|
+
bibliography isoxml, out
|
129
|
+
end
|
133
130
|
|
134
|
-
boilerplate
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
131
|
+
def boilerplate(node, out)
|
132
|
+
return if @bare
|
133
|
+
|
134
|
+
boilerplate = node.at(ns("//boilerplate")) or return
|
135
|
+
out.div **{ class: "authority" } do |s|
|
136
|
+
boilerplate.children.each do |n|
|
137
|
+
if n.name == "title"
|
138
|
+
s.h1 do |h|
|
139
|
+
n.children.each { |nn| parse(nn, h) }
|
140
|
+
end
|
141
|
+
else parse(n, s)
|
140
142
|
end
|
141
|
-
else parse(n, s)
|
142
143
|
end
|
143
144
|
end
|
144
145
|
end
|
145
|
-
end
|
146
146
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
147
|
+
def parse(node, out)
|
148
|
+
if node.text? then text_parse(node, out)
|
149
|
+
else
|
150
|
+
case node.name
|
151
|
+
when "em" then em_parse(node, out)
|
152
|
+
when "strong" then strong_parse(node, out)
|
153
|
+
when "sup" then sup_parse(node, out)
|
154
|
+
when "sub" then sub_parse(node, out)
|
155
|
+
when "tt" then tt_parse(node, out)
|
156
|
+
when "strike" then strike_parse(node, out)
|
157
|
+
when "underline" then underline_parse(node, out)
|
158
|
+
when "keyword" then keyword_parse(node, out)
|
159
|
+
when "smallcap" then smallcap_parse(node, out)
|
160
|
+
when "br" then br_parse(node, out)
|
161
|
+
when "hr" then hr_parse(node, out)
|
162
|
+
when "bookmark" then bookmark_parse(node, out)
|
163
|
+
when "pagebreak" then pagebreak_parse(node, out)
|
164
|
+
when "callout" then callout_parse(node, out)
|
165
|
+
when "stem" then stem_parse(node, out)
|
166
|
+
when "clause" then clause_parse(node, out)
|
167
|
+
when "xref" then xref_parse(node, out)
|
168
|
+
when "eref" then eref_parse(node, out)
|
169
|
+
when "origin" then origin_parse(node, out)
|
170
|
+
when "link" then link_parse(node, out)
|
171
|
+
when "ul" then ul_parse(node, out)
|
172
|
+
when "ol" then ol_parse(node, out)
|
173
|
+
when "li" then li_parse(node, out)
|
174
|
+
when "dl" then dl_parse(node, out)
|
175
|
+
when "fn" then footnote_parse(node, out)
|
176
|
+
when "p" then para_parse(node, out)
|
177
|
+
when "quote" then quote_parse(node, out)
|
178
|
+
when "tr" then tr_parse(node, out)
|
179
|
+
when "note" then note_parse(node, out)
|
180
|
+
when "review" then review_note_parse(node, out)
|
181
|
+
when "admonition" then admonition_parse(node, out)
|
182
|
+
when "formula" then formula_parse(node, out)
|
183
|
+
when "table" then table_parse(node, out)
|
184
|
+
when "figure" then figure_parse(node, out)
|
185
|
+
when "example" then example_parse(node, out)
|
186
|
+
when "image" then image_parse(node, out, nil)
|
187
|
+
when "sourcecode" then sourcecode_parse(node, out)
|
188
|
+
when "pre" then pre_parse(node, out)
|
189
|
+
when "annotation" then annotation_parse(node, out)
|
190
|
+
when "term" then termdef_parse(node, out)
|
191
|
+
when "preferred" then term_parse(node, out)
|
192
|
+
when "admitted" then admitted_term_parse(node, out)
|
193
|
+
when "deprecates" then deprecated_term_parse(node, out)
|
194
|
+
when "domain" then set_termdomain(node.text)
|
195
|
+
when "definition" then definition_parse(node, out)
|
196
|
+
when "termsource" then termref_parse(node, out)
|
197
|
+
when "modification" then modification_parse(node, out)
|
198
|
+
when "termnote" then termnote_parse(node, out)
|
199
|
+
when "termexample" then example_parse(node, out)
|
200
|
+
when "terms" then terms_parse(node, out)
|
201
|
+
when "definitions" then symbols_parse(node, out)
|
202
|
+
when "references" then bibliography_parse(node, out)
|
203
|
+
when "termdocsource" then termdocsource_parse(node, out)
|
204
|
+
when "requirement" then requirement_parse(node, out)
|
205
|
+
when "recommendation" then recommendation_parse(node, out)
|
206
|
+
when "permission" then permission_parse(node, out)
|
207
|
+
when "subject" then requirement_skip_parse(node, out)
|
208
|
+
when "classification" then requirement_skip_parse(node, out)
|
209
|
+
when "inherit" then requirement_component_parse(node, out)
|
210
|
+
when "description" then requirement_component_parse(node, out)
|
211
|
+
when "specification" then requirement_component_parse(node, out)
|
212
|
+
when "measurement-target" then requirement_component_parse(node, out)
|
213
|
+
when "verification" then requirement_component_parse(node, out)
|
214
|
+
when "import" then requirement_component_parse(node, out)
|
215
|
+
when "index" then index_parse(node, out)
|
216
|
+
when "index-xref" then index_xref_parse(node, out)
|
217
|
+
when "termref" then termrefelem_parse(node, out)
|
218
|
+
when "copyright-statement" then copyright_parse(node, out)
|
219
|
+
when "license-statement" then license_parse(node, out)
|
220
|
+
when "legal-statement" then legal_parse(node, out)
|
221
|
+
when "feedback-statement" then feedback_parse(node, out)
|
222
|
+
when "passthrough" then passthrough_parse(node, out)
|
223
|
+
when "amend" then amend_parse(node, out)
|
224
|
+
when "tab" then clausedelimspace(out) # in Presentation XML only
|
225
|
+
when "svg" then svg_parse(node, out) # in Presentation XML only
|
226
|
+
when "add" then add_parse(node, out)
|
227
|
+
when "del" then del_parse(node, out)
|
228
|
+
when "form" then form_parse(node, out)
|
229
|
+
when "input" then input_parse(node, out)
|
230
|
+
when "select" then select_parse(node, out)
|
231
|
+
when "label" then label_parse(node, out)
|
232
|
+
when "option" then option_parse(node, out)
|
233
|
+
when "textarea" then textarea_parse(node, out)
|
234
|
+
when "toc" then toc_parse(node, out)
|
235
|
+
else error_parse(node, out)
|
236
|
+
end
|
235
237
|
end
|
236
238
|
end
|
237
239
|
end
|