metanorma-ogc 1.5.5 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +4 -32
- data/.gitignore +11 -0
- data/Gemfile +0 -2
- data/lib/isodoc/ogc/base_convert.rb +1 -1
- data/lib/isodoc/ogc/biblio.rb +7 -6
- data/lib/isodoc/ogc/html/html_ogc_titlepage.html +6 -0
- data/lib/isodoc/ogc/html/htmlstyle.css +23 -17
- data/lib/isodoc/ogc/html/htmlstyle.scss +10 -3
- 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 +2393 -1611
- data/lib/isodoc/ogc/ogc.best-practice.xsl +2393 -1611
- data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +2393 -1611
- data/lib/isodoc/ogc/ogc.community-practice.xsl +2393 -1611
- data/lib/isodoc/ogc/ogc.community-standard.xsl +2393 -1611
- data/lib/isodoc/ogc/ogc.discussion-paper.xsl +2393 -1611
- data/lib/isodoc/ogc/ogc.engineering-report.xsl +2393 -1611
- data/lib/isodoc/ogc/ogc.other.xsl +2393 -1611
- data/lib/isodoc/ogc/ogc.policy.xsl +2393 -1611
- data/lib/isodoc/ogc/ogc.reference-model.xsl +2393 -1611
- data/lib/isodoc/ogc/ogc.release-notes.xsl +2393 -1611
- data/lib/isodoc/ogc/ogc.standard.xsl +2393 -1611
- data/lib/isodoc/ogc/ogc.test-suite.xsl +2393 -1611
- data/lib/isodoc/ogc/ogc.user-guide.xsl +2393 -1611
- data/lib/isodoc/ogc/ogc.white-paper.xsl +2336 -1592
- data/lib/isodoc/ogc/presentation_xml_convert.rb +26 -27
- data/lib/isodoc/ogc/reqt.rb +17 -3
- data/lib/{asciidoctor → metanorma}/ogc/basicdoc.rng +5 -3
- data/lib/{asciidoctor → metanorma}/ogc/biblio.rng +7 -5
- data/lib/{asciidoctor → metanorma}/ogc/boilerplate.xml +0 -0
- data/lib/{asciidoctor → metanorma}/ogc/cleanup.rb +28 -1
- data/lib/{asciidoctor → metanorma}/ogc/converter.rb +12 -2
- data/lib/{asciidoctor → metanorma}/ogc/front.rb +15 -3
- data/lib/{asciidoctor → metanorma}/ogc/isodoc.rng +98 -1
- data/lib/{asciidoctor → metanorma}/ogc/ogc.rng +0 -0
- data/lib/{asciidoctor → metanorma}/ogc/reqt.rng +0 -0
- data/lib/{asciidoctor → metanorma}/ogc/validate.rb +39 -1
- data/lib/metanorma/ogc/version.rb +1 -1
- data/lib/metanorma/ogc.rb +1 -0
- data/lib/metanorma-ogc.rb +0 -1
- data/metanorma-ogc.gemspec +1 -1
- metadata +14 -15
- data/lib/asciidoctor/ogc.rb +0 -6
@@ -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,33 +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
213
|
end
|
214
214
|
|
215
|
-
def
|
216
|
-
|
217
|
-
|
218
|
-
end
|
219
|
-
end
|
215
|
+
def ol_depth(node)
|
216
|
+
return super unless node["class"] == "steps" ||
|
217
|
+
node.at(".//ancestor::xmlns:ol[@class = 'steps']")
|
220
218
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
idx = elem.xpath("./ancestor-or-self::xmlns:ol[@class = 'steps']").size
|
225
|
-
elem["type"] = %w(arabic alphabet roman alphabet_upper
|
226
|
-
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]
|
227
221
|
end
|
228
222
|
|
229
223
|
def termsource1(elem)
|
@@ -234,6 +228,11 @@ module IsoDoc
|
|
234
228
|
"#{elem.children.to_xml.strip}]")
|
235
229
|
end
|
236
230
|
|
231
|
+
def bibliography_bibitem_number_skip(bibitem)
|
232
|
+
@xrefs.klass.implicit_reference(bibitem) ||
|
233
|
+
bibitem.at(ns(".//docidentifier[@type = 'metanorma-ordinal']"))
|
234
|
+
end
|
235
|
+
|
237
236
|
include Init
|
238
237
|
end
|
239
238
|
end
|
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 }
|
@@ -64,6 +63,9 @@ module IsoDoc
|
|
64
63
|
oblig = node["obligation"] and out << ["Obligation", oblig]
|
65
64
|
subj = node&.at(ns("./subject"))&.remove&.children and
|
66
65
|
out << [rec_subj(node), subj]
|
66
|
+
%w(general class).include?(node["type_original"]) and
|
67
|
+
test = @reqt_links[node["id"]] and
|
68
|
+
out << ["Conformance test", "<xref target='#{test}'/>"]
|
67
69
|
node.xpath(ns("./inherit")).each do |i|
|
68
70
|
out << ["Dependency", i.remove.children]
|
69
71
|
end
|
@@ -75,7 +77,8 @@ module IsoDoc
|
|
75
77
|
return node unless node.at(ns("./component[@class = 'step']"))
|
76
78
|
|
77
79
|
d = node.at(ns("./component[@class = 'step']"))
|
78
|
-
d = d.replace("<ol class='steps'><li>#{d.children.to_xml}</li></ol>")
|
80
|
+
d = d.replace("<ol class='steps'><li>#{d.children.to_xml}</li></ol>")
|
81
|
+
.first
|
79
82
|
node.xpath(ns("./component[@class = 'step']")).each do |f|
|
80
83
|
f = f.replace("<li>#{f.children.to_xml}</li>").first
|
81
84
|
d << f
|
@@ -177,6 +180,7 @@ module IsoDoc
|
|
177
180
|
end
|
178
181
|
|
179
182
|
def recommendation_to_table(docxml)
|
183
|
+
@reqt_links = reqt_links(docxml)
|
180
184
|
docxml.xpath(ns("//recommendation")).each do |r|
|
181
185
|
recommendation_parse1(r, "recommendation")
|
182
186
|
end
|
@@ -189,6 +193,16 @@ module IsoDoc
|
|
189
193
|
requirement_table_cleanup(docxml)
|
190
194
|
end
|
191
195
|
|
196
|
+
def reqt_links(docxml)
|
197
|
+
docxml.xpath(ns("//requirement | //recommendation | //permission"))
|
198
|
+
.each_with_object({}) do |r, m|
|
199
|
+
next unless %w(conformanceclass verification).include?(r["type"])
|
200
|
+
next unless subject = r&.at(ns("./subject/xref/@target"))&.text
|
201
|
+
|
202
|
+
m[subject] = r["id"]
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
192
206
|
# table nested in table: merge label and caption into a single row
|
193
207
|
def requirement_table_cleanup1(outer, inner)
|
194
208
|
outer.delete("colspan")
|
@@ -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>
|
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Metanorma
|
2
2
|
module Ogc
|
3
3
|
class Converter < Standoc::Converter
|
4
4
|
def sections_cleanup(xml)
|
@@ -199,6 +199,33 @@ module Asciidoctor
|
|
199
199
|
end
|
200
200
|
super
|
201
201
|
end
|
202
|
+
|
203
|
+
def obligations_cleanup_inherit(xml)
|
204
|
+
xml.xpath("//annex").each do |r|
|
205
|
+
r["obligation"] = "informative" unless r["obligation"]
|
206
|
+
end
|
207
|
+
xml.xpath("//clause[not(ancestor::boilerplate)]").each do |r|
|
208
|
+
r["obligation"] = "normative" unless r["obligation"]
|
209
|
+
end
|
210
|
+
xml.xpath(::Metanorma::Standoc::Utils::SUBCLAUSE_XPATH).each do |r|
|
211
|
+
o = r&.at("./ancestor::*/@obligation")&.text and r["obligation"] = o
|
212
|
+
end
|
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
|
202
229
|
end
|
203
230
|
end
|
204
231
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require "asciidoctor"
|
2
|
-
require "
|
2
|
+
require "metanorma/standoc/converter"
|
3
3
|
require "fileutils"
|
4
4
|
require_relative "front"
|
5
5
|
require_relative "validate"
|
6
6
|
require_relative "cleanup"
|
7
7
|
|
8
|
-
module
|
8
|
+
module Metanorma
|
9
9
|
module Ogc
|
10
10
|
# A {Converter} implementation that generates RSD output, and a document
|
11
11
|
# schema encapsulation of the document for validation
|
@@ -134,6 +134,16 @@ module Asciidoctor
|
|
134
134
|
super
|
135
135
|
end
|
136
136
|
|
137
|
+
def set_obligation(attrs, node)
|
138
|
+
if node.attr("style") == "appendix" && node.level == 1
|
139
|
+
attrs[:obligation] = if node.attributes.has_key?("obligation")
|
140
|
+
node.attr("obligation")
|
141
|
+
else "informative"
|
142
|
+
end
|
143
|
+
else super
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
137
147
|
def presentation_xml_converter(node)
|
138
148
|
IsoDoc::Ogc::PresentationXMLConvert.new(html_extract_attributes(node))
|
139
149
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require "asciidoctor"
|
2
|
-
require "
|
2
|
+
require "metanorma/standoc/converter"
|
3
3
|
require "fileutils"
|
4
4
|
|
5
|
-
module
|
5
|
+
module Metanorma
|
6
6
|
module Ogc
|
7
7
|
class Converter < Standoc::Converter
|
8
8
|
def metadata_author(node, xml)
|
@@ -36,6 +36,18 @@ module Asciidoctor
|
|
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 Asciidoctor
|
|
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,56 @@
|
|
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>
|
72
|
+
<define name="bibitem">
|
73
|
+
<element name="bibitem">
|
74
|
+
<attribute name="id">
|
75
|
+
<data type="ID"/>
|
76
|
+
</attribute>
|
77
|
+
<optional>
|
78
|
+
<attribute name="hidden">
|
79
|
+
<data type="boolean"/>
|
80
|
+
</attribute>
|
81
|
+
</optional>
|
82
|
+
<ref name="BibliographicItem"/>
|
83
|
+
</element>
|
84
|
+
</define>
|
35
85
|
<define name="section-title">
|
36
86
|
<element name="title">
|
37
87
|
<zeroOrMore>
|
@@ -690,6 +740,7 @@
|
|
690
740
|
<ref name="terms"/>
|
691
741
|
<ref name="term-clause"/>
|
692
742
|
<ref name="definitions"/>
|
743
|
+
<ref name="floating-title"/>
|
693
744
|
</choice>
|
694
745
|
</oneOrMore>
|
695
746
|
</element>
|
@@ -1013,6 +1064,26 @@
|
|
1013
1064
|
</zeroOrMore>
|
1014
1065
|
</element>
|
1015
1066
|
</define>
|
1067
|
+
<define name="sub">
|
1068
|
+
<element name="sub">
|
1069
|
+
<zeroOrMore>
|
1070
|
+
<choice>
|
1071
|
+
<ref name="PureTextElement"/>
|
1072
|
+
<ref name="stem"/>
|
1073
|
+
</choice>
|
1074
|
+
</zeroOrMore>
|
1075
|
+
</element>
|
1076
|
+
</define>
|
1077
|
+
<define name="sup">
|
1078
|
+
<element name="sup">
|
1079
|
+
<zeroOrMore>
|
1080
|
+
<choice>
|
1081
|
+
<ref name="PureTextElement"/>
|
1082
|
+
<ref name="stem"/>
|
1083
|
+
</choice>
|
1084
|
+
</zeroOrMore>
|
1085
|
+
</element>
|
1086
|
+
</define>
|
1016
1087
|
<define name="pagebreak">
|
1017
1088
|
<element name="pagebreak">
|
1018
1089
|
<optional>
|
@@ -1680,6 +1751,7 @@
|
|
1680
1751
|
<ref name="clause-subsection"/>
|
1681
1752
|
<ref name="terms"/>
|
1682
1753
|
<ref name="definitions"/>
|
1754
|
+
<ref name="floating-title"/>
|
1683
1755
|
</choice>
|
1684
1756
|
</oneOrMore>
|
1685
1757
|
</choice>
|
@@ -1722,6 +1794,7 @@
|
|
1722
1794
|
<ref name="terms"/>
|
1723
1795
|
<ref name="definitions"/>
|
1724
1796
|
<ref name="references"/>
|
1797
|
+
<ref name="floating-title"/>
|
1725
1798
|
</choice>
|
1726
1799
|
</zeroOrMore>
|
1727
1800
|
</group>
|
@@ -2200,7 +2273,18 @@
|
|
2200
2273
|
<ref name="MultilingualRenderingType"/>
|
2201
2274
|
</attribute>
|
2202
2275
|
</optional>
|
2203
|
-
<
|
2276
|
+
<oneOrMore>
|
2277
|
+
<choice>
|
2278
|
+
<ref name="formula"/>
|
2279
|
+
<ref name="ul"/>
|
2280
|
+
<ref name="ol"/>
|
2281
|
+
<ref name="dl"/>
|
2282
|
+
<ref name="quote"/>
|
2283
|
+
<ref name="sourcecode"/>
|
2284
|
+
<ref name="paragraph"/>
|
2285
|
+
<ref name="figure"/>
|
2286
|
+
</choice>
|
2287
|
+
</oneOrMore>
|
2204
2288
|
</element>
|
2205
2289
|
</define>
|
2206
2290
|
<define name="termsource">
|
@@ -2534,4 +2618,17 @@
|
|
2534
2618
|
</oneOrMore>
|
2535
2619
|
</element>
|
2536
2620
|
</define>
|
2621
|
+
<define name="floating-title">
|
2622
|
+
<element name="floating-title">
|
2623
|
+
<attribute name="id">
|
2624
|
+
<data type="ID"/>
|
2625
|
+
</attribute>
|
2626
|
+
<attribute name="depth">
|
2627
|
+
<data type="int"/>
|
2628
|
+
</attribute>
|
2629
|
+
<zeroOrMore>
|
2630
|
+
<ref name="TextElement"/>
|
2631
|
+
</zeroOrMore>
|
2632
|
+
</element>
|
2633
|
+
</define>
|
2537
2634
|
</grammar>
|
File without changes
|
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Metanorma
|
2
2
|
module Ogc
|
3
3
|
class Converter < Standoc::Converter
|
4
4
|
def validate(doc)
|
@@ -14,6 +14,44 @@ module Asciidoctor
|
|
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)
|
data/lib/metanorma/ogc.rb
CHANGED
data/lib/metanorma-ogc.rb
CHANGED
data/metanorma-ogc.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
26
26
|
|
27
27
|
spec.add_dependency "iso-639"
|
28
|
-
spec.add_dependency "metanorma-standoc", "~>
|
28
|
+
spec.add_dependency "metanorma-standoc", "~> 2.0.0"
|
29
29
|
|
30
30
|
spec.add_development_dependency "debug"
|
31
31
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
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:
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: iso-639
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 2.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: debug
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -199,17 +199,6 @@ files:
|
|
199
199
|
- bin/console
|
200
200
|
- bin/rspec
|
201
201
|
- bin/setup
|
202
|
-
- lib/asciidoctor/ogc.rb
|
203
|
-
- lib/asciidoctor/ogc/basicdoc.rng
|
204
|
-
- lib/asciidoctor/ogc/biblio.rng
|
205
|
-
- lib/asciidoctor/ogc/boilerplate.xml
|
206
|
-
- lib/asciidoctor/ogc/cleanup.rb
|
207
|
-
- lib/asciidoctor/ogc/converter.rb
|
208
|
-
- lib/asciidoctor/ogc/front.rb
|
209
|
-
- lib/asciidoctor/ogc/isodoc.rng
|
210
|
-
- lib/asciidoctor/ogc/ogc.rng
|
211
|
-
- lib/asciidoctor/ogc/reqt.rng
|
212
|
-
- lib/asciidoctor/ogc/validate.rb
|
213
202
|
- lib/isodoc/ogc.rb
|
214
203
|
- lib/isodoc/ogc/base_convert.rb
|
215
204
|
- lib/isodoc/ogc/biblio.rb
|
@@ -264,7 +253,17 @@ files:
|
|
264
253
|
- lib/isodoc/ogc/xref.rb
|
265
254
|
- lib/metanorma-ogc.rb
|
266
255
|
- lib/metanorma/ogc.rb
|
256
|
+
- lib/metanorma/ogc/basicdoc.rng
|
257
|
+
- lib/metanorma/ogc/biblio.rng
|
258
|
+
- lib/metanorma/ogc/boilerplate.xml
|
259
|
+
- lib/metanorma/ogc/cleanup.rb
|
260
|
+
- lib/metanorma/ogc/converter.rb
|
261
|
+
- lib/metanorma/ogc/front.rb
|
262
|
+
- lib/metanorma/ogc/isodoc.rng
|
263
|
+
- lib/metanorma/ogc/ogc.rng
|
267
264
|
- lib/metanorma/ogc/processor.rb
|
265
|
+
- lib/metanorma/ogc/reqt.rng
|
266
|
+
- lib/metanorma/ogc/validate.rb
|
268
267
|
- lib/metanorma/ogc/version.rb
|
269
268
|
- metanorma-ogc.gemspec
|
270
269
|
homepage: https://github.com/metanorma/metanorma-ogc
|