isodoc 1.0.27 → 1.1.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/.github/workflows/macos.yml +4 -8
- data/.github/workflows/ubuntu.yml +18 -16
- data/.github/workflows/windows.yml +4 -8
- data/Rakefile +3 -1
- data/isodoc.gemspec +2 -2
- data/lib/isodoc.rb +2 -0
- data/lib/isodoc/base_style/metanorma_word.scss +0 -1
- data/lib/isodoc/base_style/reset.scss +3 -3
- data/lib/isodoc/common.rb +0 -4
- data/lib/isodoc/convert.rb +121 -58
- data/lib/isodoc/function/blocks.rb +42 -53
- data/lib/isodoc/function/blocks_example_note.rb +108 -0
- data/lib/isodoc/function/cleanup.rb +8 -4
- data/lib/isodoc/function/i18n.rb +1 -0
- data/lib/isodoc/function/inline.rb +70 -90
- data/lib/isodoc/function/inline_simple.rb +72 -0
- data/lib/isodoc/function/lists.rb +12 -6
- data/lib/isodoc/function/references.rb +33 -38
- data/lib/isodoc/function/reqt.rb +14 -5
- data/lib/isodoc/function/section.rb +8 -11
- data/lib/isodoc/function/table.rb +4 -4
- data/lib/isodoc/function/terms.rb +3 -3
- data/lib/isodoc/function/to_word_html.rb +21 -13
- data/lib/isodoc/function/utils.rb +57 -50
- data/lib/isodoc/gem_tasks.rb +104 -0
- 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 +13 -1
- data/lib/isodoc/html_function/postprocess.rb +4 -4
- data/lib/isodoc/metadata.rb +74 -62
- data/lib/isodoc/pdf_convert.rb +8 -6
- data/lib/isodoc/presentation_xml_convert.rb +29 -0
- data/lib/isodoc/sassc_importer.rb +11 -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/{html.css → html.scss} +0 -0
- 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 +219 -47
- data/spec/isodoc/cleanup_spec.rb +135 -6
- data/spec/isodoc/footnotes_spec.rb +22 -7
- data/spec/isodoc/inline_spec.rb +262 -2
- data/spec/isodoc/lists_spec.rb +8 -8
- data/spec/isodoc/metadata_spec.rb +110 -3
- data/spec/isodoc/postproc_spec.rb +1321 -1351
- 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 +6 -6
- data/spec/isodoc/terms_spec.rb +7 -7
- data/spec/isodoc/xref_spec.rb +165 -45
- metadata +36 -27
- data/lib/isodoc/function/blocks_example.rb +0 -53
- data/lib/isodoc/function/xref_counter.rb +0 -50
@@ -0,0 +1,72 @@
|
|
1
|
+
module IsoDoc::Function
|
2
|
+
module Inline
|
3
|
+
def section_break(body)
|
4
|
+
body.br
|
5
|
+
end
|
6
|
+
|
7
|
+
def page_break(out)
|
8
|
+
out.br
|
9
|
+
end
|
10
|
+
|
11
|
+
def pagebreak_parse(_node, out)
|
12
|
+
out.br
|
13
|
+
end
|
14
|
+
|
15
|
+
def hr_parse(node, out)
|
16
|
+
out.hr
|
17
|
+
end
|
18
|
+
|
19
|
+
def br_parse(node, out)
|
20
|
+
out.br
|
21
|
+
end
|
22
|
+
|
23
|
+
def index_parse(node, out)
|
24
|
+
end
|
25
|
+
|
26
|
+
def bookmark_parse(node, out)
|
27
|
+
out.a **attr_code(id: node["id"])
|
28
|
+
end
|
29
|
+
|
30
|
+
def keyword_parse(node, out)
|
31
|
+
out.span **{ class: "keyword" } do |s|
|
32
|
+
node.children.each { |n| parse(n, s) }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def em_parse(node, out)
|
37
|
+
out.i do |e|
|
38
|
+
node.children.each { |n| parse(n, e) }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def strong_parse(node, out)
|
43
|
+
out.b do |e|
|
44
|
+
node.children.each { |n| parse(n, e) }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def sup_parse(node, out)
|
49
|
+
out.sup do |e|
|
50
|
+
node.children.each { |n| parse(n, e) }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def sub_parse(node, out)
|
55
|
+
out.sub do |e|
|
56
|
+
node.children.each { |n| parse(n, e) }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def tt_parse(node, out)
|
61
|
+
out.tt do |e|
|
62
|
+
node.children.each { |n| parse(n, e) }
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def strike_parse(node, out)
|
67
|
+
out.s do |e|
|
68
|
+
node.children.each { |n| parse(n, e) }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -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,7 +5,8 @@ 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
|
@@ -15,22 +16,24 @@ module IsoDoc::Function
|
|
15
16
|
identifiers = render_identifier(ids)
|
16
17
|
if biblio then ref_entry_code(ref, ordinal, identifiers, ids)
|
17
18
|
else
|
18
|
-
ref << "#{identifiers[0] || identifiers[1]}
|
19
|
-
ref << "#{identifiers[1]}
|
19
|
+
ref << "#{identifiers[0] || identifiers[1]}"
|
20
|
+
ref << ", #{identifiers[1]}" if identifiers[0] && identifiers[1]
|
20
21
|
end
|
22
|
+
ref << ", " unless biblio && !identifiers[1]
|
21
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
|
@@ -39,9 +42,7 @@ module IsoDoc::Function
|
|
39
42
|
# else, use both ordinal, as prefix, and t
|
40
43
|
def ref_entry_code(r, ordinal, t, id)
|
41
44
|
prefix_bracketed_ref(r, t[0] || "[#{ordinal}]")
|
42
|
-
|
43
|
-
r << "#{t[1]}, "
|
44
|
-
end
|
45
|
+
t[1] and r << "#{t[1]}"
|
45
46
|
end
|
46
47
|
|
47
48
|
def pref_ref_code(b)
|
@@ -84,13 +85,12 @@ module IsoDoc::Function
|
|
84
85
|
|
85
86
|
def omit_docid_prefix(prefix)
|
86
87
|
return true if prefix.nil? || prefix.empty?
|
87
|
-
return %w(ISO IEC ITU metanorma).include? prefix
|
88
|
+
return %w(ISO IEC ITU W3C metanorma).include? prefix
|
88
89
|
end
|
89
90
|
|
90
91
|
def date_note_process(b, ref)
|
91
|
-
date_note = b.at(ns("./note[
|
92
|
+
date_note = b.at(ns("./note[@type = 'ISO DATE']"))
|
92
93
|
return if date_note.nil?
|
93
|
-
date_note.content = date_note.content.gsub(/ISO DATE: /, "")
|
94
94
|
date_note.children.first.replace("<p>#{date_note.content}</p>")
|
95
95
|
footnote_parse(date_note, ref)
|
96
96
|
end
|
@@ -129,12 +129,6 @@ module IsoDoc::Function
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
ISO_PUBLISHER_XPATH =
|
133
|
-
"./contributor[xmlns:role/@type = 'publisher']/"\
|
134
|
-
"organization[abbreviation = 'ISO' or xmlns:abbreviation = 'IEC' or "\
|
135
|
-
"xmlns:name = 'International Organization for Standardization' or "\
|
136
|
-
"xmlns:name = 'International Electrotechnical Commission']".freeze
|
137
|
-
|
138
132
|
def is_standard(b)
|
139
133
|
ret = false
|
140
134
|
b.xpath(ns("./docidentifier")).each do |id|
|
@@ -159,22 +153,33 @@ module IsoDoc::Function
|
|
159
153
|
end
|
160
154
|
end
|
161
155
|
|
156
|
+
def norm_ref_xpath
|
157
|
+
"//bibliography/references[@normative = 'true'] | "\
|
158
|
+
"//bibliography/clause[.//references[@normative = 'true']]"
|
159
|
+
end
|
160
|
+
|
162
161
|
def norm_ref(isoxml, out, num)
|
163
|
-
|
164
|
-
f = isoxml.at(ns(q)) or return num
|
162
|
+
f = isoxml.at(ns(norm_ref_xpath)) or return num
|
165
163
|
out.div do |div|
|
166
164
|
num = num + 1
|
167
165
|
clause_name(num, @normref_lbl, div, nil)
|
168
|
-
|
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
|
169
171
|
end
|
170
172
|
num
|
171
173
|
end
|
172
174
|
|
173
|
-
|
174
|
-
"//bibliography/references
|
175
|
+
def bibliography_xpath
|
176
|
+
"//bibliography/clause[.//references]"\
|
177
|
+
"[not(.//references[@normative = 'true'])] | "\
|
178
|
+
"//bibliography/references[@normative = 'false']"
|
179
|
+
end
|
175
180
|
|
176
181
|
def bibliography(isoxml, out)
|
177
|
-
f = isoxml.at(ns(
|
182
|
+
f = isoxml.at(ns(bibliography_xpath)) || return
|
178
183
|
page_break(out)
|
179
184
|
out.div do |div|
|
180
185
|
div.h1 @bibliography_lbl, **{ class: "Section3" }
|
@@ -185,7 +190,7 @@ module IsoDoc::Function
|
|
185
190
|
def bibliography_parse(node, out)
|
186
191
|
title = node&.at(ns("./title"))&.text || ""
|
187
192
|
out.div do |div|
|
188
|
-
anchor(node['id'], :label, false) and
|
193
|
+
@xrefs.anchor(node['id'], :label, false) and
|
189
194
|
clause_parse_title(node, div, node.at(ns("./title")), out) or
|
190
195
|
div.h2 title, **{ class: "Section3" }
|
191
196
|
biblio_list(node, div, true)
|
@@ -199,16 +204,6 @@ module IsoDoc::Function
|
|
199
204
|
ref
|
200
205
|
end
|
201
206
|
|
202
|
-
def reference_names(ref)
|
203
|
-
isopub = ref.at(ns(ISO_PUBLISHER_XPATH))
|
204
|
-
ids = bibitem_ref_code(ref)
|
205
|
-
identifiers = render_identifier(ids)
|
206
|
-
date = ref.at(ns("./date[@type = 'published']"))
|
207
|
-
allparts = ref.at(ns("./extent[@type='part'][referenceFrom='all']"))
|
208
|
-
reference = docid_l10n(identifiers[0] || identifiers[1])
|
209
|
-
@anchors[ref["id"]] = { xref: reference }
|
210
|
-
end
|
211
|
-
|
212
207
|
# def ref_names(ref)
|
213
208
|
# linkend = ref.text
|
214
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)
|
@@ -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?
|