metanorma-ogc 1.5.4.1 → 2.0.2
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 -1
- 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 +49 -28
- data/lib/isodoc/ogc/html/htmlstyle.scss +19 -11
- 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/html/wordstyle.css +30 -18
- data/lib/isodoc/ogc/html/wordstyle.scss +30 -18
- data/lib/isodoc/ogc/html/wordstyle_wp.css +22 -12
- data/lib/isodoc/ogc/html/wordstyle_wp.scss +22 -12
- data/lib/isodoc/ogc/metadata.rb +4 -0
- data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +1677 -1309
- data/lib/isodoc/ogc/ogc.best-practice.xsl +1677 -1309
- data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +1677 -1309
- data/lib/isodoc/ogc/ogc.community-practice.xsl +1677 -1309
- data/lib/isodoc/ogc/ogc.community-standard.xsl +1677 -1309
- data/lib/isodoc/ogc/ogc.discussion-paper.xsl +1677 -1309
- data/lib/isodoc/ogc/ogc.engineering-report.xsl +1677 -1309
- data/lib/isodoc/ogc/ogc.other.xsl +1677 -1309
- data/lib/isodoc/ogc/ogc.policy.xsl +1677 -1309
- data/lib/isodoc/ogc/ogc.reference-model.xsl +1677 -1309
- data/lib/isodoc/ogc/ogc.release-notes.xsl +1677 -1309
- data/lib/isodoc/ogc/ogc.standard.xsl +1677 -1309
- data/lib/isodoc/ogc/ogc.test-suite.xsl +1677 -1309
- data/lib/isodoc/ogc/ogc.user-guide.xsl +1677 -1309
- data/lib/isodoc/ogc/ogc.white-paper.xsl +1655 -1303
- data/lib/isodoc/ogc/presentation_xml_convert.rb +35 -18
- data/lib/isodoc/ogc/reqt.rb +17 -3
- data/lib/{asciidoctor → metanorma}/ogc/basicdoc.rng +0 -0
- data/lib/{asciidoctor → metanorma}/ogc/biblio.rng +2 -2
- data/lib/{asciidoctor → metanorma}/ogc/boilerplate.xml +0 -0
- data/lib/{asciidoctor → metanorma}/ogc/cleanup.rb +54 -10
- data/lib/{asciidoctor → metanorma}/ogc/converter.rb +13 -3
- data/lib/{asciidoctor → metanorma}/ogc/front.rb +15 -3
- data/lib/{asciidoctor → metanorma}/ogc/isodoc.rng +104 -3
- 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
|
|
@@ -188,21 +183,38 @@ module IsoDoc
|
|
188
183
|
end
|
189
184
|
end
|
190
185
|
|
186
|
+
def bibdata(docxml)
|
187
|
+
docxml.xpath(ns("//bibdata/contributor[@type = 'author']")).each do |a|
|
188
|
+
a.at(ns("./description"))&.text == "contributor" and
|
189
|
+
a["type"] = "contributor"
|
190
|
+
end
|
191
|
+
super
|
192
|
+
end
|
193
|
+
|
191
194
|
def bibdata_i18n(bib)
|
192
|
-
stage = bib&.at(ns("./status/stage"))
|
193
195
|
doctype = bib&.at(ns("./ext/doctype"))
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
stage.children = "published"
|
198
|
-
end
|
196
|
+
rename_stage(bib&.at(ns("./status/stage")), doctype, bib)
|
197
|
+
rename_doctype(doctype, bib&.at(ns("./date[@type = 'published']")) ||
|
198
|
+
bib&.at(ns("./date[@type = 'issued']")))
|
199
199
|
super
|
200
200
|
end
|
201
201
|
|
202
|
+
def rename_stage(stage, doctype, _bib)
|
203
|
+
stage&.text == "approved" &&
|
204
|
+
!%w(standard abstract-specification-topic
|
205
|
+
community-standard).include?(doctype&.text) and
|
206
|
+
stage.children = "published"
|
207
|
+
end
|
208
|
+
|
209
|
+
def rename_doctype(doctype, date)
|
210
|
+
return unless doctype&.text == "white-paper" && date
|
211
|
+
|
212
|
+
Date.iso8601(date.text) >= Date.iso8601("2021-12-16") and
|
213
|
+
doctype.children = "technical-paper"
|
214
|
+
end
|
215
|
+
|
202
216
|
def ol(docxml)
|
203
|
-
docxml.xpath(ns("//ol")).each
|
204
|
-
ol1(f)
|
205
|
-
end
|
217
|
+
docxml.xpath(ns("//ol")).each { |f| ol1(f) }
|
206
218
|
end
|
207
219
|
|
208
220
|
def ol1(elem)
|
@@ -221,6 +233,11 @@ module IsoDoc
|
|
221
233
|
"#{elem.children.to_xml.strip}]")
|
222
234
|
end
|
223
235
|
|
236
|
+
def bibliography_bibitem_number_skip(bibitem)
|
237
|
+
@xrefs.klass.implicit_reference(bibitem) ||
|
238
|
+
bibitem.at(ns(".//docidentifier[@type = 'metanorma-ordinal']"))
|
239
|
+
end
|
240
|
+
|
224
241
|
include Init
|
225
242
|
end
|
226
243
|
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")
|
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 sections_cleanup(xml)
|
@@ -58,6 +58,9 @@ module Asciidoctor
|
|
58
58
|
super
|
59
59
|
a = xmldoc.at("//bibdata/status/stage")
|
60
60
|
a.text == "published" and a.children = "approved"
|
61
|
+
doctype = xmldoc.at("//bibdata/ext/doctype")
|
62
|
+
doctype.text == "technical-paper" and
|
63
|
+
doctype.children = "white-paper"
|
61
64
|
end
|
62
65
|
|
63
66
|
def section_names_terms_cleanup(xml)
|
@@ -171,17 +174,58 @@ module Asciidoctor
|
|
171
174
|
xmldoc.xpath(REQRECPER).each do |r|
|
172
175
|
next unless r["type"]
|
173
176
|
|
174
|
-
r
|
175
|
-
when "requirement", "recommendation", "permission"
|
176
|
-
"general"
|
177
|
-
when "requirements_class" then "class"
|
178
|
-
when "conformance_test" then "verification"
|
179
|
-
when "conformance_class" then "conformanceclass"
|
180
|
-
when "abstract_test" then "abstracttest"
|
181
|
-
else r["type"]
|
182
|
-
end
|
177
|
+
requirement_type1(r)
|
183
178
|
end
|
184
179
|
end
|
180
|
+
|
181
|
+
def requirement_type1(reqt)
|
182
|
+
reqt["type"] = case reqt["type"]
|
183
|
+
when "requirement", "recommendation", "permission"
|
184
|
+
"general"
|
185
|
+
when "requirements_class" then "class"
|
186
|
+
when "conformance_test" then "verification"
|
187
|
+
when "conformance_class" then "conformanceclass"
|
188
|
+
when "abstract_test" then "abstracttest"
|
189
|
+
else reqt["type"]
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def normref_cleanup(xmldoc)
|
194
|
+
r1 = xmldoc.at("//references[title[translate(text(), 'R', 'r') = "\
|
195
|
+
"'Normative references']]")
|
196
|
+
r2 = xmldoc.at("//references[title[text() = 'References']]")
|
197
|
+
if r1 && r2
|
198
|
+
r2["normative"] = false
|
199
|
+
end
|
200
|
+
super
|
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
|
185
229
|
end
|
186
230
|
end
|
187
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
|
@@ -31,7 +31,7 @@ module Asciidoctor
|
|
31
31
|
change-request-supporting-document community-practice
|
32
32
|
community-standard discussion-paper engineering-report
|
33
33
|
reference-model release-notes standard user-guide white-paper
|
34
|
-
test-suite}.include? d
|
34
|
+
technical-paper test-suite}.include? d
|
35
35
|
@warned_doctype or
|
36
36
|
@log.add("Document Attributes", nil,
|
37
37
|
"'#{d}' is not a legal document type: reverting to 'standard'")
|
@@ -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>
|
@@ -1973,7 +2046,11 @@
|
|
1973
2046
|
</optional>
|
1974
2047
|
<element name="name">
|
1975
2048
|
<zeroOrMore>
|
1976
|
-
<
|
2049
|
+
<choice>
|
2050
|
+
<ref name="PureTextElement"/>
|
2051
|
+
<ref name="stem"/>
|
2052
|
+
<ref name="index"/>
|
2053
|
+
</choice>
|
1977
2054
|
</zeroOrMore>
|
1978
2055
|
</element>
|
1979
2056
|
<optional>
|
@@ -1987,7 +2064,7 @@
|
|
1987
2064
|
</element>
|
1988
2065
|
</optional>
|
1989
2066
|
<optional>
|
1990
|
-
<element name="grammar
|
2067
|
+
<element name="grammar">
|
1991
2068
|
<ref name="Grammar"/>
|
1992
2069
|
</element>
|
1993
2070
|
</optional>
|
@@ -2196,7 +2273,18 @@
|
|
2196
2273
|
<ref name="MultilingualRenderingType"/>
|
2197
2274
|
</attribute>
|
2198
2275
|
</optional>
|
2199
|
-
<
|
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>
|
2200
2288
|
</element>
|
2201
2289
|
</define>
|
2202
2290
|
<define name="termsource">
|
@@ -2530,4 +2618,17 @@
|
|
2530
2618
|
</oneOrMore>
|
2531
2619
|
</element>
|
2532
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>
|
2533
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.2
|
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-01-22 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
|