metanorma-ogc 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/asciidoctor/ogc/converter.rb +19 -5
- data/lib/asciidoctor/ogc/front.rb +1 -0
- data/lib/isodoc/ogc/base_convert.rb +43 -14
- data/lib/isodoc/ogc/html_convert.rb +2 -0
- data/lib/isodoc/ogc/metadata.rb +45 -4
- data/lib/isodoc/ogc/pdf_convert.rb +2 -0
- data/lib/isodoc/ogc/word_convert.rb +2 -0
- data/lib/metanorma/ogc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cee080dfddf34ac247b0913a4bdfa0a1a399c45cdb13821a3e0135ca20967c8
|
4
|
+
data.tar.gz: 9ba37a51168b6a5445f04da1f189ff3a560240fcadae5c688ed59baa291adbfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f03966af60358ff2e2d4c20f64e508f1605ab6995f75c923bae735a151ede61b55cc1a1a5c80cb9f07c9ff6fe67cbe88c566f824360724221ccb40e47271097
|
7
|
+
data.tar.gz: 3a71ba1576a89618248131d4266d09c7e86db3946e69f1ad260f9e3b3c5091f9505fda2a5a5e3cd5eeb3943c2ac717516ebd08d68dfead2571fe65a49d8115fc
|
@@ -26,16 +26,29 @@ module Asciidoctor
|
|
26
26
|
|
27
27
|
def doctype(node)
|
28
28
|
d = node.attr("doctype")
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
d1 = ::IsoDoc::Ogc::DOCTYPE_ABBR.invert[d] and d = d1
|
30
|
+
unless %w{abstract-specification-topic best-practice
|
31
|
+
change-request-supporting-document community-practice
|
32
|
+
community-standard discussion-paper engineering-report other policy
|
33
|
+
reference-model release-notes standard user-guide white-paper
|
34
|
+
test-suite}.include? d
|
35
|
+
@warned_doctype or
|
36
|
+
warn "'#{d}' is not a legal document type: reverting to 'standard'"
|
33
37
|
@warned_doctype = true
|
34
38
|
d = "standard"
|
35
39
|
end
|
36
40
|
d
|
37
41
|
end
|
38
42
|
|
43
|
+
def sectiontype_streamline(ret)
|
44
|
+
case ret
|
45
|
+
when "preface" then "foreword"
|
46
|
+
when "foreword" then "donotrecognise-foreword"
|
47
|
+
else
|
48
|
+
super
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
39
52
|
def document(node)
|
40
53
|
init(node)
|
41
54
|
ret1 = makexml(node)
|
@@ -68,7 +81,8 @@ module Asciidoctor
|
|
68
81
|
def make_preface(x, s)
|
69
82
|
super
|
70
83
|
if x.at("//submitters")
|
71
|
-
preface = s.at("//preface") ||
|
84
|
+
preface = s.at("//preface") ||
|
85
|
+
s.add_previous_sibling("<preface/>").first
|
72
86
|
submitters = x.at("//submitters").remove
|
73
87
|
preface.add_child submitters.remove
|
74
88
|
end
|
@@ -147,6 +147,7 @@ module Asciidoctor
|
|
147
147
|
|
148
148
|
def metadata_subdoctype(node, xml)
|
149
149
|
s = node.attr("docsubtype")
|
150
|
+
s1 = ::IsoDoc::Ogc::DOCSUBTYPE_ABBR.invert[s] and s = s1
|
150
151
|
case doctype(node)
|
151
152
|
when "standard"
|
152
153
|
unless %w{conceptual-model conceptual-model-and-encoding
|
@@ -33,11 +33,13 @@ module IsoDoc
|
|
33
33
|
x = t.at("./thead") and x.replace(x.children)
|
34
34
|
x = t.at("./tbody") and x.replace(x.children)
|
35
35
|
x = t.at("./tfoot") and x.replace(x.children)
|
36
|
-
if x = t.at("./tr/th[@colspan = '2']") and
|
36
|
+
if x = t.at("./tr/th[@colspan = '2']") and
|
37
|
+
y = t.at("./tr/td[@colspan = '2']")
|
37
38
|
x["colspan"] = "1"
|
38
39
|
y["colspan"] = "1"
|
39
40
|
x.name = "td"
|
40
|
-
p = x.at("./p[@class = 'RecommendationTitle']") and
|
41
|
+
p = x.at("./p[@class = 'RecommendationTitle']") and
|
42
|
+
p.delete("class")
|
41
43
|
x << y.dup
|
42
44
|
y.parent.remove
|
43
45
|
end
|
@@ -103,6 +105,7 @@ module IsoDoc
|
|
103
105
|
|
104
106
|
def submitters(docxml, out)
|
105
107
|
f = docxml.at(ns("//submitters")) || return
|
108
|
+
@prefacenum += 1
|
106
109
|
out.div **{ class: "Section3" } do |div|
|
107
110
|
clause_name(anchor(f['id'], :label), "Submitters", div,
|
108
111
|
class: "IntroTitle")
|
@@ -110,14 +113,26 @@ module IsoDoc
|
|
110
113
|
end
|
111
114
|
end
|
112
115
|
|
116
|
+
def preface(isoxml, out)
|
117
|
+
title_attr = { class: "IntroTitle" }
|
118
|
+
isoxml.xpath(ns("//preface/clause")).each do |f|
|
119
|
+
@prefacenum += 1
|
120
|
+
out.div **{ class: "Section3", id: f["id"] } do |div|
|
121
|
+
clause_name(RomanNumerals.to_roman(@prefacenum).downcase,
|
122
|
+
f&.at(ns("./title")), div, title_attr)
|
123
|
+
f.elements.each { |e| parse(e, div) unless e.name == "title" }
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
113
128
|
def preface_names_numbered(clause)
|
114
129
|
return if clause.nil?
|
115
130
|
@prefacenum += 1
|
116
131
|
@anchors[clause["id"]] =
|
117
132
|
{ label: RomanNumerals.to_roman(@prefacenum).downcase,
|
118
133
|
level: 1, xref: preface_clause_name(clause), type: "clause" }
|
119
|
-
clause.xpath(ns("./clause | ./terms | ./term | ./definitions |
|
120
|
-
|
134
|
+
clause.xpath(ns("./clause | ./terms | ./term | ./definitions | "\
|
135
|
+
"./references")).each_with_index do |c, i|
|
121
136
|
section_names1(c, "#{@prefacenum}.#{i + 1}", 2)
|
122
137
|
end
|
123
138
|
end
|
@@ -144,6 +159,16 @@ module IsoDoc
|
|
144
159
|
end
|
145
160
|
end
|
146
161
|
|
162
|
+
def acknowledgements(isoxml, out)
|
163
|
+
f = isoxml.at(ns("//acknowledgements")) || return
|
164
|
+
@prefacenum += 1
|
165
|
+
out.div **{ class: "Section3", id: f["id"] } do |div|
|
166
|
+
clause_name(anchor(f["id"], :label), f&.at(ns("./title")), div,
|
167
|
+
class: "IntroTitle")
|
168
|
+
f.elements.each { |e| parse(e, div) unless e.name == "title" }
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
147
172
|
def example_parse(node, out)
|
148
173
|
name = node.at(ns("./name"))
|
149
174
|
sourcecode_name_parse(node, out, name) if name
|
@@ -158,15 +183,21 @@ module IsoDoc
|
|
158
183
|
preface_names_numbered(d.at(ns("//introduction")))
|
159
184
|
@prefacenum += 1 if d.at(ns(SUBMITTINGORGS))
|
160
185
|
preface_names_numbered(d.at(ns("//submitters")))
|
161
|
-
|
162
|
-
|
186
|
+
d.xpath(ns("//preface/clause")).each do |c|
|
187
|
+
preface_names_numbered(c)
|
188
|
+
end
|
189
|
+
preface_names_numbered(d.at(ns("//acknowledgements")))
|
190
|
+
sequential_asset_names(d.xpath(ns(
|
191
|
+
"//preface/abstract | //foreword | //introduction | "\
|
192
|
+
"//submitters | //acknowledgements | //preface/clause")))
|
163
193
|
n = section_names(d.at(ns("//clause[title = 'Scope']")), 0, 1)
|
164
194
|
n = section_names(d.at(ns("//clause[title = 'Conformance']")), n, 1)
|
165
195
|
n = section_names(d.at(ns(
|
166
196
|
"//references[title = 'Normative References' or "\
|
167
197
|
"title = 'Normative references']")), n, 1)
|
168
|
-
n = section_names(
|
169
|
-
|
198
|
+
n = section_names(
|
199
|
+
d.at(ns("//sections/terms | //sections/clause[descendant::terms]")),
|
200
|
+
n, 1)
|
170
201
|
n = section_names(d.at(ns("//sections/definitions")), n, 1)
|
171
202
|
middle_section_asset_names(d)
|
172
203
|
clause_names(d, n)
|
@@ -180,10 +211,10 @@ module IsoDoc
|
|
180
211
|
|
181
212
|
def middle_section_asset_names(d)
|
182
213
|
middle_sections = "//clause[title = 'Scope' or title = 'Conformance'] "\
|
183
|
-
"| //foreword | //introduction | "\
|
214
|
+
"| //foreword | //introduction | //preface/abstract | "\
|
215
|
+
"//submitters | //acknowledgements | //preface/clause | "\
|
184
216
|
"//references[title = 'Normative References' or title = "\
|
185
|
-
"'Normative references'] | "\
|
186
|
-
"//sections/terms | "\
|
217
|
+
"'Normative references'] | //sections/terms | "\
|
187
218
|
"//sections/definitions | //clause[parent::sections]"
|
188
219
|
sequential_asset_names(d.xpath(ns(middle_sections)))
|
189
220
|
end
|
@@ -193,9 +224,7 @@ module IsoDoc
|
|
193
224
|
out.div **attr_code(id: f["id"]) do |div|
|
194
225
|
num = num + 1
|
195
226
|
clause_name(num, "Conformance", div, nil)
|
196
|
-
f.elements.each
|
197
|
-
parse(e, div) unless e.name == "title"
|
198
|
-
end
|
227
|
+
f.elements.each { |e| parse(e, div) unless e.name == "title" }
|
199
228
|
end
|
200
229
|
num
|
201
230
|
end
|
data/lib/isodoc/ogc/metadata.rb
CHANGED
@@ -3,6 +3,35 @@ require "iso-639"
|
|
3
3
|
|
4
4
|
module IsoDoc
|
5
5
|
module Ogc
|
6
|
+
DOCTYPE_ABBR = {
|
7
|
+
"standard" => "IS",
|
8
|
+
"abstract-specification-topic" => "AST",
|
9
|
+
"best-practice" => "BP",
|
10
|
+
"change-request-supporting-document" => "CRSD",
|
11
|
+
"community-practice" => "CP",
|
12
|
+
"community-standard" => "CS",
|
13
|
+
"discussion-paper" => "DP",
|
14
|
+
"engineering-report" => "ER",
|
15
|
+
"policy" => "POL",
|
16
|
+
"reference-model" => "RM",
|
17
|
+
"release-notes" => "RN",
|
18
|
+
"test-suite" => "TS",
|
19
|
+
"user-guide" => "UG",
|
20
|
+
"white-paper" => "WP",
|
21
|
+
"other" => "other",
|
22
|
+
}
|
23
|
+
|
24
|
+
DOCSUBTYPE_ABBR = {
|
25
|
+
"implementation" => "IMP",
|
26
|
+
"conceptual-model" => "CM",
|
27
|
+
"conceptual-model-and-encoding" => "CME",
|
28
|
+
"conceptual-model-and-implementation" => "CMI",
|
29
|
+
"encoding" => "EN",
|
30
|
+
"extension" => "EXT",
|
31
|
+
"profile" => "PF",
|
32
|
+
"profile-with-extension" => "PFE",
|
33
|
+
"general" => "GE",
|
34
|
+
}
|
6
35
|
|
7
36
|
class Metadata < IsoDoc::Metadata
|
8
37
|
def initialize(lang, script, labels)
|
@@ -86,10 +115,22 @@ module IsoDoc
|
|
86
115
|
end
|
87
116
|
|
88
117
|
def doctype(isoxml, _out)
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
118
|
+
if t = isoxml&.at(ns("//bibdata/ext/doctype"))&.text
|
119
|
+
set(:doctype, type_capitalise(t))
|
120
|
+
set(:doctype_abbr, doctype_abbr(t))
|
121
|
+
if st = isoxml&.at(ns("//bibdata/ext/docsubtype"))&.text
|
122
|
+
set(:docsubtype, type_capitalise(st))
|
123
|
+
set(:docsubtype_abbr, docsubtype_abbr(st, t))
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def doctype_abbr(b)
|
129
|
+
IsoDoc::Ogc::DOCTYPE_ABBR[b] || b
|
130
|
+
end
|
131
|
+
|
132
|
+
def docsubtype_abbr(st, t)
|
133
|
+
IsoDoc::Ogc::DOCSUBTYPE_ABBR[st] || st
|
93
134
|
end
|
94
135
|
|
95
136
|
def status_print(status)
|
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: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|