metanorma-mpfd 0.1.10 → 0.2.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 +15 -10
- data/appveyor.yml +7 -2
- data/lib/asciidoctor/mpfd/biblio.rng +44 -15
- data/lib/asciidoctor/mpfd/converter.rb +2 -4
- data/lib/asciidoctor/mpfd/isodoc.rng +128 -71
- data/lib/asciidoctor/mpfd/isostandard.rng +29 -304
- data/lib/asciidoctor/mpfd/mpfd.rng +6 -83
- data/lib/asciidoctor/mpfd/reqt.rng +5 -0
- data/lib/asciidoctor/mpfd/validate.rb +30 -0
- data/lib/isodoc/mpfd/base_convert.rb +220 -0
- data/lib/isodoc/mpfd/html/html_rsd_titlepage.html +3 -3
- data/lib/isodoc/mpfd/html_convert.rb +2 -212
- data/lib/isodoc/mpfd/metadata.rb +3 -4
- data/lib/isodoc/mpfd/pdf_convert.rb +2 -218
- data/lib/isodoc/mpfd/word_convert.rb +2 -198
- data/lib/metanorma/mpfd/version.rb +1 -1
- data/metanorma-mpfd.gemspec +3 -2
- metadata +10 -8
@@ -0,0 +1,30 @@
|
|
1
|
+
module Asciidoctor
|
2
|
+
module Mpfd
|
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
|
+
doctype_validate(doc)
|
11
|
+
stage_validate(doc)
|
12
|
+
end
|
13
|
+
|
14
|
+
def doctype_validate(xmldoc)
|
15
|
+
doctype = xmldoc&.at("//bibdata/ext/doctype")&.text
|
16
|
+
%w(policy-and-procedures best-practices supporting-document
|
17
|
+
report legal directives proposal standard).include? doctype or
|
18
|
+
warn "Document Attributes: #{doctype} is not a recognised document type"
|
19
|
+
end
|
20
|
+
|
21
|
+
def stage_validate(xmldoc)
|
22
|
+
stage = xmldoc&.at("//bibdata/status/stage")&.text
|
23
|
+
%w(proposal working-draft committee-draft draft-standard final-draft
|
24
|
+
published withdrawn).include? stage or
|
25
|
+
warn "Document Attributes: #{stage} is not a recognised status"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,220 @@
|
|
1
|
+
require "isodoc"
|
2
|
+
require_relative "metadata"
|
3
|
+
require "fileutils"
|
4
|
+
|
5
|
+
module IsoDoc
|
6
|
+
module Mpfd
|
7
|
+
module BaseConvert
|
8
|
+
def convert1(docxml, filename, dir)
|
9
|
+
FileUtils.cp html_doc_path("logo.jpg"), File.join(@localdir, "logo.jpg")
|
10
|
+
FileUtils.cp html_doc_path('mpfa-logo-no-text@4x.png'), File.join(@localdir, "mpfa-logo-no-text@4x.png")
|
11
|
+
@files_to_delete << File.join(@localdir, "logo.jpg")
|
12
|
+
@files_to_delete << File.join(@localdir, "mpfa-logo-no-text@4x.png")
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def metadata_init(lang, script, labels)
|
17
|
+
@meta = Metadata.new(lang, script, labels)
|
18
|
+
end
|
19
|
+
|
20
|
+
def annex_name(annex, name, div)
|
21
|
+
div.h1 **{ class: "Annex" } do |t|
|
22
|
+
t << "#{anchor(annex['id'], :label)} "
|
23
|
+
t.b do |b|
|
24
|
+
name&.children&.each { |c2| parse(c2, b) }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def fileloc(loc)
|
30
|
+
File.join(File.dirname(__FILE__), loc)
|
31
|
+
end
|
32
|
+
|
33
|
+
def i18n_init(lang, script)
|
34
|
+
super
|
35
|
+
y = if lang == "en"
|
36
|
+
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
|
37
|
+
elsif lang == "zh" && script == "Hans"
|
38
|
+
YAML.load_file(File.join(File.dirname(__FILE__),
|
39
|
+
"i18n-zh-Hans.yaml"))
|
40
|
+
else
|
41
|
+
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
|
42
|
+
end
|
43
|
+
@labels = @labels.merge(y)
|
44
|
+
@annex_lbl = y["annex"]
|
45
|
+
@clause_lbl = y["clause"]
|
46
|
+
end
|
47
|
+
|
48
|
+
def terms_defs_title(f)
|
49
|
+
return f&.at(ns("./title"))&.content
|
50
|
+
end
|
51
|
+
|
52
|
+
TERM_CLAUSE = "//preface/terms | "\
|
53
|
+
"//preface/clause[descendant::terms]".freeze
|
54
|
+
|
55
|
+
SECTIONS_XPATH =
|
56
|
+
"//foreword | //introduction | //preface/terms | //preface/clause | //annex | "\
|
57
|
+
"//sections/clause | //bibliography/references | "\
|
58
|
+
"//bibliography/clause".freeze
|
59
|
+
|
60
|
+
def terms_defs(isoxml, out, num)
|
61
|
+
f = isoxml.at(ns(self.class::TERM_CLAUSE)) or return num
|
62
|
+
out.div **attr_code(id: f["id"]) do |div|
|
63
|
+
clause_name(nil, terms_defs_title(f), div, nil)
|
64
|
+
f.elements.each do |e|
|
65
|
+
parse(e, div) unless %w{title source}.include? e.name
|
66
|
+
end
|
67
|
+
end
|
68
|
+
num
|
69
|
+
end
|
70
|
+
|
71
|
+
FRONT_CLAUSE = "//*[parent::preface]".freeze
|
72
|
+
|
73
|
+
def preface(isoxml, out)
|
74
|
+
isoxml.xpath(ns(self.class::FRONT_CLAUSE)).each do |c|
|
75
|
+
if c.name == "terms" || c.at(ns(".//terms")) then terms_defs isoxml, out, 0
|
76
|
+
else
|
77
|
+
out.div **attr_code(id: c["id"]) do |s|
|
78
|
+
clause_name(anchor(c['id'], :label),
|
79
|
+
c&.at(ns("./title"))&.content, s, nil)
|
80
|
+
c.elements.reject { |c1| c1.name == "title" }.each do |c1|
|
81
|
+
parse(c1, s)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def initial_anchor_names(d)
|
89
|
+
d.xpath(ns(self.class::FRONT_CLAUSE)).each do |c|
|
90
|
+
preface_names(c)
|
91
|
+
sequential_asset_names(c)
|
92
|
+
end
|
93
|
+
middle_section_asset_names(d)
|
94
|
+
clause_names(d, 0)
|
95
|
+
termnote_anchor_names(d)
|
96
|
+
termexample_anchor_names(d)
|
97
|
+
end
|
98
|
+
|
99
|
+
def middle(isoxml, out)
|
100
|
+
middle_title(out)
|
101
|
+
clause isoxml, out
|
102
|
+
annex isoxml, out
|
103
|
+
bibliography isoxml, out
|
104
|
+
end
|
105
|
+
|
106
|
+
def termdef_parse(node, out)
|
107
|
+
set_termdomain("")
|
108
|
+
node.children.each { |n| parse(n, out) }
|
109
|
+
end
|
110
|
+
|
111
|
+
def annex_name_lbl(clause, num)
|
112
|
+
l10n("<b>#{@annex_lbl} #{num}</b>")
|
113
|
+
end
|
114
|
+
|
115
|
+
def clause_names(docxml, sect_num)
|
116
|
+
q = "//clause[parent::sections]"
|
117
|
+
@topnum = nil
|
118
|
+
lvl = 0
|
119
|
+
docxml.xpath(ns(q)).each do |c|
|
120
|
+
container_names(c, 0)
|
121
|
+
sect_num, lvl = sect_names(c, nil, sect_num, 0, lvl)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def container_names(clause, lvl)
|
126
|
+
if clause["container"]
|
127
|
+
@anchors[clause["id"]] =
|
128
|
+
{ label: nil, xref: clause.at(ns("./title"))&.text, level: lvl+1 }
|
129
|
+
end
|
130
|
+
clause.xpath(ns("./clause | ./term | ./terms | "\
|
131
|
+
"./definitions")).each do |c|
|
132
|
+
container_names(c, clause["container"] ? lvl+1 : lvl)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def sect_names(clause, num, i, lvl, prev_lvl)
|
137
|
+
return i if clause.nil?
|
138
|
+
curr = i
|
139
|
+
if !clause["container"]
|
140
|
+
retlvl = lvl
|
141
|
+
i+=1
|
142
|
+
curr = i
|
143
|
+
name = num.nil? ? i.to_s : "#{num}.#{i}"
|
144
|
+
@anchors[clause["id"]] = { label: name, xref: l10n("#{@clause_lbl} #{name}"), level: lvl+1 }
|
145
|
+
end
|
146
|
+
prev = lvl
|
147
|
+
j = 0
|
148
|
+
clause.xpath(ns("./clause | ./term | ./terms | "\
|
149
|
+
"./definitions")).each do |c|
|
150
|
+
if clause["container"]
|
151
|
+
i, lvl = sect_names(c, num, i, lvl, lvl)
|
152
|
+
else
|
153
|
+
j, prev = sect_names(c, name, j, lvl+1, prev)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
i = j if j >0
|
157
|
+
i = curr if lvl < prev
|
158
|
+
[i, prev]
|
159
|
+
end
|
160
|
+
|
161
|
+
def annex_naming(c, num, lvl, i)
|
162
|
+
if c["guidance"] then annex_names1(c, "#{num}E", lvl + 1)
|
163
|
+
else
|
164
|
+
i+= 1 unless c["container"]
|
165
|
+
annex_names1(c, "#{num}.#{i}", lvl + 1)
|
166
|
+
end
|
167
|
+
i
|
168
|
+
end
|
169
|
+
|
170
|
+
def annex_names(clause, num)
|
171
|
+
@anchors[clause["id"]] = { label: annex_name_lbl(clause, num),
|
172
|
+
xref: "#{@annex_lbl} #{num}", level: 1 }
|
173
|
+
i = 0
|
174
|
+
clause.xpath(ns("./clause")).each do |c|
|
175
|
+
container_names(c, 0)
|
176
|
+
i = annex_naming(c, num, 1, i)
|
177
|
+
end
|
178
|
+
hierarchical_asset_names(clause, num)
|
179
|
+
end
|
180
|
+
|
181
|
+
def annex_names1(clause, num, level)
|
182
|
+
clause["container"] or @anchors[clause["id"]] =
|
183
|
+
{ label: num, xref: "#{@annex_lbl} #{num}", level: level }
|
184
|
+
i = 0
|
185
|
+
clause.xpath(ns("./clause")).each do |c|
|
186
|
+
i = annex_naming(c, num, level, i)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def clause(isoxml, out)
|
191
|
+
isoxml.xpath(ns(self.class::MIDDLE_CLAUSE)).each do |c|
|
192
|
+
out.div **attr_code(id: c["id"]) do |s|
|
193
|
+
clause_name(anchor(c['id'], :label),
|
194
|
+
c&.at(ns("./title"))&.content, s, class: c["container"] ? "containerhdr" : nil )
|
195
|
+
c.elements.reject { |c1| c1.name == "title" }.each do |c1|
|
196
|
+
parse(c1, s)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
def clause_parse_title(node, div, c1, out)
|
203
|
+
if node["inline-header"] == "true"
|
204
|
+
inline_header_title(out, node, c1)
|
205
|
+
else
|
206
|
+
attrs = { class: node["container"] ? "containerhdr" : nil }
|
207
|
+
div.send "h#{anchor(node['id'], :level) || '1'}", **attr_code(attrs) do |h|
|
208
|
+
lbl = anchor(node['id'], :label, false)
|
209
|
+
h << "#{lbl}. " if lbl && !@suppressheadingnumbers
|
210
|
+
c1&.children&.each { |c2| parse(c2, h) }
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
def ol_depth(node)
|
216
|
+
ol_style(node["type"])
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<!--
|
2
|
-
<div class="document-stage-band" id='{{
|
3
|
-
<p class="document-stage">{{
|
2
|
+
<div class="document-stage-band" id='{{ stage | downcase | replace: " ", "-" }}-band'>
|
3
|
+
<p class="document-stage">{{ stage }}</p>
|
4
4
|
</div>
|
5
5
|
|
6
6
|
<div class="document-type-band" id='{{ doctype | downcase | replace: " ", "-" }}-band'>
|
@@ -39,7 +39,7 @@
|
|
39
39
|
<div class="coverpage-logo">
|
40
40
|
<span class="doc-edition">{{ edition }} Edition</span>
|
41
41
|
<span>{{ revdate_monthyear }} {{ draftinfo }}</span>
|
42
|
-
<span>Status: {{
|
42
|
+
<span>Status: {{ stage }}</span>
|
43
43
|
</div>
|
44
44
|
|
45
45
|
<div class="coverpage-location">
|
@@ -1,6 +1,5 @@
|
|
1
|
+
require_relative "base_convert"
|
1
2
|
require "isodoc"
|
2
|
-
require_relative "metadata"
|
3
|
-
require "fileutils"
|
4
3
|
|
5
4
|
module IsoDoc
|
6
5
|
module Mpfd
|
@@ -14,13 +13,7 @@ module IsoDoc
|
|
14
13
|
super
|
15
14
|
end
|
16
15
|
|
17
|
-
|
18
|
-
FileUtils.cp html_doc_path("logo.jpg"), File.join(@localdir, "logo.jpg")
|
19
|
-
FileUtils.cp html_doc_path('mpfa-logo-no-text@4x.png'), File.join(@localdir, "mpfa-logo-no-text@4x.png")
|
20
|
-
@files_to_delete << File.join(@localdir, "logo.jpg")
|
21
|
-
@files_to_delete << File.join(@localdir, "mpfa-logo-no-text@4x.png")
|
22
|
-
super
|
23
|
-
end
|
16
|
+
include BaseConvert
|
24
17
|
|
25
18
|
def default_fonts(options)
|
26
19
|
{
|
@@ -39,10 +32,6 @@ module IsoDoc
|
|
39
32
|
}
|
40
33
|
end
|
41
34
|
|
42
|
-
def metadata_init(lang, script, labels)
|
43
|
-
@meta = Metadata.new(lang, script, labels)
|
44
|
-
end
|
45
|
-
|
46
35
|
def googlefonts
|
47
36
|
<<~HEAD.freeze
|
48
37
|
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
|
@@ -64,74 +53,6 @@ module IsoDoc
|
|
64
53
|
docxml
|
65
54
|
end
|
66
55
|
|
67
|
-
def annex_name(annex, name, div)
|
68
|
-
div.h1 **{ class: "Annex" } do |t|
|
69
|
-
t << "#{get_anchors[annex['id']][:label]} "
|
70
|
-
t.b do |b|
|
71
|
-
name&.children&.each { |c2| parse(c2, b) }
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def fileloc(loc)
|
77
|
-
File.join(File.dirname(__FILE__), loc)
|
78
|
-
end
|
79
|
-
|
80
|
-
def i18n_init(lang, script)
|
81
|
-
super
|
82
|
-
y = if lang == "en"
|
83
|
-
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
|
84
|
-
elsif lang == "zh" && script == "Hans"
|
85
|
-
YAML.load_file(File.join(File.dirname(__FILE__),
|
86
|
-
"i18n-zh-Hans.yaml"))
|
87
|
-
else
|
88
|
-
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
|
89
|
-
end
|
90
|
-
@labels = @labels.merge(y)
|
91
|
-
@annex_lbl = y["annex"]
|
92
|
-
@clause_lbl = y["clause"]
|
93
|
-
end
|
94
|
-
|
95
|
-
def terms_defs_title(f)
|
96
|
-
return f&.at(ns("./title"))&.content
|
97
|
-
end
|
98
|
-
|
99
|
-
TERM_CLAUSE = "//preface/terms | "\
|
100
|
-
"//preface/clause[descendant::terms]".freeze
|
101
|
-
|
102
|
-
SECTIONS_XPATH =
|
103
|
-
"//foreword | //introduction | //preface/terms | //preface/clause | //annex | "\
|
104
|
-
"//sections/clause | //bibliography/references | "\
|
105
|
-
"//bibliography/clause".freeze
|
106
|
-
|
107
|
-
def terms_defs(isoxml, out, num)
|
108
|
-
f = isoxml.at(ns(TERM_CLAUSE)) or return num
|
109
|
-
out.div **attr_code(id: f["id"]) do |div|
|
110
|
-
clause_name(nil, terms_defs_title(f), div, nil)
|
111
|
-
f.elements.each do |e|
|
112
|
-
parse(e, div) unless %w{title source}.include? e.name
|
113
|
-
end
|
114
|
-
end
|
115
|
-
num
|
116
|
-
end
|
117
|
-
|
118
|
-
FRONT_CLAUSE = "//*[parent::preface]".freeze
|
119
|
-
|
120
|
-
def preface(isoxml, out)
|
121
|
-
isoxml.xpath(ns(FRONT_CLAUSE)).each do |c|
|
122
|
-
if c.name == "terms" || c.at(ns(".//terms")) then terms_defs isoxml, out, 0
|
123
|
-
else
|
124
|
-
out.div **attr_code(id: c["id"]) do |s|
|
125
|
-
clause_name(get_anchors[c['id']][:label],
|
126
|
-
c&.at(ns("./title"))&.content, s, nil)
|
127
|
-
c.elements.reject { |c1| c1.name == "title" }.each do |c1|
|
128
|
-
parse(c1, s)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
56
|
def make_body3(body, docxml)
|
136
57
|
body.div **{ class: "main-section" } do |div3|
|
137
58
|
preface docxml, div3
|
@@ -140,137 +61,6 @@ module IsoDoc
|
|
140
61
|
comments div3
|
141
62
|
end
|
142
63
|
end
|
143
|
-
|
144
|
-
def middle(isoxml, out)
|
145
|
-
middle_title(out)
|
146
|
-
clause isoxml, out
|
147
|
-
annex isoxml, out
|
148
|
-
bibliography isoxml, out
|
149
|
-
end
|
150
|
-
|
151
|
-
def termdef_parse(node, out)
|
152
|
-
set_termdomain("")
|
153
|
-
node.children.each { |n| parse(n, out) }
|
154
|
-
end
|
155
|
-
|
156
|
-
def initial_anchor_names(d)
|
157
|
-
d.xpath(ns(FRONT_CLAUSE)).each do |c|
|
158
|
-
preface_names(c)
|
159
|
-
sequential_asset_names(c)
|
160
|
-
end
|
161
|
-
middle_section_asset_names(d)
|
162
|
-
clause_names(d, 0)
|
163
|
-
termnote_anchor_names(d)
|
164
|
-
termexample_anchor_names(d)
|
165
|
-
end
|
166
|
-
|
167
|
-
def annex_name_lbl(clause, num)
|
168
|
-
l10n("<b>#{@annex_lbl} #{num}</b>")
|
169
|
-
end
|
170
|
-
|
171
|
-
def clause_names(docxml, sect_num)
|
172
|
-
q = "//clause[parent::sections]"
|
173
|
-
@topnum = nil
|
174
|
-
lvl = 0
|
175
|
-
docxml.xpath(ns(q)).each do |c|
|
176
|
-
container_names(c, 0)
|
177
|
-
sect_num, lvl = sect_names(c, nil, sect_num, 0, lvl)
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
def container_names(clause, lvl)
|
182
|
-
if clause["container"]
|
183
|
-
@anchors[clause["id"]] =
|
184
|
-
{ label: nil, xref: clause.at(ns("./title"))&.text, level: lvl+1 }
|
185
|
-
end
|
186
|
-
clause.xpath(ns("./clause | ./term | ./terms | "\
|
187
|
-
"./definitions")).each do |c|
|
188
|
-
container_names(c, clause["container"] ? lvl+1 : lvl)
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
def sect_names(clause, num, i, lvl, prev_lvl)
|
193
|
-
return i if clause.nil?
|
194
|
-
curr = i
|
195
|
-
if !clause["container"]
|
196
|
-
retlvl = lvl
|
197
|
-
i+=1
|
198
|
-
curr = i
|
199
|
-
name = num.nil? ? i.to_s : "#{num}.#{i}"
|
200
|
-
@anchors[clause["id"]] = { label: name, xref: l10n("#{@clause_lbl} #{name}"), level: lvl+1 }
|
201
|
-
end
|
202
|
-
prev = lvl
|
203
|
-
j = 0
|
204
|
-
clause.xpath(ns("./clause | ./term | ./terms | "\
|
205
|
-
"./definitions")).each do |c|
|
206
|
-
if clause["container"]
|
207
|
-
i, lvl = sect_names(c, num, i, lvl, lvl)
|
208
|
-
else
|
209
|
-
j, prev = sect_names(c, name, j, lvl+1, prev)
|
210
|
-
end
|
211
|
-
end
|
212
|
-
i = j if j >0
|
213
|
-
i = curr if lvl < prev
|
214
|
-
[i, prev]
|
215
|
-
end
|
216
|
-
|
217
|
-
def annex_naming(c, num, lvl, i)
|
218
|
-
if c["guidance"] then annex_names1(c, "#{num}E", lvl + 1)
|
219
|
-
else
|
220
|
-
i+= 1 unless c["container"]
|
221
|
-
annex_names1(c, "#{num}.#{i}", lvl + 1)
|
222
|
-
end
|
223
|
-
i
|
224
|
-
end
|
225
|
-
|
226
|
-
def annex_names(clause, num)
|
227
|
-
@anchors[clause["id"]] = { label: annex_name_lbl(clause, num),
|
228
|
-
xref: "#{@annex_lbl} #{num}", level: 1 }
|
229
|
-
i = 0
|
230
|
-
clause.xpath(ns("./clause")).each do |c|
|
231
|
-
container_names(c, 0)
|
232
|
-
i = annex_naming(c, num, 1, i)
|
233
|
-
end
|
234
|
-
hierarchical_asset_names(clause, num)
|
235
|
-
end
|
236
|
-
|
237
|
-
def annex_names1(clause, num, level)
|
238
|
-
clause["container"] or @anchors[clause["id"]] =
|
239
|
-
{ label: num, xref: "#{@annex_lbl} #{num}", level: level }
|
240
|
-
i = 0
|
241
|
-
clause.xpath(ns("./clause")).each do |c|
|
242
|
-
i = annex_naming(c, num, level, i)
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
def clause(isoxml, out)
|
247
|
-
isoxml.xpath(ns(MIDDLE_CLAUSE)).each do |c|
|
248
|
-
out.div **attr_code(id: c["id"]) do |s|
|
249
|
-
clause_name(get_anchors[c['id']][:label],
|
250
|
-
c&.at(ns("./title"))&.content, s, class: c["container"] ? "containerhdr" : nil )
|
251
|
-
c.elements.reject { |c1| c1.name == "title" }.each do |c1|
|
252
|
-
parse(c1, s)
|
253
|
-
end
|
254
|
-
end
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
def clause_parse_title(node, div, c1, out)
|
259
|
-
if node["inline-header"] == "true"
|
260
|
-
inline_header_title(out, node, c1)
|
261
|
-
else
|
262
|
-
attrs = { class: node["container"] ? "containerhdr" : nil }
|
263
|
-
div.send "h#{get_anchors[node['id']][:level]}", **attr_code(attrs) do |h|
|
264
|
-
lbl = get_anchors[node['id']][:label]
|
265
|
-
h << "#{lbl}. " if lbl && !@suppressheadingnumbers
|
266
|
-
c1&.children&.each { |c2| parse(c2, h) }
|
267
|
-
end
|
268
|
-
end
|
269
|
-
end
|
270
|
-
|
271
|
-
def ol_depth(node)
|
272
|
-
ol_style(node["type"])
|
273
|
-
end
|
274
64
|
end
|
275
65
|
end
|
276
66
|
end
|