isodoc 1.0.26 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +12 -8
- data/.github/workflows/ubuntu.yml +26 -16
- data/.github/workflows/windows.yml +12 -8
- data/isodoc.gemspec +2 -2
- data/lib/isodoc.rb +2 -0
- data/lib/isodoc/common.rb +0 -4
- data/lib/isodoc/convert.rb +18 -8
- data/lib/isodoc/function/blocks.rb +43 -54
- data/lib/isodoc/function/blocks_example_note.rb +108 -0
- data/lib/isodoc/function/cleanup.rb +14 -2
- data/lib/isodoc/function/i18n.rb +1 -0
- data/lib/isodoc/function/inline.rb +76 -82
- data/lib/isodoc/function/inline_simple.rb +72 -0
- data/lib/isodoc/function/lists.rb +12 -6
- data/lib/isodoc/function/references.rb +65 -57
- data/lib/isodoc/function/reqt.rb +14 -5
- data/lib/isodoc/function/section.rb +8 -11
- data/lib/isodoc/function/table.rb +4 -5
- data/lib/isodoc/function/terms.rb +3 -3
- data/lib/isodoc/function/to_word_html.rb +22 -13
- data/lib/isodoc/function/utils.rb +9 -3
- data/lib/isodoc/headlesshtml_convert.rb +7 -6
- data/lib/isodoc/html_convert.rb +2 -1
- data/lib/isodoc/html_function/footnotes.rb +1 -1
- data/lib/isodoc/html_function/html.rb +16 -1
- data/lib/isodoc/html_function/postprocess.rb +6 -5
- data/lib/isodoc/metadata.rb +6 -0
- data/lib/isodoc/pdf_convert.rb +8 -6
- data/lib/isodoc/presentation_xml_convert.rb +29 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_convert.rb +2 -1
- data/lib/isodoc/word_function/body.rb +14 -48
- data/lib/isodoc/word_function/footnotes.rb +1 -1
- data/lib/isodoc/word_function/inline.rb +75 -0
- data/lib/isodoc/word_function/postprocess.rb +1 -0
- data/lib/isodoc/word_function/table.rb +3 -3
- data/lib/isodoc/xref.rb +59 -0
- data/lib/isodoc/{function → xref}/xref_anchor.rb +10 -21
- data/lib/isodoc/xref/xref_counter.rb +74 -0
- data/lib/isodoc/{function → xref}/xref_gen.rb +9 -22
- data/lib/isodoc/{function → xref}/xref_gen_seq.rb +41 -32
- data/lib/isodoc/{function → xref}/xref_sect_gen.rb +33 -23
- data/lib/isodoc/xslfo_convert.rb +16 -4
- data/spec/assets/i18n.yaml +4 -1
- data/spec/assets/odf.emf +0 -0
- data/spec/assets/odf.svg +4 -0
- data/spec/assets/odf1.svg +4 -0
- data/spec/isodoc/blocks_spec.rb +240 -59
- data/spec/isodoc/cleanup_spec.rb +139 -17
- data/spec/isodoc/footnotes_spec.rb +20 -5
- data/spec/isodoc/inline_spec.rb +296 -1
- data/spec/isodoc/lists_spec.rb +8 -8
- data/spec/isodoc/metadata_spec.rb +110 -3
- data/spec/isodoc/postproc_spec.rb +10 -14
- data/spec/isodoc/presentation_xml_spec.rb +20 -0
- data/spec/isodoc/ref_spec.rb +119 -50
- data/spec/isodoc/section_spec.rb +84 -18
- data/spec/isodoc/table_spec.rb +28 -28
- data/spec/isodoc/terms_spec.rb +7 -7
- data/spec/isodoc/xref_spec.rb +177 -57
- metadata +24 -17
- data/lib/isodoc/function/blocks_example.rb +0 -53
- data/lib/isodoc/function/xref_counter.rb +0 -50
@@ -1,8 +1,11 @@
|
|
1
1
|
module IsoDoc::Function
|
2
2
|
module Lists
|
3
|
+
def ul_attrs(node)
|
4
|
+
{ id: node["id"], style: keep_style(node) }
|
5
|
+
end
|
3
6
|
|
4
7
|
def ul_parse(node, out)
|
5
|
-
out.ul **attr_code(
|
8
|
+
out.ul **attr_code(ul_attrs(node)) do |ul|
|
6
9
|
node.children.each { |n| parse(n, ul) }
|
7
10
|
end
|
8
11
|
end
|
@@ -34,9 +37,12 @@ module IsoDoc::Function
|
|
34
37
|
ol_style(type)
|
35
38
|
end
|
36
39
|
|
40
|
+
def ol_attrs(node)
|
41
|
+
{ type: ol_depth(node), id: node["id"], style: keep_style(node) }
|
42
|
+
end
|
43
|
+
|
37
44
|
def ol_parse(node, out)
|
38
|
-
|
39
|
-
out.ol **attr_code(type: style, id: node["id"] ) do |ol|
|
45
|
+
out.ol **attr_code(ol_attrs(node)) do |ol|
|
40
46
|
node.children.each { |n| parse(n, ol) }
|
41
47
|
end
|
42
48
|
end
|
@@ -67,12 +73,12 @@ module IsoDoc::Function
|
|
67
73
|
%w{dt dd}.include? n.name
|
68
74
|
end
|
69
75
|
|
70
|
-
def
|
71
|
-
attr_code(id: node["id"])
|
76
|
+
def dl_attrs(node)
|
77
|
+
attr_code(id: node["id"], style: keep_style(node))
|
72
78
|
end
|
73
79
|
|
74
80
|
def dl_parse(node, out)
|
75
|
-
out.dl **
|
81
|
+
out.dl **dl_attrs(node) do |v|
|
76
82
|
node.elements.select { |n| dt_dd? n }.each_slice(2) do |dt, dd|
|
77
83
|
v.dt **attr_code(id: dt["id"]) do |term|
|
78
84
|
dt_parse(dt, term)
|
@@ -5,32 +5,35 @@ module IsoDoc::Function
|
|
5
5
|
# references anyway; keeping here instead of in IsoDoc::Iso for now
|
6
6
|
def docid_l10n(x)
|
7
7
|
return x if x.nil?
|
8
|
-
x.gsub(/All Parts/i, @all_parts_lbl.downcase)
|
8
|
+
x.gsub(/All Parts/i, @all_parts_lbl.downcase) if @all_parts_lbl
|
9
|
+
x
|
9
10
|
end
|
10
11
|
|
11
12
|
# TODO generate formatted ref if not present
|
12
|
-
def nonstd_bibitem(list, b, ordinal,
|
13
|
-
list.p **attr_code(iso_bibitem_entry_attrs(b,
|
14
|
-
|
15
|
-
|
16
|
-
if
|
13
|
+
def nonstd_bibitem(list, b, ordinal, biblio)
|
14
|
+
list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
|
15
|
+
ids = bibitem_ref_code(b)
|
16
|
+
identifiers = render_identifier(ids)
|
17
|
+
if biblio then ref_entry_code(ref, ordinal, identifiers, ids)
|
17
18
|
else
|
18
|
-
|
19
|
-
|
19
|
+
ref << "#{identifiers[0] || identifiers[1]}"
|
20
|
+
ref << ", #{identifiers[1]}" if identifiers[0] && identifiers[1]
|
20
21
|
end
|
21
|
-
|
22
|
+
ref << ", " unless biblio && !identifiers[1]
|
23
|
+
reference_format(b, ref)
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
27
|
def std_bibitem_entry(list, b, ordinal, biblio)
|
26
28
|
list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
identifiers = render_identifier(bibitem_ref_code(b))
|
30
|
+
if biblio then ref_entry_code(ref, ordinal, identifiers, nil)
|
31
|
+
else
|
32
|
+
ref << "#{identifiers[0] || identifiers[1]}"
|
33
|
+
ref << ", #{identifiers[1]}" if identifiers[0] && identifiers[1]
|
34
|
+
end
|
32
35
|
date_note_process(b, ref)
|
33
|
-
ref << ", "
|
36
|
+
ref << ", " unless biblio && !identifiers[1]
|
34
37
|
reference_format(b, ref)
|
35
38
|
end
|
36
39
|
end
|
@@ -38,29 +41,41 @@ module IsoDoc::Function
|
|
38
41
|
# if t is just a number, only use that ([1] Non-Standard)
|
39
42
|
# else, use both ordinal, as prefix, and t
|
40
43
|
def ref_entry_code(r, ordinal, t, id)
|
41
|
-
|
42
|
-
|
43
|
-
else
|
44
|
-
prefix_bracketed_ref(r, ordinal)
|
45
|
-
if !t.empty? && !%w(DOI ISSN ISBN).include?(id["type"])
|
46
|
-
r << "#{t}, "
|
47
|
-
end
|
48
|
-
end
|
44
|
+
prefix_bracketed_ref(r, t[0] || "[#{ordinal}]")
|
45
|
+
t[1] and r << "#{t[1]}"
|
49
46
|
end
|
50
47
|
|
48
|
+
def pref_ref_code(b)
|
49
|
+
b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
|
50
|
+
"or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"))
|
51
|
+
end
|
52
|
+
|
53
|
+
# returns [metanorma, non-metanorma, DOI/ISSN/ISBN] identifiers
|
51
54
|
def bibitem_ref_code(b)
|
52
55
|
id = b.at(ns("./docidentifier[@type = 'metanorma']"))
|
53
|
-
|
54
|
-
|
55
|
-
id
|
56
|
-
return id if id
|
56
|
+
id1 = pref_ref_code(b)
|
57
|
+
id2 = b.at(ns("./docidentifier[@type = 'DOI' or @type = 'ISSN' or @type = 'ISBN']"))
|
58
|
+
return [id, id1, id2] if id || id1 || id2
|
57
59
|
id = Nokogiri::XML::Node.new("docidentifier", b.document)
|
58
60
|
id << "(NO ID)"
|
59
|
-
id
|
61
|
+
[nil, id, nil]
|
62
|
+
end
|
63
|
+
|
64
|
+
def bracket_if_num(x)
|
65
|
+
return nil if x.nil?
|
66
|
+
x = x.text.sub(/^\[/, "").sub(/\]$/, "")
|
67
|
+
return "[#{x}]" if /^\d+$/.match(x)
|
68
|
+
x
|
60
69
|
end
|
61
70
|
|
62
71
|
def render_identifier(id)
|
63
|
-
|
72
|
+
[
|
73
|
+
bracket_if_num(id[0]),
|
74
|
+
id[1].nil? ? nil :
|
75
|
+
docid_prefix(id[1]["type"], id[1].text.sub(/^\[/, "").sub(/\]$/, "")),
|
76
|
+
id[2].nil? ? nil :
|
77
|
+
docid_prefix(id[2]["type"], id[2].text.sub(/^\[/, "").sub(/\]$/, "")),
|
78
|
+
]
|
64
79
|
end
|
65
80
|
|
66
81
|
def docid_prefix(prefix, docid)
|
@@ -70,13 +85,12 @@ module IsoDoc::Function
|
|
70
85
|
|
71
86
|
def omit_docid_prefix(prefix)
|
72
87
|
return true if prefix.nil? || prefix.empty?
|
73
|
-
return %w(ISO IEC ITU metanorma).include? prefix
|
88
|
+
return %w(ISO IEC ITU W3C metanorma).include? prefix
|
74
89
|
end
|
75
90
|
|
76
91
|
def date_note_process(b, ref)
|
77
|
-
date_note = b.at(ns("./note[
|
92
|
+
date_note = b.at(ns("./note[@type = 'ISO DATE']"))
|
78
93
|
return if date_note.nil?
|
79
|
-
date_note.content = date_note.content.gsub(/ISO DATE: /, "")
|
80
94
|
date_note.children.first.replace("<p>#{date_note.content}</p>")
|
81
95
|
footnote_parse(date_note, ref)
|
82
96
|
end
|
@@ -100,7 +114,7 @@ module IsoDoc::Function
|
|
100
114
|
end
|
101
115
|
|
102
116
|
def prefix_bracketed_ref(ref, text)
|
103
|
-
ref <<
|
117
|
+
ref << text.to_s
|
104
118
|
insert_tab(ref, 1)
|
105
119
|
end
|
106
120
|
|
@@ -115,12 +129,6 @@ module IsoDoc::Function
|
|
115
129
|
end
|
116
130
|
end
|
117
131
|
|
118
|
-
ISO_PUBLISHER_XPATH =
|
119
|
-
"./contributor[xmlns:role/@type = 'publisher']/"\
|
120
|
-
"organization[abbreviation = 'ISO' or xmlns:abbreviation = 'IEC' or "\
|
121
|
-
"xmlns:name = 'International Organization for Standardization' or "\
|
122
|
-
"xmlns:name = 'International Electrotechnical Commission']".freeze
|
123
|
-
|
124
132
|
def is_standard(b)
|
125
133
|
ret = false
|
126
134
|
b.xpath(ns("./docidentifier")).each do |id|
|
@@ -145,22 +153,33 @@ module IsoDoc::Function
|
|
145
153
|
end
|
146
154
|
end
|
147
155
|
|
156
|
+
def norm_ref_xpath
|
157
|
+
"//bibliography/references[@normative = 'true'] | "\
|
158
|
+
"//bibliography/clause[.//references[@normative = 'true']]"
|
159
|
+
end
|
160
|
+
|
148
161
|
def norm_ref(isoxml, out, num)
|
149
|
-
|
150
|
-
f = isoxml.at(ns(q)) or return num
|
162
|
+
f = isoxml.at(ns(norm_ref_xpath)) or return num
|
151
163
|
out.div do |div|
|
152
164
|
num = num + 1
|
153
165
|
clause_name(num, @normref_lbl, div, nil)
|
154
|
-
|
166
|
+
if f.name == "clause"
|
167
|
+
f.elements.each { |e| parse(e, div) unless e.name == "title" }
|
168
|
+
else
|
169
|
+
biblio_list(f, div, false)
|
170
|
+
end
|
155
171
|
end
|
156
172
|
num
|
157
173
|
end
|
158
174
|
|
159
|
-
|
160
|
-
"//bibliography/references
|
175
|
+
def bibliography_xpath
|
176
|
+
"//bibliography/clause[.//references]"\
|
177
|
+
"[not(.//references[@normative = 'true'])] | "\
|
178
|
+
"//bibliography/references[@normative = 'false']"
|
179
|
+
end
|
161
180
|
|
162
181
|
def bibliography(isoxml, out)
|
163
|
-
f = isoxml.at(ns(
|
182
|
+
f = isoxml.at(ns(bibliography_xpath)) || return
|
164
183
|
page_break(out)
|
165
184
|
out.div do |div|
|
166
185
|
div.h1 @bibliography_lbl, **{ class: "Section3" }
|
@@ -171,7 +190,7 @@ module IsoDoc::Function
|
|
171
190
|
def bibliography_parse(node, out)
|
172
191
|
title = node&.at(ns("./title"))&.text || ""
|
173
192
|
out.div do |div|
|
174
|
-
anchor(node['id'], :label, false) and
|
193
|
+
@xrefs.anchor(node['id'], :label, false) and
|
175
194
|
clause_parse_title(node, div, node.at(ns("./title")), out) or
|
176
195
|
div.h2 title, **{ class: "Section3" }
|
177
196
|
biblio_list(node, div, true)
|
@@ -185,17 +204,6 @@ module IsoDoc::Function
|
|
185
204
|
ref
|
186
205
|
end
|
187
206
|
|
188
|
-
def reference_names(ref)
|
189
|
-
isopub = ref.at(ns(ISO_PUBLISHER_XPATH))
|
190
|
-
docid = bibitem_ref_code(ref)
|
191
|
-
prefix = docid["type"]
|
192
|
-
date = ref.at(ns("./date[@type = 'published']"))
|
193
|
-
allparts = ref.at(ns("./extent[@type='part'][referenceFrom='all']"))
|
194
|
-
reference = format_ref(docid_l10n(docid.text), prefix, isopub, date,
|
195
|
-
allparts)
|
196
|
-
@anchors[ref["id"]] = { xref: reference }
|
197
|
-
end
|
198
|
-
|
199
207
|
# def ref_names(ref)
|
200
208
|
# linkend = ref.text
|
201
209
|
# linkend.gsub!(/[\[\]]/, "") unless /^\[\d+\]$/.match linkend
|
data/lib/isodoc/function/reqt.rb
CHANGED
@@ -2,7 +2,7 @@ module IsoDoc::Function
|
|
2
2
|
module Blocks
|
3
3
|
def recommendation_labels(node)
|
4
4
|
[node.at(ns("./label")), node.at(ns("./title")),
|
5
|
-
anchor(node['id'], :label, false)]
|
5
|
+
@xrefs.anchor(node['id'], :label, false)]
|
6
6
|
end
|
7
7
|
|
8
8
|
def recommendation_name(node, out, type)
|
@@ -60,8 +60,12 @@ module IsoDoc::Function
|
|
60
60
|
%w(label title subject classification tag value inherit).include? n.name
|
61
61
|
end
|
62
62
|
|
63
|
+
def reqt_attrs(node, klass)
|
64
|
+
attr_code(class: klass, id: node["id"], style: keep_style(node))
|
65
|
+
end
|
66
|
+
|
63
67
|
def recommendation_parse(node, out)
|
64
|
-
out.div **
|
68
|
+
out.div **reqt_attrs(node, "recommend") do |t|
|
65
69
|
recommendation_name(node, t, @recommendation_lbl)
|
66
70
|
recommendation_attributes(node, out)
|
67
71
|
node.children.each do |n|
|
@@ -71,7 +75,7 @@ module IsoDoc::Function
|
|
71
75
|
end
|
72
76
|
|
73
77
|
def requirement_parse(node, out)
|
74
|
-
out.div **
|
78
|
+
out.div **reqt_attrs(node, "require") do |t|
|
75
79
|
recommendation_name(node, t, @requirement_lbl)
|
76
80
|
recommendation_attributes(node, out)
|
77
81
|
node.children.each do |n|
|
@@ -81,7 +85,7 @@ module IsoDoc::Function
|
|
81
85
|
end
|
82
86
|
|
83
87
|
def permission_parse(node, out)
|
84
|
-
out.div **
|
88
|
+
out.div **reqt_attrs(node, "permission") do |t|
|
85
89
|
recommendation_name(node, t, @permission_lbl)
|
86
90
|
recommendation_attributes(node, out)
|
87
91
|
node.children.each do |n|
|
@@ -90,9 +94,14 @@ module IsoDoc::Function
|
|
90
94
|
end
|
91
95
|
end
|
92
96
|
|
97
|
+
def reqt_component_attrs(node)
|
98
|
+
attr_code(class: "requirement-" + node.name,
|
99
|
+
style: keep_style(node))
|
100
|
+
end
|
101
|
+
|
93
102
|
def requirement_component_parse(node, out)
|
94
103
|
return if node["exclude"] == "true"
|
95
|
-
out.div **
|
104
|
+
out.div **reqt_component_attrs(node) do |div|
|
96
105
|
node.children.each do |n|
|
97
106
|
parse(n, div)
|
98
107
|
end
|
@@ -11,11 +11,12 @@ module IsoDoc::Function
|
|
11
11
|
def inline_header_title(out, node, c1)
|
12
12
|
out.span **{ class: "zzMoveToFollowing" } do |s|
|
13
13
|
s.b do |b|
|
14
|
-
if anchor(node['id'], :label, false) && !@suppressheadingnumbers
|
15
|
-
b << "#{anchor(node['id'], :label)}#{clausedelim}"
|
14
|
+
if @xrefs.anchor(node['id'], :label, false) && !@suppressheadingnumbers
|
15
|
+
b << "#{@xrefs.anchor(node['id'], :label)}#{clausedelim}"
|
16
16
|
clausedelimspace(out)
|
17
17
|
end
|
18
18
|
c1&.children&.each { |c2| parse(c2, b) }
|
19
|
+
clausedelimspace(out) if /\S/.match(c1&.text)
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
@@ -25,8 +26,8 @@ module IsoDoc::Function
|
|
25
26
|
if node["inline-header"] == "true"
|
26
27
|
inline_header_title(out, node, c1)
|
27
28
|
else
|
28
|
-
div.send "h#{anchor(node['id'], :level, false) || '1'}" do |h|
|
29
|
-
lbl = anchor(node['id'], :label, false)
|
29
|
+
div.send "h#{@xrefs.anchor(node['id'], :level, false) || '1'}" do |h|
|
30
|
+
lbl = @xrefs.anchor(node['id'], :label, false)
|
30
31
|
h << "#{lbl}#{clausedelim}" if lbl && !@suppressheadingnumbers
|
31
32
|
clausedelimspace(out) if lbl && !@suppressheadingnumbers
|
32
33
|
c1&.children&.each { |c2| parse(c2, h) }
|
@@ -57,14 +58,10 @@ module IsoDoc::Function
|
|
57
58
|
div.parent.at(".//h1")
|
58
59
|
end
|
59
60
|
|
60
|
-
MIDDLE_CLAUSE =
|
61
|
-
"//clause[parent::sections][not(xmlns:title = 'Scope')]"\
|
62
|
-
"[not(descendant::terms)]".freeze
|
63
|
-
|
64
61
|
def clause(isoxml, out)
|
65
|
-
isoxml.xpath(ns(
|
62
|
+
isoxml.xpath(ns(middle_clause)).each do |c|
|
66
63
|
out.div **attr_code(id: c["id"]) do |s|
|
67
|
-
clause_name(anchor(c['id'], :label),
|
64
|
+
clause_name(@xrefs.anchor(c['id'], :label),
|
68
65
|
c&.at(ns("./title")), s, nil)
|
69
66
|
c.elements.reject { |c1| c1.name == "title" }.each do |c1|
|
70
67
|
parse(c1, s)
|
@@ -75,7 +72,7 @@ module IsoDoc::Function
|
|
75
72
|
|
76
73
|
def annex_name(annex, name, div)
|
77
74
|
div.h1 **{ class: "Annex" } do |t|
|
78
|
-
t << "#{anchor(annex['id'], :label)}<br/><br/>"
|
75
|
+
t << "#{@xrefs.anchor(annex['id'], :label)}<br/><br/>"
|
79
76
|
t.b do |b|
|
80
77
|
name&.children&.each { |c2| parse(c2, b) }
|
81
78
|
end
|
@@ -3,7 +3,7 @@ module IsoDoc::Function
|
|
3
3
|
|
4
4
|
def table_title_parse(node, out)
|
5
5
|
name = node.at(ns("./name"))
|
6
|
-
lbl = anchor(node['id'], :label, false)
|
6
|
+
lbl = @xrefs.anchor(node['id'], :label, false)
|
7
7
|
lbl = nil if labelled_ancestor(node)
|
8
8
|
return if name.nil? && lbl.nil?
|
9
9
|
out.p **{ class: "TableTitle", style: "text-align:center;" } do |p|
|
@@ -44,12 +44,12 @@ module IsoDoc::Function
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
def
|
47
|
+
def table_attrs(node)
|
48
48
|
width = node["width"] ? "width:#{node['width']};" : nil
|
49
49
|
attr_code(
|
50
50
|
id: node["id"],
|
51
51
|
class: "MsoISOTable",
|
52
|
-
style: "border-width:1px;border-spacing:0;#{width}",
|
52
|
+
style: "border-width:1px;border-spacing:0;#{width}#{keep_style(node)}",
|
53
53
|
title: node["alt"]
|
54
54
|
)
|
55
55
|
end
|
@@ -66,7 +66,7 @@ module IsoDoc::Function
|
|
66
66
|
def table_parse(node, out)
|
67
67
|
@in_table = true
|
68
68
|
table_title_parse(node, out)
|
69
|
-
out.table **
|
69
|
+
out.table **table_attrs(node) do |t|
|
70
70
|
tcaption(node, t)
|
71
71
|
thead_parse(node, t)
|
72
72
|
tbody_parse(node, t)
|
@@ -91,7 +91,6 @@ module IsoDoc::Function
|
|
91
91
|
style += <<~STYLE
|
92
92
|
border-top:#{row.zero? ? "#{SW} 1.5pt;" : 'none;'}
|
93
93
|
border-bottom:#{SW} #{rowmax == totalrows ? '1.5' : '1.0'}pt;
|
94
|
-
padding:0;
|
95
94
|
STYLE
|
96
95
|
header and scope = (td["colspan"] ? "colgroup" : "col")
|
97
96
|
!header and td.name == "th" and scope =
|
@@ -40,10 +40,10 @@ module IsoDoc::Function
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def termnote_parse(node, out)
|
43
|
-
out.div **
|
43
|
+
out.div **note_attrs(node) do |div|
|
44
44
|
first = node.first_element_child
|
45
45
|
div.p do |p|
|
46
|
-
p << "#{anchor(node['id'], :label) || '???'}: "
|
46
|
+
p << "#{@xrefs.anchor(node['id'], :label) || '???'}: "
|
47
47
|
para_then_remainder(first, node, p, div)
|
48
48
|
end
|
49
49
|
end
|
@@ -59,7 +59,7 @@ module IsoDoc::Function
|
|
59
59
|
|
60
60
|
def termdef_parse(node, out)
|
61
61
|
out.p **{ class: "TermNum", id: node["id"] } do |p|
|
62
|
-
p << "#{
|
62
|
+
p << "#{@xrefs.get[node["id"]][:label]}#{clausedelim}"
|
63
63
|
end
|
64
64
|
set_termdomain("")
|
65
65
|
node.children.each { |n| parse(n, out) }
|
@@ -18,7 +18,7 @@ module IsoDoc::Function
|
|
18
18
|
|
19
19
|
def init_file(filename, debug)
|
20
20
|
filepath = Pathname.new(filename)
|
21
|
-
filename = filepath.sub_ext('').to_s
|
21
|
+
filename = filepath.sub_ext('').sub(/\.presentation$/, "").to_s
|
22
22
|
dir = "#{filename}_files"
|
23
23
|
unless debug
|
24
24
|
Dir.mkdir(dir, 0777) unless File.exists?(dir)
|
@@ -45,7 +45,7 @@ module IsoDoc::Function
|
|
45
45
|
head.style do |style|
|
46
46
|
@standardstylesheet.open
|
47
47
|
stylesheet = @standardstylesheet.read.
|
48
|
-
gsub("FILENAME", File.basename(filename))
|
48
|
+
gsub("FILENAME", File.basename(filename).sub(/\.presentation$/, ""))
|
49
49
|
style.comment "\n#{stylesheet}\n"
|
50
50
|
end
|
51
51
|
end
|
@@ -79,7 +79,7 @@ module IsoDoc::Function
|
|
79
79
|
|
80
80
|
def make_body3(body, docxml)
|
81
81
|
body.div **{ class: "main-section" } do |div3|
|
82
|
-
|
82
|
+
boilerplate docxml, div3
|
83
83
|
abstract docxml, div3
|
84
84
|
foreword docxml, div3
|
85
85
|
introduction docxml, div3
|
@@ -102,6 +102,7 @@ module IsoDoc::Function
|
|
102
102
|
@meta.relations isoxml, out
|
103
103
|
@meta.version isoxml, out
|
104
104
|
@meta.url isoxml, out
|
105
|
+
@meta.keywords isoxml, out
|
105
106
|
@meta.get
|
106
107
|
end
|
107
108
|
|
@@ -109,8 +110,15 @@ module IsoDoc::Function
|
|
109
110
|
out.p(**{ class: "zzSTDTitle1" }) { |p| p << @meta.get[:doctitle] }
|
110
111
|
end
|
111
112
|
|
113
|
+
def middle_admonitions(isoxml, out)
|
114
|
+
isoxml.xpath(ns("//sections/note | //sections/admonition")).each do |x|
|
115
|
+
parse(x, out)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
112
119
|
def middle(isoxml, out)
|
113
120
|
middle_title(out)
|
121
|
+
middle_admonitions(isoxml, out)
|
114
122
|
i = scope isoxml, out, 0
|
115
123
|
i = norm_ref isoxml, out, i
|
116
124
|
i = terms_defs isoxml, out, i
|
@@ -120,20 +128,20 @@ module IsoDoc::Function
|
|
120
128
|
bibliography isoxml, out
|
121
129
|
end
|
122
130
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
end
|
131
|
-
else
|
132
|
-
parse(n, s)
|
131
|
+
def boilerplate(node, out)
|
132
|
+
boilerplate = node.at(ns("//boilerplate")) or return
|
133
|
+
out.div **{class: "authority"} do |s|
|
134
|
+
boilerplate.children.each do |n|
|
135
|
+
if n.name == "title"
|
136
|
+
s.h1 do |h|
|
137
|
+
n.children.each { |nn| parse(nn, h) }
|
133
138
|
end
|
139
|
+
else
|
140
|
+
parse(n, s)
|
134
141
|
end
|
135
142
|
end
|
136
143
|
end
|
144
|
+
end
|
137
145
|
|
138
146
|
def parse(node, out)
|
139
147
|
if node.text?
|
@@ -211,6 +219,7 @@ module IsoDoc::Function
|
|
211
219
|
when "legal-statement" then legal_parse(node, out)
|
212
220
|
when "feedback-statement" then feedback_parse(node, out)
|
213
221
|
when "passthrough" then passthrough_parse(node, out)
|
222
|
+
when "variant" then variant_parse(node, out)
|
214
223
|
else
|
215
224
|
error_parse(node, out)
|
216
225
|
end
|