metanorma-unece 0.0.14 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +12 -10
- data/appveyor.yml +7 -2
- data/lib/asciidoctor/unece/biblio.rng +44 -15
- data/lib/asciidoctor/unece/converter.rb +14 -8
- data/lib/asciidoctor/unece/isodoc.rng +128 -71
- data/lib/asciidoctor/unece/isostandard.rng +29 -304
- data/lib/asciidoctor/unece/reqt.rng +5 -0
- data/lib/asciidoctor/unece/unece.rng +11 -83
- data/lib/asciidoctor/unece/validate.rb +22 -0
- data/lib/isodoc/unece/base_convert.rb +215 -0
- data/lib/isodoc/unece/html/html_unece_plenary_titlepage.html +3 -3
- data/lib/isodoc/unece/html/html_unece_titlepage.html +3 -3
- data/lib/isodoc/unece/html_convert.rb +5 -206
- data/lib/isodoc/unece/metadata.rb +12 -17
- data/lib/isodoc/unece/word_convert.rb +87 -291
- data/lib/metanorma/unece/version.rb +1 -1
- data/metanorma-unece.gemspec +3 -3
- metadata +10 -22
@@ -0,0 +1,22 @@
|
|
1
|
+
module Asciidoctor
|
2
|
+
module Unece
|
3
|
+
class Converter < Standoc::Converter
|
4
|
+
def content_validate(doc)
|
5
|
+
super
|
6
|
+
bibdata_validate(doc.root)
|
7
|
+
end
|
8
|
+
|
9
|
+
def bibdata_validate(doc)
|
10
|
+
stage_validate(doc)
|
11
|
+
end
|
12
|
+
|
13
|
+
def stage_validate(xmldoc)
|
14
|
+
stage = xmldoc&.at("//bibdata/status/stage")&.text
|
15
|
+
%w(proposal working-draft committee-draft draft-standard final-draft
|
16
|
+
published withdrawn).include? stage or
|
17
|
+
warn "Document Attributes: #{stage} is not a recognised status"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,215 @@
|
|
1
|
+
require_relative "metadata"
|
2
|
+
require "fileutils"
|
3
|
+
require "roman-numerals"
|
4
|
+
|
5
|
+
module IsoDoc
|
6
|
+
module Unece
|
7
|
+
module BaseConvert
|
8
|
+
def metadata_init(lang, script, labels)
|
9
|
+
@meta = Metadata.new(lang, script, labels)
|
10
|
+
@meta.set(:toc, @toc)
|
11
|
+
end
|
12
|
+
|
13
|
+
def annex_name(annex, name, div)
|
14
|
+
div.h1 **{ class: "Annex" } do |t|
|
15
|
+
t << "#{anchor(annex['id'], :label)}"
|
16
|
+
t.br
|
17
|
+
t.b do |b|
|
18
|
+
name&.children&.each { |c2| parse(c2, b) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def i18n_init(lang, script)
|
24
|
+
super
|
25
|
+
@admonition_lbl = "Box"
|
26
|
+
@abstract_lbl = "Summary"
|
27
|
+
end
|
28
|
+
|
29
|
+
def fileloc(loc)
|
30
|
+
File.join(File.dirname(__FILE__), loc)
|
31
|
+
end
|
32
|
+
|
33
|
+
MIDDLE_CLAUSE = "//clause[parent::sections]".freeze
|
34
|
+
|
35
|
+
def initial_anchor_names(d)
|
36
|
+
preface_names(d.at(ns("//abstract")))
|
37
|
+
preface_names(d.at(ns("//foreword")))
|
38
|
+
preface_names(d.at(ns("//introduction")))
|
39
|
+
sequential_asset_names(d.xpath(ns("//foreword | //introduction")))
|
40
|
+
middle_section_asset_names(d)
|
41
|
+
clause_names(d, 0)
|
42
|
+
termnote_anchor_names(d)
|
43
|
+
termexample_anchor_names(d)
|
44
|
+
end
|
45
|
+
|
46
|
+
def clause_names(docxml, sect_num)
|
47
|
+
q = "//clause[parent::sections]"
|
48
|
+
@paranumber = 0
|
49
|
+
docxml.xpath(ns(q)).each_with_index do |c, i|
|
50
|
+
section_names(c, (i + sect_num), 1)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def levelnumber(num, lvl)
|
55
|
+
case lvl % 3
|
56
|
+
when 1 then RomanNumerals.to_roman(num)
|
57
|
+
when 2 then ("A".ord + num - 1).chr
|
58
|
+
when 0 then num.to_s
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def annex_levelnumber(num, lvl)
|
63
|
+
case lvl % 3
|
64
|
+
when 0 then RomanNumerals.to_roman(num)
|
65
|
+
when 1 then ("A".ord + num - 1).chr
|
66
|
+
when 2 then num.to_s
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def leaf_section(clause, lvl)
|
71
|
+
@paranumber += 1
|
72
|
+
@anchors[clause["id"]] = {label: @paranumber.to_s, xref: "paragraph #{@paranumber}", level: lvl, type: "paragraph" }
|
73
|
+
end
|
74
|
+
|
75
|
+
def annex_leaf_section(clause, num, lvl)
|
76
|
+
@paranumber += 1
|
77
|
+
@anchors[clause["id"]] = {label: @paranumber.to_s, xref: "paragraph #{num}.#{@paranumber}", level: lvl, type: "paragraph" }
|
78
|
+
end
|
79
|
+
|
80
|
+
def section_names(clause, num, lvl)
|
81
|
+
return num if clause.nil?
|
82
|
+
clause.at(ns("./clause | ./term | ./terms | ./definitions")) or
|
83
|
+
leaf_section(clause, lvl) && return
|
84
|
+
num = num + 1
|
85
|
+
lbl = levelnumber(num, 1)
|
86
|
+
@anchors[clause["id"]] =
|
87
|
+
{ label: lbl, xref: l10n("#{@clause_lbl} #{lbl}"), level: lvl, type: "clause" }
|
88
|
+
i = 1
|
89
|
+
clause.xpath(ns("./clause | ./term | ./terms | ./definitions")).each do |c|
|
90
|
+
section_names1(c, "#{lbl}.#{levelnumber(i, lvl + 1)}", lvl + 1)
|
91
|
+
i += 1 if c.at(ns("./clause | ./term | ./terms | ./definitions"))
|
92
|
+
end
|
93
|
+
num
|
94
|
+
end
|
95
|
+
|
96
|
+
def section_names1(clause, num, level)
|
97
|
+
unless clause.at(ns("./clause | ./term | ./terms | ./definitions"))
|
98
|
+
leaf_section(clause, level) and return
|
99
|
+
end
|
100
|
+
/\.(?<leafnum>[^.]+$)/ =~ num
|
101
|
+
@anchors[clause["id"]] =
|
102
|
+
{ label: leafnum, level: level, xref: l10n("#{@clause_lbl} #{num}"), type: "clause" }
|
103
|
+
i = 1
|
104
|
+
clause.xpath(ns("./clause | ./terms | ./term | ./definitions")).each do |c|
|
105
|
+
section_names1(c, "#{num}.#{levelnumber(i, level + 1)}", level + 1)
|
106
|
+
i += 1 if c.at(ns("./clause | ./term | ./terms | ./definitions"))
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def annex_name_lbl(clause, num)
|
111
|
+
l10n("<b>#{@annex_lbl} #{num}</b>")
|
112
|
+
end
|
113
|
+
|
114
|
+
def annex_names(clause, num)
|
115
|
+
hierarchical_asset_names(clause, num)
|
116
|
+
unless clause.at(ns("./clause | ./term | ./terms | ./definitions"))
|
117
|
+
annex_leaf_section(clause, num, 1) and return
|
118
|
+
end
|
119
|
+
@anchors[clause["id"]] = { label: annex_name_lbl(clause, num), type: "clause",
|
120
|
+
xref: "#{@annex_lbl} #{num}", level: 1 }
|
121
|
+
i = 1
|
122
|
+
clause.xpath(ns("./clause")).each do |c|
|
123
|
+
annex_names1(c, "#{num}.#{annex_levelnumber(i, 2)}", 2)
|
124
|
+
i += 1 if c.at(ns("./clause | ./term | ./terms | ./definitions"))
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def annex_names1(clause, num, level)
|
129
|
+
unless clause.at(ns("./clause | ./term | ./terms | ./definitions"))
|
130
|
+
annex_leaf_section(clause, num, level) and return
|
131
|
+
end
|
132
|
+
/\.(?<leafnum>[^.]+$)/ =~ num
|
133
|
+
@anchors[clause["id"]] = { label: leafnum, xref: "#{@annex_lbl} #{num}",
|
134
|
+
level: level, type: "clause" }
|
135
|
+
i = 1
|
136
|
+
clause.xpath(ns("./clause")).each do |c|
|
137
|
+
annex_names1(c, "#{num}.#{annex_levelnumber(i, level + 1)}", level + 1)
|
138
|
+
i += 1 if c.at(ns("./clause | ./term | ./terms | ./definitions"))
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def back_anchor_names(docxml)
|
143
|
+
docxml.xpath(ns("//annex")).each_with_index do |c, i|
|
144
|
+
@paranumber = 0
|
145
|
+
annex_names(c, RomanNumerals.to_roman(i + 1))
|
146
|
+
end
|
147
|
+
docxml.xpath(ns("//bibliography/clause |"\
|
148
|
+
"//bibliography/references")).each do |b|
|
149
|
+
preface_names(b)
|
150
|
+
end
|
151
|
+
docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
|
152
|
+
reference_names(ref)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def sequential_admonition_names(clause)
|
157
|
+
i = 0
|
158
|
+
clause.xpath(ns(".//admonition")).each do |t|
|
159
|
+
i += 1 unless t["unnumbered"]
|
160
|
+
next if t["id"].nil? || t["id"].empty?
|
161
|
+
@anchors[t["id"]] = anchor_struct(i.to_s, nil, @admonition_lbl, "box", t["unnumbered"])
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def hierarchical_admonition_names(clause, num)
|
166
|
+
i = 0
|
167
|
+
clause.xpath(ns(".//admonition")).each do |t|
|
168
|
+
i += 1 unless t["unnumbered"]
|
169
|
+
next if t["id"].nil? || t["id"].empty?
|
170
|
+
@anchors[t["id"]] = anchor_struct("#{num}.#{i}", nil, @admonition_lbl, "box", t["unnumbered"])
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def sequential_asset_names(clause)
|
175
|
+
super
|
176
|
+
sequential_admonition_names(clause)
|
177
|
+
end
|
178
|
+
|
179
|
+
def hierarchical_asset_names(clause, num)
|
180
|
+
super
|
181
|
+
hierarchical_admonition_names(clause, num)
|
182
|
+
end
|
183
|
+
|
184
|
+
def admonition_name_parse(node, div, name)
|
185
|
+
div.p **{ class: "FigureTitle", align: "center" } do |p|
|
186
|
+
lbl = anchor(node['id'], :label)
|
187
|
+
lbl.nil? or p << l10n("#{@admonition_lbl} #{lbl}")
|
188
|
+
name and !lbl.nil? and p << " — "
|
189
|
+
name and name.children.each { |n| parse(n, div) }
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def admonition_parse(node, out)
|
194
|
+
name = node.at(ns("./name"))
|
195
|
+
out.div **{ class: "Admonition" } do |t|
|
196
|
+
admonition_name_parse(node, t, name) if name
|
197
|
+
node.children.each do |n|
|
198
|
+
parse(n, t) unless n.name == "name"
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
def inline_header_title(out, node, c1)
|
204
|
+
title = c1&.content || ""
|
205
|
+
out.span **{ class: "zzMoveToFollowing" } do |s|
|
206
|
+
if lbl = anchor(node['id'], :label)
|
207
|
+
s << "#{lbl}. " unless @suppressheadingnumbers
|
208
|
+
insert_tab(s, 1)
|
209
|
+
end
|
210
|
+
s << "#{title} "
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<div class="document-stage-band" id='{{
|
2
|
-
<p class="document-stage">{{
|
1
|
+
<div class="document-stage-band" id='{{ stage | downcase | replace: " ", "-" }}-band'>
|
2
|
+
<p class="document-stage">{{ stage }}</p>
|
3
3
|
</div>
|
4
4
|
|
5
5
|
<div class="document-type-band" id='{{ doctype | downcase | replace: " ", "-" }}-band'>
|
@@ -64,7 +64,7 @@
|
|
64
64
|
</div>
|
65
65
|
|
66
66
|
<div class="coverpage-stage-block" >
|
67
|
-
<p><span class="coverpage-maturity" id="{{
|
67
|
+
<p><span class="coverpage-maturity" id="{{ stage | replace: ' ', '-' | downcase }}">{% if unpublished %}{{ stage }}{% endif %}</span></p>
|
68
68
|
{% if submissionlanguage %}
|
69
69
|
<p><span class="coverpage-maturity">Original: {{ submissionlanguage | join: "/" }}</span></p>
|
70
70
|
{% endif %}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<div class="document-stage-band" id='{{
|
2
|
-
<p class="document-stage">{{
|
1
|
+
<div class="document-stage-band" id='{{ stage | downcase | replace: " ", "-" }}-band'>
|
2
|
+
<p class="document-stage">{{ stage }}</p>
|
3
3
|
</div>
|
4
4
|
|
5
5
|
<div class="document-type-band" id='{{ doctype | downcase | replace: " ", "-" }}-band'>
|
@@ -45,7 +45,7 @@
|
|
45
45
|
</div>
|
46
46
|
|
47
47
|
<div class="coverpage-stage-block" >
|
48
|
-
<p><span class="coverpage-maturity" id="{{
|
48
|
+
<p><span class="coverpage-maturity" id="{{ stage | replace: ' ', '-' | downcase }}">{% if unpublished %}{{ stage }}{% endif %}</span></p>
|
49
49
|
{% if submissionlanguage %}
|
50
50
|
<p><span class="coverpage-maturity">Original: {{ submissionlanguage | join: "/" }}</span></p>
|
51
51
|
{% endif %}
|
@@ -1,7 +1,5 @@
|
|
1
|
+
require_relative "base_convert"
|
1
2
|
require "isodoc"
|
2
|
-
require_relative "metadata"
|
3
|
-
require "fileutils"
|
4
|
-
require "roman-numerals"
|
5
3
|
|
6
4
|
module IsoDoc
|
7
5
|
module Unece
|
@@ -46,10 +44,6 @@ module IsoDoc
|
|
46
44
|
}
|
47
45
|
end
|
48
46
|
|
49
|
-
def metadata_init(lang, script, labels)
|
50
|
-
@meta = Metadata.new(lang, script, labels)
|
51
|
-
@meta.set(:toc, @toc)
|
52
|
-
end
|
53
47
|
|
54
48
|
def googlefonts
|
55
49
|
<<~HEAD.freeze
|
@@ -59,7 +53,7 @@ module IsoDoc
|
|
59
53
|
end
|
60
54
|
|
61
55
|
def make_body(xml, docxml)
|
62
|
-
plenary = docxml.at(ns("//bibdata[
|
56
|
+
plenary = docxml.at(ns("//bibdata/ext[doctype = 'plenary']"))
|
63
57
|
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72", "xml:lang": "EN-US", class: "container" }
|
64
58
|
if plenary && @htmlcoverpage == html_doc_path("html_unece_titlepage.html")
|
65
59
|
@htmlcoverpage = html_doc_path("html_unece_plenary_titlepage.html")
|
@@ -118,8 +112,8 @@ module IsoDoc
|
|
118
112
|
if node["inline-header"] == "true"
|
119
113
|
inline_header_title(out, node, c1)
|
120
114
|
else
|
121
|
-
div.send "h#{
|
122
|
-
lbl =
|
115
|
+
div.send "h#{anchor(node['id'], :level) || '1'}" do |h|
|
116
|
+
lbl = anchor(node['id'], :label, false)
|
123
117
|
h << "#{lbl}. " if lbl && !@suppressheadingnumbers
|
124
118
|
insert_tab(h, 1) if lbl && !@suppressheadingnumbers
|
125
119
|
c1&.children&.each { |c2| parse(c2, h) }
|
@@ -151,202 +145,7 @@ module IsoDoc
|
|
151
145
|
end
|
152
146
|
end
|
153
147
|
|
154
|
-
|
155
|
-
div.h1 **{ class: "Annex" } do |t|
|
156
|
-
t << "#{get_anchors[annex['id']][:label]}"
|
157
|
-
t.br
|
158
|
-
t.b do |b|
|
159
|
-
name&.children&.each { |c2| parse(c2, b) }
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
def i18n_init(lang, script)
|
165
|
-
super
|
166
|
-
@admonition_lbl = "Box"
|
167
|
-
@abstract_lbl = "Summary"
|
168
|
-
end
|
169
|
-
|
170
|
-
def fileloc(loc)
|
171
|
-
File.join(File.dirname(__FILE__), loc)
|
172
|
-
end
|
173
|
-
|
174
|
-
MIDDLE_CLAUSE = "//clause[parent::sections]".freeze
|
175
|
-
|
176
|
-
def initial_anchor_names(d)
|
177
|
-
preface_names(d.at(ns("//foreword")))
|
178
|
-
preface_names(d.at(ns("//introduction")))
|
179
|
-
sequential_asset_names(d.xpath(ns("//foreword | //introduction")))
|
180
|
-
middle_section_asset_names(d)
|
181
|
-
clause_names(d, 0)
|
182
|
-
termnote_anchor_names(d)
|
183
|
-
termexample_anchor_names(d)
|
184
|
-
end
|
185
|
-
|
186
|
-
def clause_names(docxml, sect_num)
|
187
|
-
q = "//clause[parent::sections]"
|
188
|
-
@paranumber = 0
|
189
|
-
docxml.xpath(ns(q)).each_with_index do |c, i|
|
190
|
-
section_names(c, (i + sect_num), 1)
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
def levelnumber(num, lvl)
|
195
|
-
case lvl % 3
|
196
|
-
when 1 then RomanNumerals.to_roman(num)
|
197
|
-
when 2 then ("A".ord + num - 1).chr
|
198
|
-
when 0 then num.to_s
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
def annex_levelnumber(num, lvl)
|
203
|
-
case lvl % 3
|
204
|
-
when 0 then RomanNumerals.to_roman(num)
|
205
|
-
when 1 then ("A".ord + num - 1).chr
|
206
|
-
when 2 then num.to_s
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
def leaf_section(clause, lvl)
|
211
|
-
@paranumber += 1
|
212
|
-
@anchors[clause["id"]] = {label: @paranumber.to_s, xref: "paragraph #{@paranumber}", level: lvl, type: "paragraph" }
|
213
|
-
end
|
214
|
-
|
215
|
-
def annex_leaf_section(clause, num, lvl)
|
216
|
-
@paranumber += 1
|
217
|
-
@anchors[clause["id"]] = {label: @paranumber.to_s, xref: "paragraph #{num}.#{@paranumber}", level: lvl, type: "paragraph" }
|
218
|
-
end
|
219
|
-
|
220
|
-
def section_names(clause, num, lvl)
|
221
|
-
return num if clause.nil?
|
222
|
-
clause.at(ns("./clause | ./term | ./terms | ./definitions")) or
|
223
|
-
leaf_section(clause, lvl) && return
|
224
|
-
num = num + 1
|
225
|
-
lbl = levelnumber(num, 1)
|
226
|
-
@anchors[clause["id"]] =
|
227
|
-
{ label: lbl, xref: l10n("#{@clause_lbl} #{lbl}"), level: lvl, type: "clause" }
|
228
|
-
i = 1
|
229
|
-
clause.xpath(ns("./clause | ./term | ./terms | ./definitions")).each do |c|
|
230
|
-
section_names1(c, "#{lbl}.#{levelnumber(i, lvl + 1)}", lvl + 1)
|
231
|
-
i += 1 if c.at(ns("./clause | ./term | ./terms | ./definitions"))
|
232
|
-
end
|
233
|
-
num
|
234
|
-
end
|
235
|
-
|
236
|
-
def section_names1(clause, num, level)
|
237
|
-
unless clause.at(ns("./clause | ./term | ./terms | ./definitions"))
|
238
|
-
leaf_section(clause, level) and return
|
239
|
-
end
|
240
|
-
/\.(?<leafnum>[^.]+$)/ =~ num
|
241
|
-
@anchors[clause["id"]] =
|
242
|
-
{ label: leafnum, level: level, xref: l10n("#{@clause_lbl} #{num}"), type: "clause" }
|
243
|
-
i = 1
|
244
|
-
clause.xpath(ns("./clause | ./terms | ./term | ./definitions")).each do |c|
|
245
|
-
section_names1(c, "#{num}.#{levelnumber(i, level + 1)}", level + 1)
|
246
|
-
i += 1 if c.at(ns("./clause | ./term | ./terms | ./definitions"))
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
def annex_name_lbl(clause, num)
|
251
|
-
l10n("<b>#{@annex_lbl} #{num}</b>")
|
252
|
-
end
|
253
|
-
|
254
|
-
def annex_names(clause, num)
|
255
|
-
hierarchical_asset_names(clause, num)
|
256
|
-
unless clause.at(ns("./clause | ./term | ./terms | ./definitions"))
|
257
|
-
annex_leaf_section(clause, num, 1) and return
|
258
|
-
end
|
259
|
-
@anchors[clause["id"]] = { label: annex_name_lbl(clause, num), type: "clause",
|
260
|
-
xref: "#{@annex_lbl} #{num}", level: 1 }
|
261
|
-
i = 1
|
262
|
-
clause.xpath(ns("./clause")).each do |c|
|
263
|
-
annex_names1(c, "#{num}.#{annex_levelnumber(i, 2)}", 2)
|
264
|
-
i += 1 if c.at(ns("./clause | ./term | ./terms | ./definitions"))
|
265
|
-
end
|
266
|
-
end
|
267
|
-
|
268
|
-
def annex_names1(clause, num, level)
|
269
|
-
unless clause.at(ns("./clause | ./term | ./terms | ./definitions"))
|
270
|
-
annex_leaf_section(clause, num, level) and return
|
271
|
-
end
|
272
|
-
/\.(?<leafnum>[^.]+$)/ =~ num
|
273
|
-
@anchors[clause["id"]] = { label: leafnum, xref: "#{@annex_lbl} #{num}",
|
274
|
-
level: level, type: "clause" }
|
275
|
-
i = 1
|
276
|
-
clause.xpath(ns("./clause")).each do |c|
|
277
|
-
annex_names1(c, "#{num}.#{annex_levelnumber(i, level + 1)}", level + 1)
|
278
|
-
i += 1 if c.at(ns("./clause | ./term | ./terms | ./definitions"))
|
279
|
-
end
|
280
|
-
end
|
281
|
-
|
282
|
-
def back_anchor_names(docxml)
|
283
|
-
docxml.xpath(ns("//annex")).each_with_index do |c, i|
|
284
|
-
@paranumber = 0
|
285
|
-
annex_names(c, RomanNumerals.to_roman(i + 1))
|
286
|
-
end
|
287
|
-
docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
|
288
|
-
reference_names(ref)
|
289
|
-
end
|
290
|
-
end
|
291
|
-
|
292
|
-
def sequential_admonition_names(clause)
|
293
|
-
i = 0
|
294
|
-
clause.xpath(ns(".//admonition")).each do |t|
|
295
|
-
i += 1
|
296
|
-
next if t["id"].nil? || t["id"].empty?
|
297
|
-
@anchors[t["id"]] = anchor_struct(i.to_s, nil, @admonition_lbl, "box")
|
298
|
-
end
|
299
|
-
end
|
300
|
-
|
301
|
-
def hierarchical_admonition_names(clause, num)
|
302
|
-
i = 0
|
303
|
-
clause.xpath(ns(".//admonition")).each do |t|
|
304
|
-
i += 1
|
305
|
-
next if t["id"].nil? || t["id"].empty?
|
306
|
-
@anchors[t["id"]] = anchor_struct("#{num}.#{i}", nil, @admonition_lbl, "box")
|
307
|
-
end
|
308
|
-
end
|
309
|
-
|
310
|
-
def sequential_asset_names(clause)
|
311
|
-
super
|
312
|
-
sequential_admonition_names(clause)
|
313
|
-
end
|
314
|
-
|
315
|
-
def hierarchical_asset_names(clause, num)
|
316
|
-
super
|
317
|
-
hierarchical_admonition_names(clause, num)
|
318
|
-
end
|
319
|
-
|
320
|
-
def admonition_name_parse(node, div, name)
|
321
|
-
div.p **{ class: "FigureTitle", align: "center" } do |p|
|
322
|
-
p << l10n("#{@admonition_lbl} #{get_anchors[node['id']][:label]}")
|
323
|
-
if name
|
324
|
-
p << " — "
|
325
|
-
name.children.each { |n| parse(n, div) }
|
326
|
-
end
|
327
|
-
end
|
328
|
-
end
|
329
|
-
|
330
|
-
def admonition_parse(node, out)
|
331
|
-
name = node.at(ns("./name"))
|
332
|
-
out.div **{ class: "Admonition" } do |t|
|
333
|
-
admonition_name_parse(node, t, name) if name
|
334
|
-
node.children.each do |n|
|
335
|
-
parse(n, t) unless n.name == "name"
|
336
|
-
end
|
337
|
-
end
|
338
|
-
end
|
339
|
-
|
340
|
-
def inline_header_title(out, node, c1)
|
341
|
-
title = c1&.content || ""
|
342
|
-
out.span **{ class: "zzMoveToFollowing" } do |s|
|
343
|
-
if get_anchors[node['id']][:label]
|
344
|
-
s << "#{get_anchors[node['id']][:label]}. " unless @suppressheadingnumbers
|
345
|
-
insert_tab(s, 1)
|
346
|
-
end
|
347
|
-
s << "#{title} "
|
348
|
-
end
|
349
|
-
end
|
148
|
+
include BaseConvert
|
350
149
|
end
|
351
150
|
end
|
352
151
|
end
|