metanorma-ogc 1.0.6 → 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 +8 -1
- data/.github/workflows/ubuntu.yml +20 -7
- data/.github/workflows/windows.yml +8 -1
- data/lib/asciidoctor/ogc/biblio.rng +36 -6
- data/lib/asciidoctor/ogc/boilerplate.xml +7 -22
- data/lib/asciidoctor/ogc/converter.rb +11 -16
- data/lib/asciidoctor/ogc/isodoc.rng +444 -1
- data/lib/asciidoctor/ogc/reqt.rng +23 -0
- data/lib/isodoc/ogc.rb +2 -0
- data/lib/isodoc/ogc/base_convert.rb +12 -60
- data/lib/isodoc/ogc/biblio.rb +6 -5
- data/lib/isodoc/ogc/html/html_ogc_titlepage.html +0 -5
- data/lib/isodoc/ogc/html/scripts.html +10 -7
- data/lib/isodoc/ogc/html_convert.rb +3 -7
- data/lib/isodoc/ogc/metadata.rb +0 -8
- data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +995 -377
- data/lib/isodoc/ogc/ogc.best-practice.xsl +995 -377
- data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +995 -377
- data/lib/isodoc/ogc/ogc.community-practice.xsl +995 -377
- data/lib/isodoc/ogc/ogc.community-standard.xsl +995 -377
- data/lib/isodoc/ogc/ogc.discussion-paper.xsl +995 -377
- data/lib/isodoc/ogc/ogc.engineering-report.xsl +995 -377
- data/lib/isodoc/ogc/ogc.other.xsl +995 -377
- data/lib/isodoc/ogc/ogc.policy.xsl +995 -377
- data/lib/isodoc/ogc/ogc.reference-model.xsl +995 -377
- data/lib/isodoc/ogc/ogc.release-notes.xsl +995 -377
- data/lib/isodoc/ogc/ogc.standard.xsl +995 -377
- data/lib/isodoc/ogc/ogc.test-suite.xsl +995 -377
- data/lib/isodoc/ogc/ogc.user-guide.xsl +995 -377
- data/lib/isodoc/ogc/ogc.white-paper.xsl +995 -377
- data/lib/isodoc/ogc/pdf_convert.rb +0 -13
- data/lib/isodoc/ogc/presentation_xml_convert.rb +10 -0
- data/lib/isodoc/ogc/reqt.rb +49 -125
- data/lib/isodoc/ogc/sections.rb +9 -8
- data/lib/isodoc/ogc/word_convert.rb +7 -16
- data/lib/isodoc/ogc/xref.rb +158 -0
- data/lib/metanorma/ogc/processor.rb +11 -9
- data/lib/metanorma/ogc/version.rb +1 -1
- data/metanorma-ogc.gemspec +2 -2
- metadata +12 -12
- data/lib/isodoc/ogc/html/scripts.pdf.html +0 -72
@@ -19,19 +19,6 @@ module IsoDoc
|
|
19
19
|
standard user-guide test-suite white-paper).include? doctype
|
20
20
|
"ogc.#{doctype}.xsl"
|
21
21
|
end
|
22
|
-
|
23
|
-
def convert(filename, file = nil, debug = false)
|
24
|
-
file = File.read(filename, encoding: "utf-8") if file.nil?
|
25
|
-
docxml, outname_html, dir = convert_init(file, filename, debug)
|
26
|
-
/\.xml$/.match(filename) or
|
27
|
-
filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
|
28
|
-
f.write file
|
29
|
-
f.path
|
30
|
-
end
|
31
|
-
FileUtils.rm_rf dir
|
32
|
-
::Metanorma::Output::XslfoPdf.new.convert(
|
33
|
-
filename, outname_html + ".pdf", File.join(@libdir, pdf_stylesheet(docxml)))
|
34
|
-
end
|
35
22
|
end
|
36
23
|
end
|
37
24
|
end
|
data/lib/isodoc/ogc/reqt.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
require "isodoc"
|
2
|
-
require_relative "metadata"
|
3
|
-
require "fileutils"
|
4
2
|
|
5
3
|
module IsoDoc
|
6
4
|
module Ogc
|
@@ -14,27 +12,38 @@ module IsoDoc
|
|
14
12
|
end
|
15
13
|
|
16
14
|
def recommend_table_attr(node)
|
17
|
-
attr_code(id: node["id"],
|
18
|
-
|
19
|
-
|
15
|
+
attr_code(id: node["id"], class: recommend_class(node),
|
16
|
+
style: "border-collapse:collapse;border-spacing:0;"\
|
17
|
+
"#{keep_style(node)}")
|
20
18
|
end
|
21
19
|
|
22
20
|
REQ_TBL_ATTR =
|
23
21
|
{ style: "vertical-align:top;", class: "recommend" }.freeze
|
24
22
|
|
23
|
+
def recommendation_class(node)
|
24
|
+
%w(verification abstracttest).include?(node["type"]) ?
|
25
|
+
"RecommendationTestTitle" : "RecommendationTitle"
|
26
|
+
end
|
27
|
+
|
25
28
|
def recommendation_name(node, out, type)
|
26
29
|
label, title, lbl = recommendation_labels(node)
|
27
|
-
out.p **{ class:
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
b << " "
|
33
|
-
title.children.each { |n| parse(n,b) }
|
30
|
+
out.p **{ class: recommendation_class(node) } do |b|
|
31
|
+
if inject_crossreference_reqt?(node, label)
|
32
|
+
lbl = @xrefs.anchor(@xrefs.reqtlabels[label.text], :xref, false)
|
33
|
+
b << (lbl.nil? ? l10n("#{type}:") : l10n("#{lbl}:"))
|
34
|
+
else
|
35
|
+
b << (lbl.nil? ? l10n("#{type}:") : l10n("#{type} #{lbl}:"))
|
34
36
|
end
|
37
|
+
recommendation_name1(title, node, label, b)
|
35
38
|
end
|
36
39
|
end
|
37
40
|
|
41
|
+
def recommendation_name1(title, node, label, b)
|
42
|
+
return unless title && !inject_crossreference_reqt?(node, label)
|
43
|
+
b << " "
|
44
|
+
title.children.each { |n| parse(n,b) }
|
45
|
+
end
|
46
|
+
|
38
47
|
def recommend_title(node, out)
|
39
48
|
label = node.at(ns("./label")) or return
|
40
49
|
out.tr do |tr|
|
@@ -46,6 +55,12 @@ module IsoDoc
|
|
46
55
|
end
|
47
56
|
end
|
48
57
|
|
58
|
+
# embedded reqts xref to top level reqts via label lookup
|
59
|
+
def inject_crossreference_reqt?(node, label)
|
60
|
+
!node.ancestors("requirement, recommendation, permission").empty? &&
|
61
|
+
@xrefs.reqtlabels[label&.text]
|
62
|
+
end
|
63
|
+
|
49
64
|
def recommendation_attributes1(node)
|
50
65
|
out = []
|
51
66
|
oblig = node["obligation"] and out << ["Obligation", oblig]
|
@@ -61,7 +76,7 @@ module IsoDoc
|
|
61
76
|
|
62
77
|
def rec_subj(node)
|
63
78
|
%w(class conformanceclass).include?(node["type"]) ?
|
64
|
-
|
79
|
+
"Target Type" : "Subject"
|
65
80
|
end
|
66
81
|
|
67
82
|
def recommendation_attr_parse(node, label)
|
@@ -78,9 +93,7 @@ module IsoDoc
|
|
78
93
|
end
|
79
94
|
|
80
95
|
def recommendation_attributes(node, out)
|
81
|
-
|
82
|
-
return if ret.empty?
|
83
|
-
ret.each do |i|
|
96
|
+
recommendation_attributes1(node).each do |i|
|
84
97
|
out.tr do |tr|
|
85
98
|
tr.td **REQ_TBL_ATTR do |td|
|
86
99
|
td << i[0]
|
@@ -92,12 +105,17 @@ module IsoDoc
|
|
92
105
|
end
|
93
106
|
end
|
94
107
|
|
108
|
+
def reqt_component_attrs(node)
|
109
|
+
attr_code(style: keep_style(node))
|
110
|
+
end
|
111
|
+
|
95
112
|
def requirement_component_parse(node, out)
|
96
113
|
return if node["exclude"] == "true"
|
97
114
|
node.elements.size == 1 && node.first_element_child.name == "dl" and
|
98
115
|
return reqt_dl(node.first_element_child, out)
|
99
116
|
out.tr do |tr|
|
100
|
-
tr.td **REQ_TBL_ATTR.merge(colspan: 2)
|
117
|
+
tr.td **REQ_TBL_ATTR.merge(colspan: 2).
|
118
|
+
merge(reqt_component_attrs(node)) do |td|
|
101
119
|
node.children.each { |n| parse(n, td) }
|
102
120
|
end
|
103
121
|
end
|
@@ -141,125 +159,31 @@ module IsoDoc
|
|
141
159
|
end
|
142
160
|
|
143
161
|
def recommendation_parse(node, out)
|
144
|
-
|
145
|
-
when "verification" then @labels["recommendationtest"]
|
146
|
-
when "class" then @labels["recommendationclass"]
|
147
|
-
when "abstracttest" then @labels["abstracttest"]
|
148
|
-
when "conformanceclass" then @labels["conformanceclass"]
|
149
|
-
else
|
150
|
-
@recommendation_lbl
|
151
|
-
end
|
152
|
-
recommendation_parse1(node, out, label)
|
153
|
-
end
|
154
|
-
|
155
|
-
def requirement_parse(node, out)
|
156
|
-
label = case node["type"]
|
157
|
-
when "verification" then @labels["requirementtest"]
|
158
|
-
when "class" then @labels["requirementclass"]
|
159
|
-
when "abstracttest" then @labels["abstracttest"]
|
160
|
-
when "conformanceclass" then @labels["conformanceclass"]
|
161
|
-
else
|
162
|
-
@requirement_lbl
|
163
|
-
end
|
164
|
-
recommendation_parse1(node, out, label)
|
162
|
+
recommendation_parse0(node, out, "recommendation")
|
165
163
|
end
|
166
164
|
|
167
|
-
def
|
165
|
+
def recommendation_parse0(node, out, r)
|
168
166
|
label = case node["type"]
|
169
|
-
when "verification" then @labels["
|
170
|
-
when "class" then @labels["
|
167
|
+
when "verification" then @labels["#{r}test"]
|
168
|
+
when "class" then @labels["#{r}class"]
|
171
169
|
when "abstracttest" then @labels["abstracttest"]
|
172
170
|
when "conformanceclass" then @labels["conformanceclass"]
|
173
|
-
else
|
174
|
-
|
171
|
+
else
|
172
|
+
case r
|
173
|
+
when "recommendation" then @recommendation_lbl
|
174
|
+
when "requirement" then @requirement_lbl
|
175
|
+
when "permission" then @permission_lbl
|
176
|
+
end
|
175
177
|
end
|
176
178
|
recommendation_parse1(node, out, label)
|
177
179
|
end
|
178
180
|
|
179
|
-
|
180
|
-
|
181
|
-
def sequential_permission_names(clause, klass, label)
|
182
|
-
c = ::IsoDoc::Function::XrefGen::Counter.new
|
183
|
-
clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
|
184
|
-
next if t["id"].nil? || t["id"].empty?
|
185
|
-
id = c.increment(t).print
|
186
|
-
@anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
|
187
|
-
sequential_permission_children(t, id)
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
def req_class_paths
|
192
|
-
{
|
193
|
-
"class" => "@type = 'class'",
|
194
|
-
"test" => "@type = 'verification'",
|
195
|
-
"" => "not(@type = 'verification' or @type = 'class' or @type = 'abstracttest' or @type = 'conformanceclass')",
|
196
|
-
}
|
197
|
-
end
|
198
|
-
|
199
|
-
def req_class_paths2
|
200
|
-
{
|
201
|
-
"abstracttest" => "@type = 'abstracttest'",
|
202
|
-
"conformanceclass" => "@type = 'conformanceclass'",
|
203
|
-
}
|
204
|
-
end
|
205
|
-
|
206
|
-
def sequential_permission_children(t, id)
|
207
|
-
req_class_paths.each do |k, v|
|
208
|
-
sequential_permission_names1(t, id, "permission[#{v}]", @labels["permission#{k}"])
|
209
|
-
sequential_permission_names1(t, id, "requirement[#{v}]", @labels["requirement#{k}"])
|
210
|
-
sequential_permission_names1(t, id, "recommendation[#{v}]", @labels["recommendation#{k}"])
|
211
|
-
end
|
212
|
-
req_class_paths2.each do |k, v|
|
213
|
-
sequential_permission_names1(t, id, "*[#{v}]", @labels[k])
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
def sequential_permission_names1(block, lbl, klass, label)
|
218
|
-
c = ::IsoDoc::Function::XrefGen::Counter.new
|
219
|
-
block.xpath(ns("./#{klass}")).each do |t|
|
220
|
-
next if t["id"].nil? || t["id"].empty?
|
221
|
-
id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
|
222
|
-
@anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
|
223
|
-
sequential_permission_children(t, id)
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
def sequential_asset_names(clause)
|
228
|
-
sequential_table_names(clause)
|
229
|
-
sequential_figure_names(clause)
|
230
|
-
sequential_formula_names(clause)
|
231
|
-
req_class_paths.each do |k, v|
|
232
|
-
sequential_permission_names(clause, "permission[#{v}]", @labels["permission#{k}"])
|
233
|
-
sequential_permission_names(clause, "requirement[#{v}]", @labels["requirement#{k}"])
|
234
|
-
sequential_permission_names(clause, "recommendation[#{v}]", @labels["recommendation#{k}"])
|
235
|
-
end
|
236
|
-
req_class_paths2.each do |k, v|
|
237
|
-
sequential_permission_names(clause, "*[#{v}]", @labels[k])
|
238
|
-
end
|
239
|
-
end
|
240
|
-
|
241
|
-
def hierarchical_asset_names(clause, num)
|
242
|
-
hierarchical_table_names(clause, num)
|
243
|
-
hierarchical_figure_names(clause, num)
|
244
|
-
hierarchical_formula_names(clause, num)
|
245
|
-
req_class_paths.each do |k, v|
|
246
|
-
hierarchical_permission_names(clause, num, "permission[#{v}]", @labels["permission#{k}"])
|
247
|
-
hierarchical_permission_names(clause, num, "requirement[#{v}]", @labels["requirement#{k}"])
|
248
|
-
hierarchical_permission_names(clause, num, "recommendation[#{v}]", @labels["recommendation#{k}"])
|
249
|
-
end
|
250
|
-
req_class_paths2.each do |k, v|
|
251
|
-
hierarchical_permission_names(clause, num, "*[#{v}]", @labels[k])
|
252
|
-
end
|
181
|
+
def requirement_parse(node, out)
|
182
|
+
recommendation_parse0(node, out, "requirement")
|
253
183
|
end
|
254
184
|
|
255
|
-
def
|
256
|
-
|
257
|
-
clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
|
258
|
-
next if t["id"].nil? || t["id"].empty?
|
259
|
-
lbl = "#{num}#{hiersep}#{c.increment(t).print}"
|
260
|
-
@anchors[t["id"]] = anchor_struct(lbl, t, label, klass, t["unnumbered"])
|
261
|
-
sequential_permission_children(t, lbl)
|
262
|
-
end
|
185
|
+
def permission_parse(node, out)
|
186
|
+
recommendation_parse0(node, out, "permission")
|
263
187
|
end
|
264
188
|
end
|
265
189
|
end
|
data/lib/isodoc/ogc/sections.rb
CHANGED
@@ -3,7 +3,7 @@ module IsoDoc
|
|
3
3
|
module BaseConvert
|
4
4
|
def annex_name(annex, name, div)
|
5
5
|
div.h1 **{ class: "Annex" } do |t|
|
6
|
-
t << "#{anchor(annex['id'], :label)} "
|
6
|
+
t << "#{@xrefs.anchor(annex['id'], :label)} "
|
7
7
|
t.br
|
8
8
|
t.b do |b|
|
9
9
|
name&.children&.each { |c2| parse(c2, b) }
|
@@ -24,12 +24,13 @@ module IsoDoc
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
"//bibdata/contributor[role/@type = 'author']/organization/name"
|
27
|
+
def submittingorgs_path
|
28
|
+
"//bibdata/contributor[role/@type = 'author']/organization/name"
|
29
|
+
end
|
29
30
|
|
30
31
|
def submittingorgs(docxml, out)
|
31
32
|
orgs = []
|
32
|
-
docxml.xpath(ns(
|
33
|
+
docxml.xpath(ns(submittingorgs_path)).each { |org| orgs << org.text }
|
33
34
|
return if orgs.empty?
|
34
35
|
@prefacenum += 1
|
35
36
|
out.div **{ class: "Section3" } do |div|
|
@@ -47,7 +48,7 @@ module IsoDoc
|
|
47
48
|
f = docxml.at(ns("//submitters")) || return
|
48
49
|
@prefacenum += 1
|
49
50
|
out.div **{ class: "Section3" } do |div|
|
50
|
-
clause_name(anchor(f['id'], :label), "Submitters", div,
|
51
|
+
clause_name(@xrefs.anchor(f['id'], :label), "Submitters", div,
|
51
52
|
class: "IntroTitle")
|
52
53
|
f.elements.each { |e| parse(e, div) unless e.name == "title" }
|
53
54
|
end
|
@@ -70,7 +71,7 @@ module IsoDoc
|
|
70
71
|
@prefacenum += 1
|
71
72
|
page_break(out)
|
72
73
|
out.div **attr_code(id: f["id"]) do |s|
|
73
|
-
clause_name(anchor(f["id"], :label), @abstract_lbl, s,
|
74
|
+
clause_name(@xrefs.anchor(f["id"], :label), @abstract_lbl, s,
|
74
75
|
class: "AbstractTitle")
|
75
76
|
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
76
77
|
end
|
@@ -81,7 +82,7 @@ module IsoDoc
|
|
81
82
|
@prefacenum += 1
|
82
83
|
page_break(out)
|
83
84
|
out.div **attr_code(id: f["id"]) do |s|
|
84
|
-
clause_name(anchor(f["id"], :label), @foreword_lbl, s,
|
85
|
+
clause_name(@xrefs.anchor(f["id"], :label), @foreword_lbl, s,
|
85
86
|
class: "ForewordTitle")
|
86
87
|
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
87
88
|
end
|
@@ -91,7 +92,7 @@ module IsoDoc
|
|
91
92
|
f = isoxml.at(ns("//acknowledgements")) || return
|
92
93
|
@prefacenum += 1
|
93
94
|
out.div **{ class: "Section3", id: f["id"] } do |div|
|
94
|
-
clause_name(anchor(f["id"], :label), f&.at(ns("./title")), div,
|
95
|
+
clause_name(@xrefs.anchor(f["id"], :label), f&.at(ns("./title")), div,
|
95
96
|
class: "IntroTitle")
|
96
97
|
f.elements.each { |e| parse(e, div) unless e.name == "title" }
|
97
98
|
end
|
@@ -18,9 +18,9 @@ module IsoDoc
|
|
18
18
|
{
|
19
19
|
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
|
20
20
|
'"Times New Roman",serif'),
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
|
22
|
+
'"Times New Roman",serif'),
|
23
|
+
monospacefont: '"Courier New",monospace'
|
24
24
|
}
|
25
25
|
end
|
26
26
|
|
@@ -36,10 +36,6 @@ module IsoDoc
|
|
36
36
|
}
|
37
37
|
end
|
38
38
|
|
39
|
-
def metadata_init(lang, script, labels)
|
40
|
-
@meta = Metadata.new(lang, script, labels)
|
41
|
-
end
|
42
|
-
|
43
39
|
def make_body(xml, docxml)
|
44
40
|
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72" }
|
45
41
|
xml.body **body_attr do |body|
|
@@ -71,15 +67,15 @@ module IsoDoc
|
|
71
67
|
<span lang="EN-GB"><span
|
72
68
|
style='mso-element:field-begin'></span><span
|
73
69
|
style='mso-spacerun:yes'> </span>TOC
|
74
|
-
\\h \\z \\t "RecommendationTitle,
|
75
|
-
style='mso-element:field-separator'></span></span>
|
70
|
+
\\h \\z \\t "RecommendationTitle,recommendationtitle"
|
71
|
+
<span style='mso-element:field-separator'></span></span>
|
76
72
|
TOC
|
77
73
|
|
78
74
|
WORD_TOC_TABLE_PREFACE1 = <<~TOC.freeze
|
79
75
|
<span lang="EN-GB"><span
|
80
76
|
style='mso-element:field-begin'></span><span
|
81
77
|
style='mso-spacerun:yes'> </span>TOC
|
82
|
-
\\h \\z \\t "TableTitle,
|
78
|
+
\\h \\z \\t "TableTitle,tabletitle" <span
|
83
79
|
style='mso-element:field-separator'></span></span>
|
84
80
|
TOC
|
85
81
|
|
@@ -87,7 +83,7 @@ module IsoDoc
|
|
87
83
|
<span lang="EN-GB"><span
|
88
84
|
style='mso-element:field-begin'></span><span
|
89
85
|
style='mso-spacerun:yes'> </span>TOC
|
90
|
-
\\h \\z \\t "FigureTitle,
|
86
|
+
\\h \\z \\t "FigureTitle,figuretitle" <span
|
91
87
|
style='mso-element:field-separator'></span></span>
|
92
88
|
TOC
|
93
89
|
|
@@ -185,11 +181,6 @@ module IsoDoc
|
|
185
181
|
end
|
186
182
|
end
|
187
183
|
|
188
|
-
def authority_cleanup(docxml)
|
189
|
-
docxml&.at("//div[@id = 'boilerplate-contact']")&.remove
|
190
|
-
super
|
191
|
-
end
|
192
|
-
|
193
184
|
include BaseConvert
|
194
185
|
end
|
195
186
|
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module Ogc
|
3
|
+
class Xref < IsoDoc::Xref
|
4
|
+
def initialize(lang, script, klass, labels, options)
|
5
|
+
@reqtlabels = {}
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
def reqtlabels
|
10
|
+
@reqtlabels
|
11
|
+
end
|
12
|
+
|
13
|
+
FIRST_LVL_REQ = IsoDoc::XrefGen::Blocks::FIRST_LVL_REQ
|
14
|
+
|
15
|
+
def sequential_permission_names(clause, klass, label)
|
16
|
+
c = ::IsoDoc::XrefGen::Counter.new
|
17
|
+
clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
|
18
|
+
next if t["id"].nil? || t["id"].empty?
|
19
|
+
id = c.increment(t).print
|
20
|
+
@anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
|
21
|
+
l = t.at(ns("./label"))&.text and @reqtlabels[l] = t["id"]
|
22
|
+
sequential_permission_children(t, id)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def req_class_paths
|
27
|
+
{ "class" => "@type = 'class'",
|
28
|
+
"test" => "@type = 'verification'",
|
29
|
+
"" => "not(@type = 'verification' or @type = 'class' or "\
|
30
|
+
"@type = 'abstracttest' or @type = 'conformanceclass')", }
|
31
|
+
end
|
32
|
+
|
33
|
+
def req_class_paths2
|
34
|
+
{ "abstracttest" => "@type = 'abstracttest'",
|
35
|
+
"conformanceclass" => "@type = 'conformanceclass'", }
|
36
|
+
end
|
37
|
+
|
38
|
+
def sequential_permission_children(t, id)
|
39
|
+
req_class_paths.each do |k, v|
|
40
|
+
%w(permission requirement recommendation).each do |r|
|
41
|
+
sequential_permission_names1(t, id, "#{r}[#{v}]", @labels["#{r}#{k}"])
|
42
|
+
sequential_permission_names1(t, id, "#{r}[#{v}]", @labels["#{r}#{k}"])
|
43
|
+
sequential_permission_names1(t, id, "#{r}[#{v}]", @labels["#{r}#{k}"])
|
44
|
+
end
|
45
|
+
end
|
46
|
+
req_class_paths2.each do |k, v|
|
47
|
+
sequential_permission_names1(t, id, "*[#{v}]", @labels[k])
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def sequential_permission_names1(block, lbl, klass, label)
|
52
|
+
c = ::IsoDoc::XrefGen::Counter.new
|
53
|
+
block.xpath(ns("./#{klass}")).each do |t|
|
54
|
+
next if t["id"].nil? || t["id"].empty?
|
55
|
+
id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
|
56
|
+
@anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
|
57
|
+
sequential_permission_children(t, id)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def sequential_asset_names(clause)
|
62
|
+
sequential_table_names(clause)
|
63
|
+
sequential_figure_names(clause)
|
64
|
+
sequential_formula_names(clause)
|
65
|
+
req_class_paths.each do |k, v|
|
66
|
+
%w(permission requirement recommendation).each do |r|
|
67
|
+
sequential_permission_names(clause, "#{r}[#{v}]", @labels["#{r}#{k}"])
|
68
|
+
sequential_permission_names(clause, "#{r}[#{v}]", @labels["#{r}#{k}"])
|
69
|
+
sequential_permission_names(clause, "#{r}[#{v}]", @labels["#{r}#{k}"])
|
70
|
+
end
|
71
|
+
end
|
72
|
+
req_class_paths2.each do |k, v|
|
73
|
+
sequential_permission_names(clause, "*[#{v}]", @labels[k])
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def hierarchical_asset_names(clause, num)
|
78
|
+
hierarchical_table_names(clause, num)
|
79
|
+
hierarchical_figure_names(clause, num)
|
80
|
+
hierarchical_formula_names(clause, num)
|
81
|
+
req_class_paths.each do |k, v|
|
82
|
+
%w(permission requirement recommendation).each do |r|
|
83
|
+
hierarchical_permission_names(clause, num, "#{r}[#{v}]", @labels["#{r}#{k}"])
|
84
|
+
hierarchical_permission_names(clause, num, "#{r}[#{v}]", @labels["#{r}#{k}"])
|
85
|
+
hierarchical_permission_names(clause, num, "#{r}[#{v}]", @labels["#{r}#{k}"])
|
86
|
+
end
|
87
|
+
end
|
88
|
+
req_class_paths2.each do |k, v|
|
89
|
+
hierarchical_permission_names(clause, num, "*[#{v}]", @labels[k])
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def hierarchical_permission_names(clause, num, klass, label)
|
94
|
+
c = ::IsoDoc::XrefGen::Counter.new
|
95
|
+
clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
|
96
|
+
next if t["id"].nil? || t["id"].empty?
|
97
|
+
lbl = "#{num}#{hiersep}#{c.increment(t).print}"
|
98
|
+
@anchors[t["id"]] = anchor_struct(lbl, t, label, klass, t["unnumbered"])
|
99
|
+
l = t.at(ns("./label"))&.text and @reqtlabels[l] = t["id"]
|
100
|
+
sequential_permission_children(t, lbl)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def initial_anchor_names(d)
|
105
|
+
@prefacenum = 0
|
106
|
+
preface_names_numbered(d.at(ns("//preface/abstract")))
|
107
|
+
@prefacenum += 1 if d.at(ns("//keyword"))
|
108
|
+
preface_names_numbered(d.at(ns("//foreword")))
|
109
|
+
preface_names_numbered(d.at(ns("//introduction")))
|
110
|
+
@prefacenum += 1 if d.at(ns(@klass.submittingorgs_path))
|
111
|
+
preface_names_numbered(d.at(ns("//submitters")))
|
112
|
+
d.xpath(ns("//preface/clause")).each do |c|
|
113
|
+
preface_names_numbered(c)
|
114
|
+
end
|
115
|
+
preface_names_numbered(d.at(ns("//acknowledgements")))
|
116
|
+
sequential_asset_names(d.xpath(ns(
|
117
|
+
"//preface/abstract | //foreword | //introduction | "\
|
118
|
+
"//submitters | //acknowledgements | //preface/clause")))
|
119
|
+
n = section_names(d.at(ns("//clause[title = 'Scope']")), 0, 1)
|
120
|
+
n = section_names(d.at(ns("//clause[title = 'Conformance']")), n, 1)
|
121
|
+
n = section_names(d.at(ns(
|
122
|
+
"//references[title = 'Normative References' or "\
|
123
|
+
"title = 'Normative references']")), n, 1)
|
124
|
+
n = section_names(
|
125
|
+
d.at(ns("//sections/terms | //sections/clause[descendant::terms]")),
|
126
|
+
n, 1)
|
127
|
+
n = section_names(d.at(ns("//sections/definitions")), n, 1)
|
128
|
+
middle_section_asset_names(d)
|
129
|
+
clause_names(d, n)
|
130
|
+
termnote_anchor_names(d)
|
131
|
+
termexample_anchor_names(d)
|
132
|
+
end
|
133
|
+
|
134
|
+
def middle_section_asset_names(d)
|
135
|
+
middle_sections = "//clause[title = 'Scope' or title = 'Conformance'] "\
|
136
|
+
"| //foreword | //introduction | //preface/abstract | "\
|
137
|
+
"//submitters | //acknowledgements | //preface/clause | "\
|
138
|
+
"//references[title = 'Normative References' or title = "\
|
139
|
+
"'Normative references'] | //sections/terms | "\
|
140
|
+
"//sections/definitions | //clause[parent::sections]"
|
141
|
+
sequential_asset_names(d.xpath(ns(middle_sections)))
|
142
|
+
end
|
143
|
+
|
144
|
+
def preface_names_numbered(clause)
|
145
|
+
return if clause.nil?
|
146
|
+
@prefacenum += 1
|
147
|
+
pref = RomanNumerals.to_roman(@prefacenum).downcase
|
148
|
+
@anchors[clause["id"]] =
|
149
|
+
{ label: pref,
|
150
|
+
level: 1, xref: preface_clause_name(clause), type: "clause" }
|
151
|
+
clause.xpath(ns("./clause | ./terms | ./term | ./definitions | "\
|
152
|
+
"./references")).each_with_index do |c, i|
|
153
|
+
section_names1(c, "#{pref}.#{i + 1}", 2)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|