isodoc 1.5.5 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +2 -12
- data/.hound.yml +3 -1
- data/.rubocop.yml +3 -7
- data/Gemfile +2 -2
- data/Rakefile +2 -2
- data/bin/rspec +1 -2
- data/isodoc.gemspec +11 -11
- data/lib/isodoc-yaml/i18n-ar.yaml +152 -0
- data/lib/isodoc-yaml/i18n-de.yaml +149 -0
- data/lib/isodoc-yaml/i18n-es.yaml +151 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +154 -0
- data/lib/isodoc.rb +0 -2
- data/lib/isodoc/base_style/all.css +7 -0
- data/lib/isodoc/base_style/metanorma_word.css +7 -0
- data/lib/isodoc/base_style/metanorma_word.scss +8 -0
- data/lib/isodoc/base_style/reset.css +7 -0
- data/lib/isodoc/base_style/reset.scss +9 -0
- data/lib/isodoc/base_style/scripts.html +187 -0
- data/lib/isodoc/class_utils.rb +6 -5
- data/lib/isodoc/common.rb +2 -0
- data/lib/isodoc/convert.rb +30 -17
- data/lib/isodoc/css.rb +43 -34
- data/lib/isodoc/function/blocks.rb +21 -4
- data/lib/isodoc/function/blocks_example_note.rb +2 -2
- data/lib/isodoc/function/cleanup.rb +53 -45
- data/lib/isodoc/function/form.rb +51 -0
- data/lib/isodoc/function/inline.rb +37 -15
- data/lib/isodoc/function/references.rb +55 -42
- data/lib/isodoc/function/section.rb +29 -16
- data/lib/isodoc/function/table.rb +1 -0
- data/lib/isodoc/function/to_word_html.rb +33 -29
- data/lib/isodoc/function/utils.rb +180 -159
- data/lib/isodoc/gem_tasks.rb +30 -31
- data/lib/isodoc/headlesshtml_convert.rb +8 -7
- data/lib/isodoc/html_convert.rb +6 -4
- data/lib/isodoc/html_function/comments.rb +2 -0
- data/lib/isodoc/html_function/footnotes.rb +14 -7
- data/lib/isodoc/html_function/form.rb +62 -0
- data/lib/isodoc/html_function/html.rb +30 -26
- data/lib/isodoc/html_function/postprocess.rb +41 -82
- data/lib/isodoc/html_function/postprocess_footnotes.rb +59 -0
- data/lib/isodoc/i18n.rb +33 -31
- data/lib/isodoc/pdf_convert.rb +12 -16
- data/lib/isodoc/presentation_function/bibdata.rb +54 -30
- data/lib/isodoc/presentation_function/block.rb +17 -8
- data/lib/isodoc/presentation_function/inline.rb +84 -120
- data/lib/isodoc/presentation_function/math.rb +84 -0
- data/lib/isodoc/presentation_function/section.rb +20 -22
- data/lib/isodoc/presentation_xml_convert.rb +2 -1
- data/lib/isodoc/sassc_importer.rb +1 -1
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +28 -24
- data/lib/isodoc/word_function/footnotes.rb +22 -15
- data/lib/isodoc/word_function/postprocess.rb +50 -36
- data/lib/isodoc/xref.rb +9 -10
- data/lib/isodoc/xref/xref_counter.rb +32 -17
- data/lib/isodoc/xref/xref_gen.rb +33 -21
- data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
- data/lib/isodoc/xref/xref_sect_gen.rb +37 -35
- data/lib/isodoc/xslfo_convert.rb +36 -27
- data/spec/assets/scripts_override.html +3 -0
- data/spec/isodoc/blocks_spec.rb +2490 -2591
- data/spec/isodoc/cleanup_spec.rb +1107 -1109
- data/spec/isodoc/footnotes_spec.rb +1 -16
- data/spec/isodoc/form_spec.rb +156 -0
- data/spec/isodoc/i18n_spec.rb +984 -972
- data/spec/isodoc/inline_spec.rb +1129 -912
- data/spec/isodoc/lists_spec.rb +316 -315
- data/spec/isodoc/postproc_spec.rb +1751 -1540
- data/spec/isodoc/presentation_xml_spec.rb +403 -323
- data/spec/isodoc/ref_spec.rb +718 -723
- data/spec/isodoc/section_spec.rb +910 -902
- data/spec/isodoc/table_spec.rb +566 -556
- data/spec/isodoc/terms_spec.rb +251 -255
- data/spec/isodoc/xref_spec.rb +3041 -2992
- data/spec/isodoc/xslfo_convert_spec.rb +39 -0
- data/spec/spec_helper.rb +30 -29
- metadata +77 -65
@@ -0,0 +1,51 @@
|
|
1
|
+
module IsoDoc::Function
|
2
|
+
module Form
|
3
|
+
def form_parse(node, out)
|
4
|
+
node.children.each do |n|
|
5
|
+
parse(n, out)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def input_parse(node, out)
|
10
|
+
case node["type"]
|
11
|
+
when "button" then out << "[#{node['value'] || 'BUTTON'}]"
|
12
|
+
when "checkbox" then out << "☐ "
|
13
|
+
when "date" then text_input(out)
|
14
|
+
when "file" then text_input(out)
|
15
|
+
when "password" then text_input(out)
|
16
|
+
when "radio" then out << "◎ "
|
17
|
+
when "submit" # nop
|
18
|
+
when "text" then text_input(out, node["maxlength"])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def text_input(out, length = 10)
|
23
|
+
length ||= 10
|
24
|
+
length = length.to_i
|
25
|
+
length.zero? and length = 10
|
26
|
+
out << "_" * length
|
27
|
+
out << " "
|
28
|
+
end
|
29
|
+
|
30
|
+
def select_parse(node, out)
|
31
|
+
text_input(out, node["size"] || 10)
|
32
|
+
end
|
33
|
+
|
34
|
+
def label_parse(node, out)
|
35
|
+
node.children.each do |n|
|
36
|
+
parse(n, out)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def option_parse(node, out); end
|
41
|
+
|
42
|
+
def textarea_parse(_node, out)
|
43
|
+
out.table **{ border: 1, width: "50%" } do |t|
|
44
|
+
t.tr do |tr|
|
45
|
+
tr.td do |td|
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -3,11 +3,12 @@ require_relative "inline_simple"
|
|
3
3
|
module IsoDoc::Function
|
4
4
|
module Inline
|
5
5
|
def link_parse(node, out)
|
6
|
-
|
6
|
+
url = node["target"]
|
7
|
+
node["updatetype"] == "true" and url = suffix_url(url)
|
8
|
+
out.a **attr_code(href: url, title: node["alt"]) do |l|
|
7
9
|
if node.text.empty?
|
8
10
|
l << node["target"].sub(/^mailto:/, "")
|
9
|
-
else
|
10
|
-
node.children.each { |n| parse(n, l) }
|
11
|
+
else node.children.each { |n| parse(n, l) }
|
11
12
|
end
|
12
13
|
end
|
13
14
|
end
|
@@ -23,21 +24,27 @@ module IsoDoc::Function
|
|
23
24
|
end
|
24
25
|
|
25
26
|
def xref_parse(node, out)
|
26
|
-
target = /#/.match(node["target"])
|
27
|
-
|
28
|
-
|
27
|
+
target = if /#/.match?(node["target"])
|
28
|
+
node["target"].sub(/#/, ".html#")
|
29
|
+
else
|
30
|
+
"##{node['target']}"
|
31
|
+
end
|
32
|
+
out.a(**{ "href": target }) { |l| no_locality_parse(node, l) }
|
29
33
|
end
|
30
34
|
|
31
35
|
def suffix_url(url)
|
32
|
-
return url if %r{^
|
36
|
+
return url if %r{^https?://}.match?(url)
|
37
|
+
return url unless File.extname(url).empty?
|
38
|
+
|
33
39
|
url.sub(/#{File.extname(url)}$/, ".html")
|
34
40
|
end
|
35
41
|
|
36
42
|
def eref_target(node)
|
37
|
-
href = "
|
43
|
+
href = "##{node['bibitemid']}"
|
38
44
|
url = node.at(ns("//bibitem[@id = '#{node['bibitemid']}']/"\
|
39
45
|
"uri[@type = 'citation']"))
|
40
46
|
return href unless url
|
47
|
+
|
41
48
|
href = suffix_url(url.text)
|
42
49
|
anchor = node&.at(ns(".//locality[@type = 'anchor']"))&.text&.strip
|
43
50
|
anchor and href += "##{anchor}"
|
@@ -68,12 +75,12 @@ module IsoDoc::Function
|
|
68
75
|
end
|
69
76
|
|
70
77
|
def stem_parse(node, out)
|
71
|
-
ooml =
|
78
|
+
ooml = case node["type"]
|
79
|
+
when "AsciiMath"
|
72
80
|
"#{@openmathdelim}#{HTMLEntities.new.encode(node.text)}"\
|
73
81
|
"#{@closemathdelim}"
|
74
|
-
|
75
|
-
else
|
76
|
-
HTMLEntities.new.encode(node.text)
|
82
|
+
when "MathML" then node.first_element_child.to_s
|
83
|
+
else HTMLEntities.new.encode(node.text)
|
77
84
|
end
|
78
85
|
out.span **{ class: "stem" } do |span|
|
79
86
|
span.parent.add_child ooml
|
@@ -93,7 +100,7 @@ module IsoDoc::Function
|
|
93
100
|
height: node["height"] || "auto",
|
94
101
|
width: node["width"] || "auto",
|
95
102
|
title: node["title"],
|
96
|
-
alt: node["alt"]
|
103
|
+
alt: node["alt"] }
|
97
104
|
out.img **attr_code(attrs)
|
98
105
|
image_title_parse(out, caption)
|
99
106
|
end
|
@@ -106,12 +113,27 @@ module IsoDoc::Function
|
|
106
113
|
|
107
114
|
def text_parse(node, out)
|
108
115
|
return if node.nil? || node.text.nil?
|
116
|
+
|
109
117
|
text = node.to_s
|
110
|
-
|
111
|
-
gsub(
|
118
|
+
if in_sourcecode
|
119
|
+
text = text.gsub("\n", "<br/>").gsub("<br/> ", "<br/> ")
|
120
|
+
.gsub(/ (?= )/, " ")
|
121
|
+
end
|
112
122
|
out << text
|
113
123
|
end
|
114
124
|
|
125
|
+
def add_parse(node, out)
|
126
|
+
out.span **{ class: "addition" } do |e|
|
127
|
+
node.children.each { |n| parse(n, e) }
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def del_parse(node, out)
|
132
|
+
out.span **{ class: "deletion" } do |e|
|
133
|
+
node.children.each { |n| parse(n, e) }
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
115
137
|
def error_parse(node, out)
|
116
138
|
text = node.to_xml.gsub(/</, "<").gsub(/>/, ">")
|
117
139
|
out.para do |p|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module IsoDoc::Function
|
2
2
|
module References
|
3
|
-
|
4
3
|
# This is highly specific to ISO, but it's not a bad precedent for
|
5
4
|
# references anyway; keeping here instead of in IsoDoc::Iso for now
|
6
|
-
def docid_l10n(
|
7
|
-
return
|
8
|
-
|
9
|
-
|
5
|
+
def docid_l10n(text)
|
6
|
+
return text if text.nil?
|
7
|
+
|
8
|
+
text.gsub(/All Parts/i, @i18n.all_parts.downcase) if @i18n.all_parts
|
9
|
+
text
|
10
10
|
end
|
11
11
|
|
12
12
|
# TODO generate formatted ref if not present
|
@@ -16,7 +16,7 @@ module IsoDoc::Function
|
|
16
16
|
identifiers = render_identifier(ids)
|
17
17
|
if biblio then ref_entry_code(ref, ordinal, identifiers, ids)
|
18
18
|
else
|
19
|
-
ref <<
|
19
|
+
ref << (identifiers[0] || identifiers[1]).to_s
|
20
20
|
ref << ", #{identifiers[1]}" if identifiers[0] && identifiers[1]
|
21
21
|
end
|
22
22
|
ref << ", " unless biblio && !identifiers[1]
|
@@ -29,7 +29,7 @@ module IsoDoc::Function
|
|
29
29
|
identifiers = render_identifier(bibitem_ref_code(b))
|
30
30
|
if biblio then ref_entry_code(ref, ordinal, identifiers, nil)
|
31
31
|
else
|
32
|
-
ref <<
|
32
|
+
ref << (identifiers[0] || identifiers[1]).to_s
|
33
33
|
ref << ", #{identifiers[1]}" if identifiers[0] && identifiers[1]
|
34
34
|
end
|
35
35
|
date_note_process(b, ref)
|
@@ -40,9 +40,9 @@ module IsoDoc::Function
|
|
40
40
|
|
41
41
|
# if t is just a number, only use that ([1] Non-Standard)
|
42
42
|
# else, use both ordinal, as prefix, and t
|
43
|
-
def ref_entry_code(r, ordinal, t,
|
43
|
+
def ref_entry_code(r, ordinal, t, _id)
|
44
44
|
prefix_bracketed_ref(r, t[0] || "[#{ordinal}]")
|
45
|
-
t[1] and r <<
|
45
|
+
t[1] and r << (t[1]).to_s
|
46
46
|
end
|
47
47
|
|
48
48
|
def pref_ref_code(b)
|
@@ -55,27 +55,36 @@ module IsoDoc::Function
|
|
55
55
|
id = b.at(ns("./docidentifier[@type = 'metanorma']"))
|
56
56
|
id1 = pref_ref_code(b)
|
57
57
|
id2 = b.at(ns("./docidentifier[@type = 'DOI' or @type = 'ISSN' or "\
|
58
|
-
"@type = 'ISBN']"))
|
58
|
+
"@type = 'ISBN']"))
|
59
59
|
return [id, id1, id2] if id || id1 || id2
|
60
|
+
|
60
61
|
id = Nokogiri::XML::Node.new("docidentifier", b.document)
|
61
62
|
id << "(NO ID)"
|
62
63
|
[nil, id, nil]
|
63
64
|
end
|
64
65
|
|
65
|
-
def bracket_if_num(
|
66
|
-
return nil if
|
67
|
-
|
68
|
-
|
69
|
-
|
66
|
+
def bracket_if_num(num)
|
67
|
+
return nil if num.nil?
|
68
|
+
|
69
|
+
num = num.text.sub(/^\[/, "").sub(/\]$/, "")
|
70
|
+
return "[#{num}]" if /^\d+$/.match?(num)
|
71
|
+
|
72
|
+
num
|
70
73
|
end
|
71
74
|
|
72
75
|
def render_identifier(id)
|
73
76
|
[
|
74
77
|
bracket_if_num(id[0]),
|
75
|
-
id[1].nil?
|
76
|
-
|
77
|
-
|
78
|
-
|
78
|
+
if id[1].nil?
|
79
|
+
nil
|
80
|
+
else
|
81
|
+
docid_prefix(id[1]["type"], id[1].text.sub(/^\[/, "").sub(/\]$/, ""))
|
82
|
+
end,
|
83
|
+
if id[2].nil?
|
84
|
+
nil
|
85
|
+
else
|
86
|
+
docid_prefix(id[2]["type"], id[2].text.sub(/^\[/, "").sub(/\]$/, ""))
|
87
|
+
end,
|
79
88
|
]
|
80
89
|
end
|
81
90
|
|
@@ -87,12 +96,14 @@ module IsoDoc::Function
|
|
87
96
|
|
88
97
|
def omit_docid_prefix(prefix)
|
89
98
|
return true if prefix.nil? || prefix.empty?
|
90
|
-
|
99
|
+
|
100
|
+
%w(ISO IEC IEV ITU W3C csd metanorma rfc-anchor).include? prefix
|
91
101
|
end
|
92
102
|
|
93
103
|
def date_note_process(b, ref)
|
94
104
|
date_note = b.at(ns("./note[@type = 'Unpublished-Status']"))
|
95
105
|
return if date_note.nil?
|
106
|
+
|
96
107
|
date_note.children.first.replace("<p>#{date_note.content}</p>")
|
97
108
|
footnote_parse(date_note, ref)
|
98
109
|
end
|
@@ -101,18 +112,17 @@ module IsoDoc::Function
|
|
101
112
|
{ id: b["id"], class: biblio ? "Biblio" : "NormRef" }
|
102
113
|
end
|
103
114
|
|
104
|
-
def iso_title(
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
title
|
115
|
+
def iso_title(bib)
|
116
|
+
bib.at(ns("./title[@language = '#{@lang}' and @type = 'main']")) ||
|
117
|
+
bib.at(ns("./title[@language = '#{@lang}']")) ||
|
118
|
+
bib.at(ns("./title[@type = 'main']")) ||
|
119
|
+
bib.at(ns("./title"))
|
110
120
|
end
|
111
121
|
|
112
122
|
# reference not to be rendered because it is deemed implicit
|
113
123
|
# in the standards environment
|
114
|
-
def implicit_reference(
|
115
|
-
|
124
|
+
def implicit_reference(bib)
|
125
|
+
bib["hidden"] == "true"
|
116
126
|
end
|
117
127
|
|
118
128
|
def prefix_bracketed_ref(ref, text)
|
@@ -120,35 +130,38 @@ module IsoDoc::Function
|
|
120
130
|
insert_tab(ref, 1)
|
121
131
|
end
|
122
132
|
|
123
|
-
def reference_format(
|
124
|
-
if ftitle =
|
133
|
+
def reference_format(bib, r)
|
134
|
+
if ftitle = bib.at(ns("./formattedref"))
|
125
135
|
ftitle&.children&.each { |n| parse(n, r) }
|
126
136
|
else
|
127
|
-
title = iso_title(
|
137
|
+
title = iso_title(bib)
|
128
138
|
r.i do |i|
|
129
139
|
title&.children&.each { |n| parse(n, i) }
|
130
140
|
end
|
131
141
|
end
|
132
142
|
end
|
133
143
|
|
134
|
-
def is_standard(
|
144
|
+
def is_standard(bib)
|
135
145
|
ret = false
|
136
|
-
|
146
|
+
bib.xpath(ns("./docidentifier")).each do |id|
|
137
147
|
next if id["type"].nil? ||
|
138
148
|
%w(metanorma DOI ISSN ISBN).include?(id["type"])
|
149
|
+
|
139
150
|
ret = true
|
140
151
|
end
|
141
152
|
ret
|
142
153
|
end
|
143
154
|
|
144
|
-
def biblio_list(
|
155
|
+
def biblio_list(refs, div, biblio)
|
145
156
|
i = 0
|
146
|
-
|
157
|
+
refs.children.each do |b|
|
147
158
|
if b.name == "bibitem"
|
148
159
|
next if implicit_reference(b)
|
160
|
+
|
149
161
|
i += 1
|
150
|
-
|
151
|
-
|
162
|
+
if is_standard(b) then std_bibitem_entry(div, b, i, biblio)
|
163
|
+
else nonstd_bibitem(div, b, i, biblio)
|
164
|
+
end
|
152
165
|
else
|
153
166
|
parse(b, div) unless %w(title).include? b.name
|
154
167
|
end
|
@@ -174,7 +187,7 @@ module IsoDoc::Function
|
|
174
187
|
num
|
175
188
|
end
|
176
189
|
|
177
|
-
def bibliography_xpath
|
190
|
+
def bibliography_xpath
|
178
191
|
"//bibliography/clause[.//references]"\
|
179
192
|
"[not(.//references[@normative = 'true'])] | "\
|
180
193
|
"//bibliography/references[@normative = 'false']"
|
@@ -184,7 +197,7 @@ module IsoDoc::Function
|
|
184
197
|
f = isoxml.at(ns(bibliography_xpath)) and f["hidden"] != "true" or return
|
185
198
|
page_break(out)
|
186
199
|
out.div do |div|
|
187
|
-
div.h1 **{class: "Section3"} do |h1|
|
200
|
+
div.h1 **{ class: "Section3" } do |h1|
|
188
201
|
f&.at(ns("./title"))&.children&.each { |c2| parse(c2, h1) }
|
189
202
|
end
|
190
203
|
biblio_list(f, div, true)
|
@@ -193,7 +206,6 @@ module IsoDoc::Function
|
|
193
206
|
|
194
207
|
def bibliography_parse(node, out)
|
195
208
|
node["hidden"] != true or return
|
196
|
-
title = node&.at(ns("./title"))&.text || ""
|
197
209
|
out.div do |div|
|
198
210
|
clause_parse_title(node, div, node.at(ns("./title")), out,
|
199
211
|
{ class: "Section3" })
|
@@ -201,11 +213,12 @@ module IsoDoc::Function
|
|
201
213
|
end
|
202
214
|
end
|
203
215
|
|
204
|
-
def format_ref(ref, prefix,
|
216
|
+
def format_ref(ref, prefix, _isopub, _date, _allparts)
|
205
217
|
ref = docid_prefix(prefix, ref)
|
206
218
|
return "[#{ref}]" if ref && /^\d+$/.match(ref) && !prefix &&
|
207
219
|
!/^\[.*\]$/.match(ref)
|
208
|
-
|
220
|
+
|
221
|
+
ref
|
209
222
|
end
|
210
223
|
end
|
211
224
|
end
|
@@ -8,11 +8,11 @@ module IsoDoc::Function
|
|
8
8
|
insert_tab(out, 1)
|
9
9
|
end
|
10
10
|
|
11
|
-
def inline_header_title(out,
|
11
|
+
def inline_header_title(out, _node, title)
|
12
12
|
out.span **{ class: "zzMoveToFollowing" } do |s|
|
13
13
|
s.b do |b|
|
14
14
|
title&.children&.each { |c2| parse(c2, b) }
|
15
|
-
clausedelimspace(out) if /\S/.match(title&.text)
|
15
|
+
clausedelimspace(out) if /\S/.match?(title&.text)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -20,12 +20,14 @@ module IsoDoc::Function
|
|
20
20
|
# used for subclauses
|
21
21
|
def clause_parse_title(node, div, title, out, header_class = {})
|
22
22
|
return if title.nil?
|
23
|
+
|
23
24
|
if node["inline-header"] == "true"
|
24
25
|
inline_header_title(out, node, title)
|
25
26
|
else
|
26
|
-
depth =
|
27
|
-
|
28
|
-
|
27
|
+
depth = if title && title["depth"] then title["depth"]
|
28
|
+
else node.ancestors("clause, annex, terms, references, definitions, "\
|
29
|
+
"acknowledgements, introduction, foreword").size + 1
|
30
|
+
end
|
29
31
|
div.send "h#{depth}", **attr_code(header_class) do |h|
|
30
32
|
title&.children&.each { |c2| parse(c2, h) }
|
31
33
|
end
|
@@ -49,8 +51,11 @@ module IsoDoc::Function
|
|
49
51
|
def clause_name(_num, title, div, header_class)
|
50
52
|
header_class = {} if header_class.nil?
|
51
53
|
div.h1 **attr_code(header_class) do |h1|
|
52
|
-
title.is_a?(String)
|
54
|
+
if title.is_a?(String)
|
55
|
+
h1 << title
|
56
|
+
else
|
53
57
|
title&.children&.each { |c2| parse(c2, h1) }
|
58
|
+
end
|
54
59
|
end
|
55
60
|
div.parent.at(".//h1")
|
56
61
|
end
|
@@ -66,8 +71,9 @@ module IsoDoc::Function
|
|
66
71
|
end
|
67
72
|
end
|
68
73
|
|
69
|
-
def annex_name(
|
74
|
+
def annex_name(_annex, name, div)
|
70
75
|
return if name.nil?
|
76
|
+
|
71
77
|
div.h1 **{ class: "Annex" } do |t|
|
72
78
|
name.children.each { |c2| parse(c2, t) }
|
73
79
|
end
|
@@ -144,7 +150,6 @@ module IsoDoc::Function
|
|
144
150
|
|
145
151
|
def introduction(isoxml, out)
|
146
152
|
f = isoxml.at(ns("//introduction")) || return
|
147
|
-
title_attr = { class: "IntroTitle" }
|
148
153
|
page_break(out)
|
149
154
|
out.div **{ class: "Section3", id: f["id"] } do |div|
|
150
155
|
clause_name(nil, f.at(ns("./title")), div, { class: "IntroTitle" })
|
@@ -160,7 +165,7 @@ module IsoDoc::Function
|
|
160
165
|
out.div **attr_code(id: f["id"]) do |s|
|
161
166
|
clause_name(nil, f.at(ns("./title")) || @i18n.foreword, s,
|
162
167
|
{ class: "ForewordTitle" })
|
163
|
-
#s.h1(**{ class: "ForewordTitle" }) { |h1| h1 << @i18n.foreword }
|
168
|
+
# s.h1(**{ class: "ForewordTitle" }) { |h1| h1 << @i18n.foreword }
|
164
169
|
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
165
170
|
end
|
166
171
|
end
|
@@ -187,12 +192,11 @@ module IsoDoc::Function
|
|
187
192
|
end
|
188
193
|
|
189
194
|
def preface(isoxml, out)
|
190
|
-
title_attr = { class: "IntroTitle" }
|
191
195
|
isoxml.xpath(ns("//preface/clause | //preface/references | "\
|
192
196
|
"//preface/definitions | //preface/terms")).each do |f|
|
193
197
|
page_break(out)
|
194
198
|
out.div **{ class: "Section3", id: f["id"] } do |div|
|
195
|
-
clause_name(nil, f&.at(ns("./title")), div,
|
199
|
+
clause_name(nil, f&.at(ns("./title")), div, { class: "IntroTitle" })
|
196
200
|
f.elements.each do |e|
|
197
201
|
parse(e, div) unless e.name == "title"
|
198
202
|
end
|
@@ -202,37 +206,46 @@ module IsoDoc::Function
|
|
202
206
|
|
203
207
|
def is_clause?(name)
|
204
208
|
%w(clause references definitions terms foreword introduction abstract
|
205
|
-
|
209
|
+
acknowledgements).include? name
|
206
210
|
end
|
207
211
|
|
208
212
|
def preface_block(isoxml, out)
|
209
213
|
p = isoxml.at(ns("//preface")) or return
|
210
214
|
p.elements.each do |e|
|
211
215
|
next if is_clause?(e.name)
|
216
|
+
|
212
217
|
parse(e, out)
|
213
218
|
end
|
214
219
|
end
|
215
220
|
|
216
221
|
def copyright_parse(node, out)
|
217
|
-
|
222
|
+
return if @bare
|
223
|
+
|
224
|
+
out.div **{ class: "boilerplate-copyright" } do |div|
|
218
225
|
node.children.each { |n| parse(n, div) }
|
219
226
|
end
|
220
227
|
end
|
221
228
|
|
222
229
|
def license_parse(node, out)
|
223
|
-
|
230
|
+
return if @bare
|
231
|
+
|
232
|
+
out.div **{ class: "boilerplate-license" } do |div|
|
224
233
|
node.children.each { |n| parse(n, div) }
|
225
234
|
end
|
226
235
|
end
|
227
236
|
|
228
237
|
def legal_parse(node, out)
|
229
|
-
|
238
|
+
return if @bare
|
239
|
+
|
240
|
+
out.div **{ class: "boilerplate-legal" } do |div|
|
230
241
|
node.children.each { |n| parse(n, div) }
|
231
242
|
end
|
232
243
|
end
|
233
244
|
|
234
245
|
def feedback_parse(node, out)
|
235
|
-
|
246
|
+
return if @bare
|
247
|
+
|
248
|
+
out.div **{ class: "boilerplate-feedback" } do |div|
|
236
249
|
node.children.each { |n| parse(n, div) }
|
237
250
|
end
|
238
251
|
end
|