metanorma-ogc 1.4.1 → 1.4.4
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/basicdoc.rng +21 -4
- data/lib/asciidoctor/ogc/cleanup.rb +173 -0
- data/lib/asciidoctor/ogc/converter.rb +19 -76
- data/lib/asciidoctor/ogc/isodoc.rng +218 -52
- data/lib/asciidoctor/ogc/reqt.rng +23 -2
- data/lib/asciidoctor/ogc/validate.rb +35 -20
- data/lib/isodoc/ogc/base_convert.rb +47 -10
- 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/html/wordstyle.css +12 -1
- data/lib/isodoc/ogc/html/wordstyle.scss +12 -1
- data/lib/isodoc/ogc/html/wordstyle_wp.css +12 -1
- data/lib/isodoc/ogc/html/wordstyle_wp.scss +12 -1
- data/lib/isodoc/ogc/i18n-en.yaml +10 -8
- data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +268 -33
- data/lib/isodoc/ogc/ogc.best-practice.xsl +268 -33
- data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +268 -33
- data/lib/isodoc/ogc/ogc.community-practice.xsl +268 -33
- data/lib/isodoc/ogc/ogc.community-standard.xsl +268 -33
- data/lib/isodoc/ogc/ogc.discussion-paper.xsl +268 -33
- data/lib/isodoc/ogc/ogc.engineering-report.xsl +268 -33
- data/lib/isodoc/ogc/ogc.other.xsl +268 -33
- data/lib/isodoc/ogc/ogc.policy.xsl +268 -33
- data/lib/isodoc/ogc/ogc.reference-model.xsl +268 -33
- data/lib/isodoc/ogc/ogc.release-notes.xsl +268 -33
- data/lib/isodoc/ogc/ogc.standard.xsl +268 -33
- data/lib/isodoc/ogc/ogc.test-suite.xsl +268 -33
- data/lib/isodoc/ogc/ogc.user-guide.xsl +268 -33
- data/lib/isodoc/ogc/ogc.white-paper.xsl +167 -10
- data/lib/isodoc/ogc/presentation_xml_convert.rb +6 -3
- data/lib/isodoc/ogc/reqt.rb +49 -36
- 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: 8b004271fb32dddbacb0a918bdb44b5e505d9897031d79d68230f62af3b00fbb
|
4
|
+
data.tar.gz: 054f0f06008fbfe87cf6de3ccb472b54354ea6c5ae24214591a2d93d315b6024
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3eef75cb366bcac20327b3a9c7e75d3fa57dc7408b55ba6dc890f0515af24ffc974e4ea565f37b0d4154a3ce1342678fe80baed6766b80b89d9ce3e61204e71
|
7
|
+
data.tar.gz: 4aba2501b403301014127dfd18fc85b70493ddf43081045c61aabd086322a8b6f2808446d97a6cfc0dfc2e6653742c84d2585916e48bb891ecddc475a23bbb24
|
@@ -624,6 +624,9 @@
|
|
624
624
|
<choice>
|
625
625
|
<ref name="PureTextElement"/>
|
626
626
|
<ref name="stem"/>
|
627
|
+
<ref name="eref"/>
|
628
|
+
<ref name="xref"/>
|
629
|
+
<ref name="hyperlink"/>
|
627
630
|
</choice>
|
628
631
|
</zeroOrMore>
|
629
632
|
</element>
|
@@ -634,6 +637,9 @@
|
|
634
637
|
<choice>
|
635
638
|
<ref name="PureTextElement"/>
|
636
639
|
<ref name="stem"/>
|
640
|
+
<ref name="eref"/>
|
641
|
+
<ref name="xref"/>
|
642
|
+
<ref name="hyperlink"/>
|
637
643
|
</choice>
|
638
644
|
</zeroOrMore>
|
639
645
|
</element>
|
@@ -641,7 +647,12 @@
|
|
641
647
|
<define name="tt">
|
642
648
|
<element name="tt">
|
643
649
|
<zeroOrMore>
|
644
|
-
<
|
650
|
+
<choice>
|
651
|
+
<ref name="PureTextElement"/>
|
652
|
+
<ref name="eref"/>
|
653
|
+
<ref name="xref"/>
|
654
|
+
<ref name="hyperlink"/>
|
655
|
+
</choice>
|
645
656
|
</zeroOrMore>
|
646
657
|
</element>
|
647
658
|
</define>
|
@@ -822,7 +833,9 @@
|
|
822
833
|
<attribute name="alt"/>
|
823
834
|
</optional>
|
824
835
|
<ref name="CitationType"/>
|
825
|
-
<
|
836
|
+
<oneOrMore>
|
837
|
+
<ref name="PureTextElement"/>
|
838
|
+
</oneOrMore>
|
826
839
|
</define>
|
827
840
|
<define name="hyperlink">
|
828
841
|
<element name="link">
|
@@ -835,7 +848,9 @@
|
|
835
848
|
<optional>
|
836
849
|
<attribute name="alt"/>
|
837
850
|
</optional>
|
838
|
-
<
|
851
|
+
<oneOrMore>
|
852
|
+
<ref name="PureTextElement"/>
|
853
|
+
</oneOrMore>
|
839
854
|
</element>
|
840
855
|
</define>
|
841
856
|
<define name="xref">
|
@@ -849,7 +864,9 @@
|
|
849
864
|
<optional>
|
850
865
|
<attribute name="alt"/>
|
851
866
|
</optional>
|
852
|
-
<
|
867
|
+
<oneOrMore>
|
868
|
+
<ref name="PureTextElement"/>
|
869
|
+
</oneOrMore>
|
853
870
|
</element>
|
854
871
|
</define>
|
855
872
|
<define name="fn">
|
@@ -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
|
@@ -40,6 +41,14 @@ module Asciidoctor
|
|
40
41
|
d
|
41
42
|
end
|
42
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
|
+
|
43
52
|
def sectiontype_streamline(ret)
|
44
53
|
case ret
|
45
54
|
when "preface" then "foreword"
|
@@ -62,55 +71,6 @@ module Asciidoctor
|
|
62
71
|
false, "#{@filename}.pdf")
|
63
72
|
end
|
64
73
|
|
65
|
-
def validate(doc)
|
66
|
-
content_validate(doc)
|
67
|
-
schema_validate(formattedstr_strip(doc.dup),
|
68
|
-
File.join(File.dirname(__FILE__), "ogc.rng"))
|
69
|
-
end
|
70
|
-
|
71
|
-
def sections_cleanup(xml)
|
72
|
-
super
|
73
|
-
xml.xpath("//*[@inline-header]").each do |h|
|
74
|
-
h.delete("inline-header")
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def make_preface(xml, sect)
|
79
|
-
super
|
80
|
-
insert_security(xml, sect)
|
81
|
-
insert_submitters(xml, sect)
|
82
|
-
end
|
83
|
-
|
84
|
-
def add_id
|
85
|
-
%(id="_#{UUIDTools::UUID.random_create}")
|
86
|
-
end
|
87
|
-
|
88
|
-
def insert_security(xml, sect)
|
89
|
-
doctype = sect&.at("//bibdata/ext/doctype")&.text
|
90
|
-
description = if %w(standard
|
91
|
-
community-standard).include?(doctype)
|
92
|
-
"standard"
|
93
|
-
else
|
94
|
-
"document"
|
95
|
-
end
|
96
|
-
preface = sect.at("//preface") ||
|
97
|
-
sect.add_previous_sibling("<preface/>").first
|
98
|
-
sect = xml&.at("//clause[@type = 'security']")&.remove ||
|
99
|
-
"<clause type='security' #{add_id}>"\
|
100
|
-
"<title>Security Considerations</title>"\
|
101
|
-
"<p>#{@i18n.security_empty.sub(/%/, description)}</p></clause>"
|
102
|
-
preface.add_child sect
|
103
|
-
end
|
104
|
-
|
105
|
-
def insert_submitters(xml, sect)
|
106
|
-
if xml.at("//submitters")
|
107
|
-
preface = sect.at("//preface") ||
|
108
|
-
sect.add_previous_sibling("<preface/>").first
|
109
|
-
submitters = xml.at("//submitters").remove
|
110
|
-
preface.add_child submitters.remove
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
74
|
def clause_parse(attrs, xml, node)
|
115
75
|
case node&.attr("heading")&.downcase || node.title.downcase
|
116
76
|
when "submitters" then return submitters_parse(attrs, xml, node)
|
@@ -132,8 +92,6 @@ module Asciidoctor
|
|
132
92
|
nil
|
133
93
|
end
|
134
94
|
|
135
|
-
def termdef_boilerplate_cleanup(xmldoc); end
|
136
|
-
|
137
95
|
def term_def_parse(attrs, xml, node, _toplevel)
|
138
96
|
if node.attr("style") == "appendix" && node.level == 1
|
139
97
|
terms_annex_parse(attrs, xml, node)
|
@@ -160,35 +118,20 @@ module Asciidoctor
|
|
160
118
|
end
|
161
119
|
end
|
162
120
|
|
163
|
-
def bibdata_cleanup(xmldoc)
|
164
|
-
super
|
165
|
-
a = xmldoc.at("//bibdata/status/stage")
|
166
|
-
a.text == "published" and a.children = "approved"
|
167
|
-
end
|
168
|
-
|
169
|
-
def section_names_terms_cleanup(xml)
|
170
|
-
replace_title(xml, "//definitions[@type = 'symbols']", @i18n&.symbols)
|
171
|
-
replace_title(xml, "//definitions[@type = 'abbreviated_terms']",
|
172
|
-
@i18n&.abbrev)
|
173
|
-
replace_title(xml, "//definitions[not(@type)]", @i18n&.symbolsabbrev)
|
174
|
-
replace_title(xml, "//sections//terms#{SYMnoABBR} | //sections//clause[.//terms]#{SYMnoABBR}",
|
175
|
-
@i18n&.termsdefsymbols, true)
|
176
|
-
replace_title(xml, "//sections//terms#{ABBRnoSYM} | //sections//clause[.//terms]#{ABBRnoSYM}",
|
177
|
-
@i18n&.termsdefabbrev, true)
|
178
|
-
replace_title(xml, "//sections//terms#{SYMABBR} | //sections//clause[.//terms]#{SYMABBR}",
|
179
|
-
@i18n&.termsdefsymbolsabbrev, true)
|
180
|
-
replace_title(xml, "//sections//terms#{NO_SYMABBR} | //sections//clause[.//terms]#{NO_SYMABBR}",
|
181
|
-
@i18n&.termsdefsymbolsabbrev, true)
|
182
|
-
replace_title(
|
183
|
-
xml, "//sections//terms[not(.//definitions)] | //sections//clause[.//terms][not(.//definitions)]",
|
184
|
-
@i18n&.termsdef, true
|
185
|
-
)
|
186
|
-
end
|
187
|
-
|
188
121
|
def highlight_parse(text, xml)
|
189
122
|
xml.hi { |s| s << text }
|
190
123
|
end
|
191
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
|
+
|
192
135
|
def presentation_xml_converter(node)
|
193
136
|
IsoDoc::Ogc::PresentationXMLConvert.new(html_extract_attributes(node))
|
194
137
|
end
|