metanorma-ogc 2.0.0 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/ogc/base_convert.rb +5 -3
- data/lib/isodoc/ogc/html/html_ogc_titlepage.html +6 -0
- data/lib/isodoc/ogc/html/htmlstyle.css +18 -17
- data/lib/isodoc/ogc/html/htmlstyle.scss +3 -2
- data/lib/isodoc/ogc/html/ogc.css +1 -2
- data/lib/isodoc/ogc/html/ogc.scss +0 -1
- data/lib/isodoc/ogc/html/ogc_wp.css +1 -2
- data/lib/isodoc/ogc/html/ogc_wp.scss +0 -1
- data/lib/isodoc/ogc/html/word_ogc_titlepage.html +6 -1
- data/lib/isodoc/ogc/html/word_ogc_titlepage_wp.html +6 -1
- data/lib/isodoc/ogc/metadata.rb +3 -0
- data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +2433 -1494
- data/lib/isodoc/ogc/ogc.best-practice.xsl +2433 -1494
- data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +2433 -1494
- data/lib/isodoc/ogc/ogc.community-practice.xsl +2433 -1494
- data/lib/isodoc/ogc/ogc.community-standard.xsl +2433 -1494
- data/lib/isodoc/ogc/ogc.discussion-paper.xsl +2433 -1494
- data/lib/isodoc/ogc/ogc.engineering-report.xsl +2433 -1494
- data/lib/isodoc/ogc/ogc.other.xsl +2433 -1494
- data/lib/isodoc/ogc/ogc.policy.xsl +2433 -1494
- data/lib/isodoc/ogc/ogc.reference-model.xsl +2433 -1494
- data/lib/isodoc/ogc/ogc.release-notes.xsl +2433 -1494
- data/lib/isodoc/ogc/ogc.standard.xsl +2433 -1494
- data/lib/isodoc/ogc/ogc.test-suite.xsl +2433 -1494
- data/lib/isodoc/ogc/ogc.user-guide.xsl +2433 -1494
- data/lib/isodoc/ogc/ogc.white-paper.xsl +2444 -1605
- data/lib/isodoc/ogc/presentation_xml_convert.rb +21 -25
- data/lib/isodoc/ogc/reqt.rb +19 -4
- data/lib/isodoc/ogc/xref.rb +11 -4
- data/lib/metanorma/ogc/basicdoc.rng +5 -3
- data/lib/metanorma/ogc/biblio.rng +7 -5
- data/lib/metanorma/ogc/cleanup.rb +15 -0
- data/lib/metanorma/ogc/front.rb +13 -1
- data/lib/metanorma/ogc/isodoc.rng +142 -4
- data/lib/metanorma/ogc/validate.rb +38 -0
- data/lib/metanorma/ogc/version.rb +1 -1
- metadata +2 -2
@@ -35,8 +35,7 @@ module IsoDoc
|
|
35
35
|
def insert_security(docxml)
|
36
36
|
s = docxml&.at(ns("//preface/clause[@type = 'security']"))&.remove or
|
37
37
|
return
|
38
|
-
if a = submit_orgs_append_pt(docxml)
|
39
|
-
a.next = s
|
38
|
+
if a = submit_orgs_append_pt(docxml) then a.next = s
|
40
39
|
else
|
41
40
|
preface_init_insert_pt(docxml)&.children&.first
|
42
41
|
&.add_previous_sibling(s)
|
@@ -46,8 +45,7 @@ module IsoDoc
|
|
46
45
|
def insert_executivesummary(docxml)
|
47
46
|
s = docxml&.at(ns("//preface/clause[@type = 'executivesummary']"))
|
48
47
|
&.remove or return
|
49
|
-
if a = docxml.at(ns("//preface/abstract"))
|
50
|
-
a.next = s
|
48
|
+
if a = docxml.at(ns("//preface/abstract")) then a.next = s
|
51
49
|
else
|
52
50
|
preface_init_insert_pt(docxml)&.children&.first
|
53
51
|
&.add_previous_sibling(s)
|
@@ -56,9 +54,7 @@ module IsoDoc
|
|
56
54
|
|
57
55
|
def insert_submitting_orgs(docxml)
|
58
56
|
orgs = docxml.xpath(ns(submittingorgs_path))
|
59
|
-
.each_with_object([])
|
60
|
-
m << org.text
|
61
|
-
end
|
57
|
+
.each_with_object([]) { |org, m| m << org.text }
|
62
58
|
return if orgs.empty?
|
63
59
|
|
64
60
|
if a = submit_orgs_append_pt(docxml)
|
@@ -146,9 +142,8 @@ module IsoDoc
|
|
146
142
|
|
147
143
|
def annex1(elem)
|
148
144
|
lbl = @xrefs.anchor(elem["id"], :label)
|
149
|
-
|
145
|
+
t = elem.at(ns("./title")) and
|
150
146
|
t.children = "<strong>#{t.children.to_xml}</strong>"
|
151
|
-
end
|
152
147
|
prefix_name(elem, "<br/>", lbl, "title")
|
153
148
|
end
|
154
149
|
|
@@ -171,7 +166,6 @@ module IsoDoc
|
|
171
166
|
def block(docxml)
|
172
167
|
super
|
173
168
|
recommendation_to_table(docxml)
|
174
|
-
ol docxml
|
175
169
|
end
|
176
170
|
|
177
171
|
def section(docxml)
|
@@ -188,6 +182,14 @@ module IsoDoc
|
|
188
182
|
end
|
189
183
|
end
|
190
184
|
|
185
|
+
def bibdata(docxml)
|
186
|
+
docxml.xpath(ns("//bibdata/contributor[@type = 'author']")).each do |a|
|
187
|
+
a.at(ns("./description"))&.text == "contributor" and
|
188
|
+
a["type"] = "contributor"
|
189
|
+
end
|
190
|
+
super
|
191
|
+
end
|
192
|
+
|
191
193
|
def bibdata_i18n(bib)
|
192
194
|
doctype = bib&.at(ns("./ext/doctype"))
|
193
195
|
rename_stage(bib&.at(ns("./status/stage")), doctype, bib)
|
@@ -197,31 +199,25 @@ module IsoDoc
|
|
197
199
|
end
|
198
200
|
|
199
201
|
def rename_stage(stage, doctype, _bib)
|
200
|
-
|
201
|
-
|
202
|
-
|
202
|
+
stage&.text == "approved" &&
|
203
|
+
!%w(standard abstract-specification-topic
|
204
|
+
community-standard).include?(doctype&.text) and
|
203
205
|
stage.children = "published"
|
204
|
-
end
|
205
206
|
end
|
206
207
|
|
207
208
|
def rename_doctype(doctype, date)
|
208
209
|
return unless doctype&.text == "white-paper" && date
|
209
210
|
|
210
|
-
|
211
|
+
Date.iso8601(date.text) >= Date.iso8601("2021-12-16") and
|
211
212
|
doctype.children = "technical-paper"
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
def ol(docxml)
|
216
|
-
docxml.xpath(ns("//ol")).each { |f| ol1(f) }
|
217
213
|
end
|
218
214
|
|
219
|
-
def
|
220
|
-
return unless
|
215
|
+
def ol_depth(node)
|
216
|
+
return super unless node["class"] == "steps" ||
|
217
|
+
node.at(".//ancestor::xmlns:ol[@class = 'steps']")
|
221
218
|
|
222
|
-
idx =
|
223
|
-
|
224
|
-
roman_upper)[(idx - 1) % 5]
|
219
|
+
idx = node.xpath("./ancestor-or-self::xmlns:ol[@class = 'steps']").size
|
220
|
+
%i(arabic alphabet roman alphabet_upper roman_upper)[(idx - 1) % 5]
|
225
221
|
end
|
226
222
|
|
227
223
|
def termsource1(elem)
|
data/lib/isodoc/ogc/reqt.rb
CHANGED
@@ -33,9 +33,8 @@ module IsoDoc
|
|
33
33
|
|
34
34
|
def recommendation_name(node, out)
|
35
35
|
b = out.add_child("<p class='#{recommendation_class(node)}'></p>").first
|
36
|
-
|
36
|
+
name = node&.at(ns("./name"))&.remove and
|
37
37
|
name.children.each { |n| b << n }
|
38
|
-
end
|
39
38
|
if title = node&.at(ns("./title"))&.remove
|
40
39
|
b << l10n(": ") if name
|
41
40
|
title.children.each { |n| b << n }
|
@@ -49,6 +48,7 @@ module IsoDoc
|
|
49
48
|
label.xpath(ns(".//concept")).each { |f| concept1(f) }
|
50
49
|
b = out.add_child("<tr><td colspan='2'><p></p></td></tr>")
|
51
50
|
p = b.at(ns(".//p"))
|
51
|
+
p["class"] = "RecommendationLabel"
|
52
52
|
p << label.children.to_xml
|
53
53
|
end
|
54
54
|
|
@@ -64,6 +64,9 @@ module IsoDoc
|
|
64
64
|
oblig = node["obligation"] and out << ["Obligation", oblig]
|
65
65
|
subj = node&.at(ns("./subject"))&.remove&.children and
|
66
66
|
out << [rec_subj(node), subj]
|
67
|
+
%w(general class).include?(node["type_original"]) and
|
68
|
+
test = @reqt_links[node["id"]] and
|
69
|
+
out << ["Conformance test", "<xref target='#{test}'/>"]
|
67
70
|
node.xpath(ns("./inherit")).each do |i|
|
68
71
|
out << ["Dependency", i.remove.children]
|
69
72
|
end
|
@@ -75,7 +78,8 @@ module IsoDoc
|
|
75
78
|
return node unless node.at(ns("./component[@class = 'step']"))
|
76
79
|
|
77
80
|
d = node.at(ns("./component[@class = 'step']"))
|
78
|
-
d = d.replace("<ol class='steps'><li>#{d.children.to_xml}</li></ol>")
|
81
|
+
d = d.replace("<ol class='steps'><li>#{d.children.to_xml}</li></ol>")
|
82
|
+
.first
|
79
83
|
node.xpath(ns("./component[@class = 'step']")).each do |f|
|
80
84
|
f = f.replace("<li>#{f.children.to_xml}</li>").first
|
81
85
|
d << f
|
@@ -100,7 +104,7 @@ module IsoDoc
|
|
100
104
|
def recommendation_attr_keyvalue(node, key, value)
|
101
105
|
tag = node&.at(ns("./#{key}"))&.remove
|
102
106
|
value = node.at(ns("./#{value}"))&.remove
|
103
|
-
tag && value or return nil
|
107
|
+
(tag && value) or return nil
|
104
108
|
node.remove
|
105
109
|
[tag.text.capitalize, value.children]
|
106
110
|
end
|
@@ -177,6 +181,7 @@ module IsoDoc
|
|
177
181
|
end
|
178
182
|
|
179
183
|
def recommendation_to_table(docxml)
|
184
|
+
@reqt_links = reqt_links(docxml)
|
180
185
|
docxml.xpath(ns("//recommendation")).each do |r|
|
181
186
|
recommendation_parse1(r, "recommendation")
|
182
187
|
end
|
@@ -189,6 +194,16 @@ module IsoDoc
|
|
189
194
|
requirement_table_cleanup(docxml)
|
190
195
|
end
|
191
196
|
|
197
|
+
def reqt_links(docxml)
|
198
|
+
docxml.xpath(ns("//requirement | //recommendation | //permission"))
|
199
|
+
.each_with_object({}) do |r, m|
|
200
|
+
next unless %w(conformanceclass verification).include?(r["type"])
|
201
|
+
next unless subject = r&.at(ns("./subject/xref/@target"))&.text
|
202
|
+
|
203
|
+
m[subject] = r["id"]
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
192
207
|
# table nested in table: merge label and caption into a single row
|
193
208
|
def requirement_table_cleanup1(outer, inner)
|
194
209
|
outer.delete("colspan")
|
data/lib/isodoc/ogc/xref.rb
CHANGED
@@ -23,7 +23,7 @@ module IsoDoc
|
|
23
23
|
id = c.increment(t).print
|
24
24
|
@anchors[t["id"]] = anchor_struct(id, t, label, klass,
|
25
25
|
t["unnumbered"])
|
26
|
-
|
26
|
+
reqt_suffix_label(t)
|
27
27
|
permission_parts(t, label, klass)
|
28
28
|
sequential_permission_children(t, id)
|
29
29
|
end
|
@@ -41,6 +41,13 @@ module IsoDoc
|
|
41
41
|
"conformanceclass" => "@type = 'conformanceclass'" }
|
42
42
|
end
|
43
43
|
|
44
|
+
def reqt_suffix_label(reqt)
|
45
|
+
if l = reqt.at(ns("./label"))&.text
|
46
|
+
@reqtlabels[l] = reqt["id"]
|
47
|
+
@anchors[reqt["id"]][:xref] += ": <tt>#{l}</tt>"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
44
51
|
def permission_parts(block, label, klass)
|
45
52
|
block.xpath(ns("./component[@class = 'part']"))
|
46
53
|
.each_with_index do |c, i|
|
@@ -116,7 +123,7 @@ module IsoDoc
|
|
116
123
|
lbl = "#{num}#{hiersep}#{c.increment(t).print}"
|
117
124
|
@anchors[t["id"]] = anchor_struct(lbl, t, label, klass,
|
118
125
|
t["unnumbered"])
|
119
|
-
|
126
|
+
reqt_suffix_label(t)
|
120
127
|
permission_parts(t, label, klass)
|
121
128
|
sequential_permission_children(t, lbl)
|
122
129
|
end
|
@@ -175,7 +182,7 @@ module IsoDoc
|
|
175
182
|
@prefacenum += 1
|
176
183
|
pref = preface_number(@prefacenum, 1)
|
177
184
|
@anchors[clause["id"]] =
|
178
|
-
{ label: pref,
|
185
|
+
{ label: pref,
|
179
186
|
level: 1, xref: preface_clause_name(clause), type: "clause" }
|
180
187
|
clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
|
181
188
|
preface_names_numbered1(c, "#{pref}.#{preface_number(i + 1, 2)}", 2)
|
@@ -185,7 +192,7 @@ module IsoDoc
|
|
185
192
|
def preface_names_numbered1(clause, num, level)
|
186
193
|
@anchors[clause["id"]] =
|
187
194
|
{ label: num, level: level, xref: l10n("#{@labels['clause']} #{num}"),
|
188
|
-
type: "clause" }
|
195
|
+
type: "clause", elem: @labels["clause"] }
|
189
196
|
clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
|
190
197
|
lbl = "#{num}.#{preface_number(i + 1, level + 1)}"
|
191
198
|
preface_names_numbered1(c, lbl, level + 1)
|
@@ -173,9 +173,11 @@
|
|
173
173
|
<data type="dateTime"/>
|
174
174
|
</attribute>
|
175
175
|
</optional>
|
176
|
-
<
|
177
|
-
<
|
178
|
-
|
176
|
+
<optional>
|
177
|
+
<attribute name="from">
|
178
|
+
<data type="IDREF"/>
|
179
|
+
</attribute>
|
180
|
+
</optional>
|
179
181
|
<optional>
|
180
182
|
<attribute name="to">
|
181
183
|
<data type="IDREF"/>
|
@@ -209,9 +209,6 @@
|
|
209
209
|
<zeroOrMore>
|
210
210
|
<ref name="contact"/>
|
211
211
|
</zeroOrMore>
|
212
|
-
<zeroOrMore>
|
213
|
-
<ref name="uri"/>
|
214
|
-
</zeroOrMore>
|
215
212
|
</element>
|
216
213
|
</define>
|
217
214
|
<define name="fullname">
|
@@ -401,9 +398,9 @@
|
|
401
398
|
<choice>
|
402
399
|
<!-- iso191606 TODO -->
|
403
400
|
<group>
|
404
|
-
<
|
401
|
+
<zeroOrMore>
|
405
402
|
<ref name="street"/>
|
406
|
-
</
|
403
|
+
</zeroOrMore>
|
407
404
|
<ref name="city"/>
|
408
405
|
<optional>
|
409
406
|
<ref name="state"/>
|
@@ -828,6 +825,11 @@
|
|
828
825
|
<optional>
|
829
826
|
<attribute name="scope"/>
|
830
827
|
</optional>
|
828
|
+
<optional>
|
829
|
+
<attribute name="primary">
|
830
|
+
<data type="boolean"/>
|
831
|
+
</attribute>
|
832
|
+
</optional>
|
831
833
|
<text/>
|
832
834
|
</element>
|
833
835
|
</define>
|
@@ -211,6 +211,21 @@ module Metanorma
|
|
211
211
|
o = r&.at("./ancestor::*/@obligation")&.text and r["obligation"] = o
|
212
212
|
end
|
213
213
|
end
|
214
|
+
|
215
|
+
def sections_order_cleanup(xml)
|
216
|
+
super
|
217
|
+
sort_annexes(xml)
|
218
|
+
end
|
219
|
+
|
220
|
+
def sort_annexes(xml)
|
221
|
+
last = xml.at("//annex[last()]") or return
|
222
|
+
last.next = "<sentinel/>" and last = last.next_element
|
223
|
+
gl = xml.at("//annex[.//term]") and last.previous = gl.remove
|
224
|
+
rev = xml.at("//annex[title[normalize-space(.) = 'Revision history']]") ||
|
225
|
+
xml.at("//annex[title[normalize-space(.) = 'Revision History']]") and
|
226
|
+
last.previous = rev.remove
|
227
|
+
last.remove
|
228
|
+
end
|
214
229
|
end
|
215
230
|
end
|
216
231
|
end
|
data/lib/metanorma/ogc/front.rb
CHANGED
@@ -36,6 +36,18 @@ module Metanorma
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
def personal_role(node, contrib, suffix)
|
40
|
+
type = node.attr("role#{suffix}")&.downcase || "editor"
|
41
|
+
if type == "contributor"
|
42
|
+
contrib.role **{ type: "author" } do |r|
|
43
|
+
r.description do |d|
|
44
|
+
d << type
|
45
|
+
end
|
46
|
+
end
|
47
|
+
else contrib.role **{ type: type }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
39
51
|
def ogc_editor(node, xml)
|
40
52
|
return unless node.attr("editor")
|
41
53
|
|
@@ -51,7 +63,7 @@ module Metanorma
|
|
51
63
|
|
52
64
|
def personal_author1(node, xml, suffix)
|
53
65
|
xml.contributor do |c|
|
54
|
-
c
|
66
|
+
personal_role(node, c, suffix)
|
55
67
|
c.person do |p|
|
56
68
|
p.name do |n|
|
57
69
|
if node.attr("fullname#{suffix}")
|
@@ -32,6 +32,43 @@
|
|
32
32
|
<ref name="DocumentType"/>
|
33
33
|
</element>
|
34
34
|
</define>
|
35
|
+
<define name="index">
|
36
|
+
<element name="index">
|
37
|
+
<optional>
|
38
|
+
<attribute name="to">
|
39
|
+
<data type="IDREF"/>
|
40
|
+
</attribute>
|
41
|
+
</optional>
|
42
|
+
<element name="primary">
|
43
|
+
<oneOrMore>
|
44
|
+
<choice>
|
45
|
+
<ref name="PureTextElement"/>
|
46
|
+
<ref name="stem"/>
|
47
|
+
</choice>
|
48
|
+
</oneOrMore>
|
49
|
+
</element>
|
50
|
+
<optional>
|
51
|
+
<element name="secondary">
|
52
|
+
<oneOrMore>
|
53
|
+
<choice>
|
54
|
+
<ref name="PureTextElement"/>
|
55
|
+
<ref name="stem"/>
|
56
|
+
</choice>
|
57
|
+
</oneOrMore>
|
58
|
+
</element>
|
59
|
+
</optional>
|
60
|
+
<optional>
|
61
|
+
<element name="tertiary">
|
62
|
+
<oneOrMore>
|
63
|
+
<choice>
|
64
|
+
<ref name="PureTextElement"/>
|
65
|
+
<ref name="stem"/>
|
66
|
+
</choice>
|
67
|
+
</oneOrMore>
|
68
|
+
</element>
|
69
|
+
</optional>
|
70
|
+
</element>
|
71
|
+
</define>
|
35
72
|
<define name="bibitem">
|
36
73
|
<element name="bibitem">
|
37
74
|
<attribute name="id">
|
@@ -115,9 +152,7 @@
|
|
115
152
|
<data type="boolean"/>
|
116
153
|
</attribute>
|
117
154
|
</optional>
|
118
|
-
<
|
119
|
-
<ref name="PureTextElement"/>
|
120
|
-
</oneOrMore>
|
155
|
+
<ref name="XrefBody"/>
|
121
156
|
</element>
|
122
157
|
</define>
|
123
158
|
<define name="erefType">
|
@@ -151,6 +186,42 @@
|
|
151
186
|
<ref name="PureTextElement"/>
|
152
187
|
</oneOrMore>
|
153
188
|
</define>
|
189
|
+
<define name="localityStack">
|
190
|
+
<element name="localityStack">
|
191
|
+
<optional>
|
192
|
+
<attribute name="connective">
|
193
|
+
<choice>
|
194
|
+
<value>and</value>
|
195
|
+
<value>or</value>
|
196
|
+
<value>from</value>
|
197
|
+
<value>to</value>
|
198
|
+
<value/>
|
199
|
+
</choice>
|
200
|
+
</attribute>
|
201
|
+
</optional>
|
202
|
+
<zeroOrMore>
|
203
|
+
<ref name="locality"/>
|
204
|
+
</zeroOrMore>
|
205
|
+
</element>
|
206
|
+
</define>
|
207
|
+
<define name="sourceLocalityStack">
|
208
|
+
<element name="sourceLocalityStack">
|
209
|
+
<optional>
|
210
|
+
<attribute name="connective">
|
211
|
+
<choice>
|
212
|
+
<value>and</value>
|
213
|
+
<value>or</value>
|
214
|
+
<value>from</value>
|
215
|
+
<value>to</value>
|
216
|
+
<value/>
|
217
|
+
</choice>
|
218
|
+
</attribute>
|
219
|
+
</optional>
|
220
|
+
<zeroOrMore>
|
221
|
+
<ref name="sourceLocality"/>
|
222
|
+
</zeroOrMore>
|
223
|
+
</element>
|
224
|
+
</define>
|
154
225
|
<define name="ul">
|
155
226
|
<element name="ul">
|
156
227
|
<attribute name="id">
|
@@ -1027,6 +1098,26 @@
|
|
1027
1098
|
</zeroOrMore>
|
1028
1099
|
</element>
|
1029
1100
|
</define>
|
1101
|
+
<define name="sub">
|
1102
|
+
<element name="sub">
|
1103
|
+
<zeroOrMore>
|
1104
|
+
<choice>
|
1105
|
+
<ref name="PureTextElement"/>
|
1106
|
+
<ref name="stem"/>
|
1107
|
+
</choice>
|
1108
|
+
</zeroOrMore>
|
1109
|
+
</element>
|
1110
|
+
</define>
|
1111
|
+
<define name="sup">
|
1112
|
+
<element name="sup">
|
1113
|
+
<zeroOrMore>
|
1114
|
+
<choice>
|
1115
|
+
<ref name="PureTextElement"/>
|
1116
|
+
<ref name="stem"/>
|
1117
|
+
</choice>
|
1118
|
+
</zeroOrMore>
|
1119
|
+
</element>
|
1120
|
+
</define>
|
1030
1121
|
<define name="pagebreak">
|
1031
1122
|
<element name="pagebreak">
|
1032
1123
|
<optional>
|
@@ -1041,6 +1132,16 @@
|
|
1041
1132
|
</define>
|
1042
1133
|
</include>
|
1043
1134
|
<!-- end overrides -->
|
1135
|
+
<define name="image" combine="choice">
|
1136
|
+
<element name="svg">
|
1137
|
+
<oneOrMore>
|
1138
|
+
<choice>
|
1139
|
+
<text/>
|
1140
|
+
<ref name="AnyElement"/>
|
1141
|
+
</choice>
|
1142
|
+
</oneOrMore>
|
1143
|
+
</element>
|
1144
|
+
</define>
|
1044
1145
|
<define name="MultilingualRenderingType">
|
1045
1146
|
<choice>
|
1046
1147
|
<value>common</value>
|
@@ -2216,7 +2317,18 @@
|
|
2216
2317
|
<ref name="MultilingualRenderingType"/>
|
2217
2318
|
</attribute>
|
2218
2319
|
</optional>
|
2219
|
-
<
|
2320
|
+
<oneOrMore>
|
2321
|
+
<choice>
|
2322
|
+
<ref name="formula"/>
|
2323
|
+
<ref name="ul"/>
|
2324
|
+
<ref name="ol"/>
|
2325
|
+
<ref name="dl"/>
|
2326
|
+
<ref name="quote"/>
|
2327
|
+
<ref name="sourcecode"/>
|
2328
|
+
<ref name="paragraph"/>
|
2329
|
+
<ref name="figure"/>
|
2330
|
+
</choice>
|
2331
|
+
</oneOrMore>
|
2220
2332
|
</element>
|
2221
2333
|
</define>
|
2222
2334
|
<define name="termsource">
|
@@ -2563,4 +2675,30 @@
|
|
2563
2675
|
</zeroOrMore>
|
2564
2676
|
</element>
|
2565
2677
|
</define>
|
2678
|
+
<define name="XrefBody">
|
2679
|
+
<zeroOrMore>
|
2680
|
+
<ref name="XrefTarget"/>
|
2681
|
+
</zeroOrMore>
|
2682
|
+
<oneOrMore>
|
2683
|
+
<ref name="PureTextElement"/>
|
2684
|
+
</oneOrMore>
|
2685
|
+
</define>
|
2686
|
+
<define name="XrefTarget">
|
2687
|
+
<element name="location">
|
2688
|
+
<attribute name="target">
|
2689
|
+
<data type="string">
|
2690
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
2691
|
+
</data>
|
2692
|
+
</attribute>
|
2693
|
+
<attribute name="connective">
|
2694
|
+
<choice>
|
2695
|
+
<value>and</value>
|
2696
|
+
<value>or</value>
|
2697
|
+
<value>from</value>
|
2698
|
+
<value>to</value>
|
2699
|
+
<value/>
|
2700
|
+
</choice>
|
2701
|
+
</attribute>
|
2702
|
+
</element>
|
2703
|
+
</define>
|
2566
2704
|
</grammar>
|
@@ -14,6 +14,44 @@ module Metanorma
|
|
14
14
|
def content_validate(doc)
|
15
15
|
super
|
16
16
|
bibdata_validate(doc.root)
|
17
|
+
reqt_link_validate(doc.root)
|
18
|
+
end
|
19
|
+
|
20
|
+
def reqt_link_validate(docxml)
|
21
|
+
ids = reqt_links(docxml)
|
22
|
+
reqt_to_conformance(ids, "general", "verification", "Requirement",
|
23
|
+
"Conformance test")
|
24
|
+
reqt_to_conformance(ids, "class", "conformanceclass",
|
25
|
+
"Requirement class", "Conformance class test")
|
26
|
+
conformance_to_reqt(ids, "general", "verification", "Requirement",
|
27
|
+
"Conformance test")
|
28
|
+
conformance_to_reqt(ids, "class", "conformanceclass",
|
29
|
+
"Requirement class", "Conformance class test")
|
30
|
+
end
|
31
|
+
|
32
|
+
def reqt_to_conformance(ids, reqtclass, confclass, reqtlabel, conflabel)
|
33
|
+
ids[reqtclass]&.each do |r|
|
34
|
+
ids[confclass]&.any? { |x| x[:subject] == r[:id] } or
|
35
|
+
@log.add("Requirements", r[:elem],
|
36
|
+
"#{reqtlabel} #{r[:id]} has no corresponding #{conflabel}")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def conformance_to_reqt(ids, reqtclass, confclass, reqtlabel, conflabel)
|
41
|
+
ids[confclass]&.each do |x|
|
42
|
+
ids[reqtclass]&.any? { |r| x[:subject] == r[:id] } or
|
43
|
+
@log.add("Requirements", x[:elem],
|
44
|
+
"#{conflabel} #{x[:id]} has no corresponding #{reqtlabel}")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def reqt_links(docxml)
|
49
|
+
docxml.xpath("//requirement | //recommendation | //permission")
|
50
|
+
.each_with_object({}) do |r, m|
|
51
|
+
m[r["type"]] ||= []
|
52
|
+
m[r["type"]] << { id: r["id"], elem: r,
|
53
|
+
subject: r&.at("./subject/xref/@target")&.text }
|
54
|
+
end
|
17
55
|
end
|
18
56
|
|
19
57
|
def bibdata_validate(doc)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-ogc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: iso-639
|