metanorma-ogc 1.4.0 → 1.4.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/ogc/boilerplate.xml +6 -6
- data/lib/asciidoctor/ogc/cleanup.rb +173 -0
- data/lib/asciidoctor/ogc/converter.rb +62 -64
- data/lib/asciidoctor/ogc/front.rb +1 -1
- data/lib/asciidoctor/ogc/isodoc.rng +211 -11
- data/lib/asciidoctor/ogc/reqt.rng +16 -0
- data/lib/asciidoctor/ogc/validate.rb +35 -20
- data/lib/isodoc/ogc/base_convert.rb +47 -10
- data/lib/isodoc/ogc/biblio.rb +57 -51
- data/lib/isodoc/ogc/html/htmlstyle.css +10 -0
- data/lib/isodoc/ogc/html/htmlstyle.scss +12 -0
- data/lib/isodoc/ogc/html/ogc.css +4 -0
- data/lib/isodoc/ogc/html/ogc.scss +4 -0
- data/lib/isodoc/ogc/i18n-en.yaml +24 -8
- data/lib/isodoc/ogc/metadata.rb +1 -1
- data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +501 -127
- data/lib/isodoc/ogc/ogc.best-practice.xsl +501 -127
- data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +501 -127
- data/lib/isodoc/ogc/ogc.community-practice.xsl +501 -127
- data/lib/isodoc/ogc/ogc.community-standard.xsl +501 -127
- data/lib/isodoc/ogc/ogc.discussion-paper.xsl +501 -127
- data/lib/isodoc/ogc/ogc.engineering-report.xsl +501 -127
- data/lib/isodoc/ogc/ogc.other.xsl +501 -127
- data/lib/isodoc/ogc/ogc.policy.xsl +501 -127
- data/lib/isodoc/ogc/ogc.reference-model.xsl +501 -127
- data/lib/isodoc/ogc/ogc.release-notes.xsl +501 -127
- data/lib/isodoc/ogc/ogc.standard.xsl +501 -127
- data/lib/isodoc/ogc/ogc.test-suite.xsl +501 -127
- data/lib/isodoc/ogc/ogc.user-guide.xsl +501 -127
- data/lib/isodoc/ogc/ogc.white-paper.xsl +358 -66
- data/lib/isodoc/ogc/presentation_xml_convert.rb +58 -48
- data/lib/isodoc/ogc/reqt.rb +64 -46
- data/lib/isodoc/ogc/xref.rb +1 -2
- data/lib/metanorma/ogc/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c61110249dcf38582cab740344a923908991d2f3908648911389232520af221e
|
4
|
+
data.tar.gz: 51997c51b4e3232b294e47aecce4e846a7abe299276e2abbda4b265ece5e8a68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0491614f0cc948b17dd6197061bd983d4f496db038efb4650e6965c528fdfbebc48f3d27484ac7eb55cd4a5ea400ab4e6740407a53fa6f457f8a6eec186f348d'
|
7
|
+
data.tar.gz: 7b661c57271001f0245a0c3c151a263df3050cb71b29abe0fcf3db8cbb639fe18ee90ea9a5cdcc6a6e8d09469fff4c05c18ba0dfc7364e8ed1860602fa8f0d57
|
@@ -95,13 +95,13 @@
|
|
95
95
|
{% if doctype == "Standard" or doctype == "Community Standard" or doctype == "Abstract Specification" %}
|
96
96
|
{% if stage == "Approved" or stage == "Withdrawn" %}
|
97
97
|
<clause>
|
98
|
-
<title>
|
98
|
+
<title>Notice</title>
|
99
99
|
<p>This document is an OGC Member approved international standard. This document is available on a royalty free, non-discriminatory basis. Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.
|
100
100
|
</p>
|
101
101
|
</clause>
|
102
102
|
{% else %}
|
103
103
|
<clause>
|
104
|
-
<title>
|
104
|
+
<title>Notice for Drafts</title>
|
105
105
|
<p>This document is not an OGC Standard. This document is distributed for review and comment. This document is subject to change without notice and may not be referred to as an OGC Standard.</p>
|
106
106
|
|
107
107
|
<p>Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.</p>
|
@@ -111,7 +111,7 @@
|
|
111
111
|
|
112
112
|
{% elsif doctype == "Engineering Report" %}
|
113
113
|
<clause>
|
114
|
-
<title>
|
114
|
+
<title>Notice</title>
|
115
115
|
<p>This document is not an OGC Standard. This document is an OGC Public Engineering Report created as a deliverable in an OGC Interoperability Initiative and is <em>not an official position</em> of the OGC membership. It is distributed for review and comment. It is subject to change without notice and may not be referred to as an OGC Standard.</p>
|
116
116
|
|
117
117
|
<p>Further, any OGC Engineering Report should not be referenced as required or mandatory technology in procurements. However, the discussions in this document could very well lead to the definition of an OGC Standard.</p>
|
@@ -120,7 +120,7 @@
|
|
120
120
|
|
121
121
|
{% elsif doctype == "Best Practice" %}
|
122
122
|
<clause>
|
123
|
-
<title>
|
123
|
+
<title>Notice</title>
|
124
124
|
<p>This document defines an OGC Best Practice on a particular technology or approach related to an OGC standard. This document is <em>not</em> an OGC Standard and may not be referred to as an OGC Standard. It is subject to change without notice. However, this document is an <em>official</em> position of the OGC membership on this particular technology topic.</p>
|
125
125
|
|
126
126
|
<p>Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.</p>
|
@@ -128,7 +128,7 @@
|
|
128
128
|
|
129
129
|
{% elsif doctype == "Release Notes" %}
|
130
130
|
<clause>
|
131
|
-
<title>
|
131
|
+
<title>Notice</title>
|
132
132
|
<p>This document is not an OGC standard. This document provides release notes for an OGC standard. This document is subject to change without notice and may not be referred to as an OGC Standard.</p>
|
133
133
|
|
134
134
|
<p>Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.</p>
|
@@ -137,7 +137,7 @@
|
|
137
137
|
|
138
138
|
{% else %}
|
139
139
|
<clause>
|
140
|
-
<title>
|
140
|
+
<title>Notice</title>
|
141
141
|
<p>This document is not an OGC Standard. This document is an OGC {{ doctype }} and is therefore not an official position of the OGC membership. It is distributed for review and comment. It is subject to change without notice and may not be referred to as an OGC Standard.</p>
|
142
142
|
<p>Further, an OGC {{ doctype }} should not be referenced as required or mandatory technology in procurements.</p>
|
143
143
|
</clause>
|
@@ -0,0 +1,173 @@
|
|
1
|
+
module Asciidoctor
|
2
|
+
module Ogc
|
3
|
+
class Converter < Standoc::Converter
|
4
|
+
def sections_cleanup(xml)
|
5
|
+
super
|
6
|
+
xml.xpath("//*[@inline-header]").each do |h|
|
7
|
+
h.delete("inline-header")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def make_preface(xml, sect)
|
12
|
+
super
|
13
|
+
insert_security(xml, sect)
|
14
|
+
insert_submitters(xml, sect)
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_id
|
18
|
+
%(id="_#{UUIDTools::UUID.random_create}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def insert_security(xml, sect)
|
22
|
+
description = "document"
|
23
|
+
description = "standard" if %w(standard community-standard)
|
24
|
+
.include?(sect&.at("//bibdata/ext/doctype")&.text)
|
25
|
+
preface = sect.at("//preface") ||
|
26
|
+
sect.add_previous_sibling("<preface/>").first
|
27
|
+
sect = xml&.at("//clause[@type = 'security']")&.remove ||
|
28
|
+
"<clause type='security' #{add_id}>"\
|
29
|
+
"<title>Security considerations</title>"\
|
30
|
+
"<p>#{@i18n.security_empty.sub(/%/, description)}</p></clause>"
|
31
|
+
preface.add_child sect
|
32
|
+
end
|
33
|
+
|
34
|
+
def insert_submitters(xml, sect)
|
35
|
+
if xml.at("//submitters")
|
36
|
+
preface = sect.at("//preface") ||
|
37
|
+
sect.add_previous_sibling("<preface/>").first
|
38
|
+
submitters = xml.at("//submitters").remove
|
39
|
+
submitters.xpath(".//table").each do |t|
|
40
|
+
t["unnumbered"] = true
|
41
|
+
end
|
42
|
+
preface.add_child submitters.remove
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def termdef_boilerplate_cleanup(xmldoc); end
|
47
|
+
|
48
|
+
def bibdata_cleanup(xmldoc)
|
49
|
+
super
|
50
|
+
a = xmldoc.at("//bibdata/status/stage")
|
51
|
+
a.text == "published" and a.children = "approved"
|
52
|
+
end
|
53
|
+
|
54
|
+
def section_names_terms_cleanup(xml)
|
55
|
+
replace_title(xml, "//definitions[@type = 'symbols']", @i18n&.symbols)
|
56
|
+
replace_title(xml, "//definitions[@type = 'abbreviated_terms']",
|
57
|
+
@i18n&.abbrev)
|
58
|
+
replace_title(xml, "//definitions[not(@type)]", @i18n&.symbolsabbrev)
|
59
|
+
replace_title(xml, "//sections//terms#{SYMnoABBR} | "\
|
60
|
+
"//sections//clause[.//terms]#{SYMnoABBR}",
|
61
|
+
@i18n&.termsdefsymbols, true)
|
62
|
+
replace_title(xml, "//sections//terms#{ABBRnoSYM} | "\
|
63
|
+
"//sections//clause[.//terms]#{ABBRnoSYM}",
|
64
|
+
@i18n&.termsdefabbrev, true)
|
65
|
+
replace_title(xml, "//sections//terms#{SYMABBR} | "\
|
66
|
+
"//sections//clause[.//terms]#{SYMABBR}",
|
67
|
+
@i18n&.termsdefsymbolsabbrev, true)
|
68
|
+
replace_title(xml, "//sections//terms#{NO_SYMABBR} | "\
|
69
|
+
"//sections//clause[.//terms]#{NO_SYMABBR}",
|
70
|
+
@i18n&.termsdefsymbolsabbrev, true)
|
71
|
+
replace_title(xml, "//sections//terms[not(.//definitions)] | "\
|
72
|
+
"//sections//clause[.//terms][not(.//definitions)]",
|
73
|
+
@i18n&.termsdef, true)
|
74
|
+
end
|
75
|
+
|
76
|
+
def requirement_metadata_component_tags
|
77
|
+
%w(test-purpose test-method test-method-type conditions part description
|
78
|
+
reference step requirement permission recommendation)
|
79
|
+
end
|
80
|
+
|
81
|
+
def requirement_metadata1(reqt, dlist, ins)
|
82
|
+
ins1 = super
|
83
|
+
dlist.xpath("./dt").each do |e|
|
84
|
+
tag = e&.text&.gsub(/ /, "-")&.downcase
|
85
|
+
next unless requirement_metadata_component_tags.include? tag
|
86
|
+
|
87
|
+
ins1.next = requirement_metadata1_component(e, tag)
|
88
|
+
ins1 = ins1.next
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def requirement_metadata1_component(term, tag)
|
93
|
+
val = term.at("./following::dd")
|
94
|
+
val.name = tag
|
95
|
+
val.xpath("./dl").each do |d|
|
96
|
+
requirement_metadata1(val, d, d)
|
97
|
+
d.remove
|
98
|
+
end
|
99
|
+
if %w(requirement permission
|
100
|
+
recommendation).include?(term.text) && !val.text.empty?
|
101
|
+
val["label"] = val.text.strip
|
102
|
+
val.children.remove
|
103
|
+
end
|
104
|
+
val
|
105
|
+
end
|
106
|
+
|
107
|
+
def requirement_metadata(xmldoc)
|
108
|
+
super
|
109
|
+
xmldoc.xpath(REQRECPER).each do |r|
|
110
|
+
requirement_metadata_to_component(r)
|
111
|
+
requirement_metadata_to_requirement(r)
|
112
|
+
requirement_subparts_to_blocks(r)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def requirement_metadata_to_component(reqt)
|
117
|
+
reqt.xpath(".//test-method | .//test-purpose | .//conditions | "\
|
118
|
+
".//part | .//test-method-type | .//step | .//reference")
|
119
|
+
.each do |c|
|
120
|
+
c["class"] = c.name
|
121
|
+
c.name = "component"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def requirement_metadata_to_requirement(reqt)
|
126
|
+
reqt.xpath("./requirement | ./permission | ./recommendation")
|
127
|
+
.each do |c|
|
128
|
+
c["id"] = Metanorma::Utils::anchor_or_uuid
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def requirement_subparts_to_blocks(reqt)
|
133
|
+
reqt.xpath(".//component | .//description").each do |c|
|
134
|
+
next if %w(p ol ul dl table component description)
|
135
|
+
.include?(c&.elements&.first&.name)
|
136
|
+
|
137
|
+
c.children = "<p>#{c.children.to_xml}</p>"
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
# skip annex/terms/terms, which is empty node
|
142
|
+
def termdef_subclause_cleanup(xmldoc)
|
143
|
+
xmldoc.xpath("//annex//terms[terms]").each do |t|
|
144
|
+
next if t.parent.name == "terms"
|
145
|
+
|
146
|
+
t.children.each { |n| n.parent = t.parent }
|
147
|
+
t.remove
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
def requirement_cleanup(xmldoc)
|
152
|
+
requirement_type(xmldoc)
|
153
|
+
super
|
154
|
+
end
|
155
|
+
|
156
|
+
def requirement_type(xmldoc)
|
157
|
+
xmldoc.xpath(REQRECPER).each do |r|
|
158
|
+
next unless r["type"]
|
159
|
+
|
160
|
+
r["type"] = case r["type"]
|
161
|
+
when "requirement", "recommendation", "permission"
|
162
|
+
"general"
|
163
|
+
when "requirements_class" then "class"
|
164
|
+
when "conformance_test" then "verification"
|
165
|
+
when "conformance_class" then "conformanceclass"
|
166
|
+
when "abstract_test" then "abstracttest"
|
167
|
+
else r["type"]
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
@@ -3,6 +3,7 @@ require "asciidoctor/standoc/converter"
|
|
3
3
|
require "fileutils"
|
4
4
|
require_relative "front"
|
5
5
|
require_relative "validate"
|
6
|
+
require_relative "cleanup"
|
6
7
|
|
7
8
|
module Asciidoctor
|
8
9
|
module Ogc
|
@@ -16,8 +17,7 @@ module Asciidoctor
|
|
16
17
|
register_for "ogc"
|
17
18
|
|
18
19
|
# ignore, we generate ToC outside of asciidoctor
|
19
|
-
def toc(value)
|
20
|
-
end
|
20
|
+
def toc(value); end
|
21
21
|
|
22
22
|
def makexml(node)
|
23
23
|
@draft = node.attributes.has_key?("draft")
|
@@ -27,11 +27,11 @@ module Asciidoctor
|
|
27
27
|
def doctype(node)
|
28
28
|
d = super
|
29
29
|
d1 = ::IsoDoc::Ogc::DOCTYPE_ABBR.invert[d] and d = d1
|
30
|
-
unless %w{abstract-specification-topic best-practice
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
unless %w{abstract-specification-topic best-practice other policy
|
31
|
+
change-request-supporting-document community-practice
|
32
|
+
community-standard discussion-paper engineering-report
|
33
|
+
reference-model release-notes standard user-guide white-paper
|
34
|
+
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'")
|
@@ -41,72 +41,42 @@ module Asciidoctor
|
|
41
41
|
d
|
42
42
|
end
|
43
43
|
|
44
|
+
def sectiontype(node, level = true)
|
45
|
+
ret = sectiontype_streamline(sectiontype1(node))
|
46
|
+
return ret if ret == "terms and definitions" &&
|
47
|
+
node.attr("style") == "appendix" && node.level == 1
|
48
|
+
|
49
|
+
super
|
50
|
+
end
|
51
|
+
|
44
52
|
def sectiontype_streamline(ret)
|
45
53
|
case ret
|
46
54
|
when "preface" then "foreword"
|
47
|
-
when "foreword" then "donotrecognise-foreword"
|
48
|
-
when "introduction" then "donotrecognise-foreword"
|
55
|
+
when "foreword", "introduction" then "donotrecognise-foreword"
|
49
56
|
when "references" then "normative references"
|
57
|
+
when "glossary" then "terms and definitions"
|
50
58
|
else
|
51
59
|
super
|
52
60
|
end
|
53
61
|
end
|
54
62
|
|
55
63
|
def outputs(node, ret)
|
56
|
-
File.open(@filename
|
57
|
-
presentation_xml_converter(node).convert(@filename
|
58
|
-
html_converter(node).convert(@filename
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
content_validate(doc)
|
65
|
-
schema_validate(formattedstr_strip(doc.dup), File.join(File.dirname(__FILE__), "ogc.rng"))
|
66
|
-
end
|
67
|
-
|
68
|
-
def sections_cleanup(x)
|
69
|
-
super
|
70
|
-
x.xpath("//*[@inline-header]").each do |h|
|
71
|
-
h.delete("inline-header")
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def make_preface(x, s)
|
76
|
-
super
|
77
|
-
insert_security(x, s)
|
78
|
-
insert_submitters(x, s)
|
79
|
-
end
|
80
|
-
|
81
|
-
def add_id
|
82
|
-
%(id="_#{UUIDTools::UUID.random_create}")
|
83
|
-
end
|
84
|
-
|
85
|
-
def insert_security(x, s)
|
86
|
-
doctype = s&.at("//bibdata/ext/doctype")&.text
|
87
|
-
description = %w(standard community-standard).include?(doctype) ? "standard" : "document"
|
88
|
-
preface = s.at("//preface") || s.add_previous_sibling("<preface/>").first
|
89
|
-
s = x&.at("//clause[@type = 'security']")&.remove ||
|
90
|
-
"<clause type='security' #{add_id}>"\
|
91
|
-
"<title>Security Considerations</title>"\
|
92
|
-
"<p>#{@i18n.security_empty.sub(/%/, description)}</p></clause>"
|
93
|
-
preface.add_child s
|
94
|
-
end
|
95
|
-
|
96
|
-
def insert_submitters(x, s)
|
97
|
-
if x.at("//submitters")
|
98
|
-
preface = s.at("//preface") || s.add_previous_sibling("<preface/>").first
|
99
|
-
submitters = x.at("//submitters").remove
|
100
|
-
preface.add_child submitters.remove
|
101
|
-
end
|
64
|
+
File.open("#{@filename}.xml", "w:UTF-8") { |f| f.write(ret) }
|
65
|
+
presentation_xml_converter(node).convert("#{@filename}.xml")
|
66
|
+
html_converter(node).convert("#{@filename}.presentation.xml", nil,
|
67
|
+
false, "#{@filename}.html")
|
68
|
+
doc_converter(node).convert("#{@filename}.presentation.xml", nil,
|
69
|
+
false, "#{@filename}.doc")
|
70
|
+
pdf_converter(node)&.convert("#{@filename}.presentation.xml", nil,
|
71
|
+
false, "#{@filename}.pdf")
|
102
72
|
end
|
103
73
|
|
104
74
|
def clause_parse(attrs, xml, node)
|
105
|
-
case
|
75
|
+
case node&.attr("heading")&.downcase || node.title.downcase
|
106
76
|
when "submitters" then return submitters_parse(attrs, xml, node)
|
107
77
|
when "conformance" then attrs = attrs.merge(type: "conformance")
|
108
|
-
when "security considerations" then attrs =
|
109
|
-
|
78
|
+
when "security considerations" then attrs =
|
79
|
+
attrs.merge(type: "security")
|
110
80
|
end
|
111
81
|
super
|
112
82
|
end
|
@@ -118,23 +88,50 @@ module Asciidoctor
|
|
118
88
|
end
|
119
89
|
end
|
120
90
|
|
121
|
-
def style(
|
122
|
-
|
91
|
+
def style(_node, _text)
|
92
|
+
nil
|
123
93
|
end
|
124
94
|
|
125
|
-
def
|
95
|
+
def term_def_parse(attrs, xml, node, _toplevel)
|
96
|
+
if node.attr("style") == "appendix" && node.level == 1
|
97
|
+
terms_annex_parse(attrs, xml, node)
|
98
|
+
else
|
99
|
+
super
|
100
|
+
end
|
126
101
|
end
|
127
102
|
|
128
|
-
def
|
103
|
+
def table_cell(node, xml_tr, tblsec)
|
104
|
+
node.set_attr("valign", "middle")
|
129
105
|
super
|
130
|
-
|
131
|
-
|
106
|
+
end
|
107
|
+
|
108
|
+
def terms_annex_parse(attrs, xml, node)
|
109
|
+
attrs1 = attrs.merge(id: "_#{UUIDTools::UUID.random_create}")
|
110
|
+
xml.annex **attr_code(attrs1) do |xml_section|
|
111
|
+
xml_section.title { |name| name << node.title }
|
112
|
+
xml_section.terms **attr_code(attrs) do |terms|
|
113
|
+
(s = node.attr("source")) && s.split(",").each do |s1|
|
114
|
+
terms.termdocsource(nil, **attr_code(bibitemid: s1))
|
115
|
+
end
|
116
|
+
terms << node.content
|
117
|
+
end
|
118
|
+
end
|
132
119
|
end
|
133
120
|
|
134
121
|
def highlight_parse(text, xml)
|
135
122
|
xml.hi { |s| s << text }
|
136
123
|
end
|
137
124
|
|
125
|
+
def example(node)
|
126
|
+
role = node.role || node.attr("style")
|
127
|
+
if %w(requirements_class conformance_test conformance_class
|
128
|
+
abstract_test).include?(role)
|
129
|
+
node.set_attr("type", role)
|
130
|
+
return requirement(node, "requirement")
|
131
|
+
end
|
132
|
+
super
|
133
|
+
end
|
134
|
+
|
138
135
|
def presentation_xml_converter(node)
|
139
136
|
IsoDoc::Ogc::PresentationXMLConvert.new(html_extract_attributes(node))
|
140
137
|
end
|
@@ -145,6 +142,7 @@ module Asciidoctor
|
|
145
142
|
|
146
143
|
def pdf_converter(node)
|
147
144
|
return nil if node.attr("no-pdf")
|
145
|
+
|
148
146
|
IsoDoc::Ogc::PdfConvert.new(html_extract_attributes(node))
|
149
147
|
end
|
150
148
|
|