metanorma-ogc 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eea51c0d090677e7d33baba438144ba8124e0013784531aad6157444eb64fe78
4
- data.tar.gz: 7fda2b26713c8075c24307ec3db64547de91920540c88b64d029fbf40e59fb56
3
+ metadata.gz: c479fe29661043d57d71fe5685ac2896c5ecc2ec2813a6ba0a7447001e267c0f
4
+ data.tar.gz: 6566850cc12d813e37b340a257be263e0da139684242e4afff42610a146e8317
5
5
  SHA512:
6
- metadata.gz: 9c2e579039e84e10a4f3d91ee1da183e220c1d4d337b6a3bdfb7032d2f706603fba5618b94f854ca6fbb076de01b014496f7f8e3500cbc7b9307542753b35867
7
- data.tar.gz: 9e4d01426f51cbe26229d864578c1a2e24c6cdd3a04b3f6346abb6a5e90895d7698701f7cc4716b044d2b0ba96a55c0a65b8a552e77f6626eb88652da4d595cf
6
+ metadata.gz: 203e38a7f20a0cccb389c3298dfdd6bb455c0c9f09bb54531c14d3cf77b478e8a86e0e1737e6d9ff7c208256fb935ba4cce83d7046a2e8a61361e9a953be7d11
7
+ data.tar.gz: 4e5cc582d36eb993928dec698abdafeb4fed9ee1aee7124f1459ca4a10c5988017060f2cd1cf95e233f467c4c9077384f2b0061eb2b8581d4a0a679bffad3bdd
data/.travis.yml CHANGED
@@ -1,15 +1,18 @@
1
- dist: trusty
2
- sudo: false
3
1
  language: ruby
2
+ cache: bundler
3
+ os:
4
+ - linux
5
+ - osx
4
6
  rvm:
5
- - 2.5
6
- - 2.4
7
- - 2.3
8
- - ruby-head
7
+ - 2.5
8
+ - 2.4
9
+ - 2.3
10
+ - ruby-head
9
11
  before_install:
10
- - gem install bundler -v 2.0.1
11
- - travis_retry sudo apt-get update
12
- - sudo bash -c "curl -L https://raw.githubusercontent.com/metanorma/metanorma-linux-setup/master/ubuntu-install-puppeteer.sh | bash"
12
+ - nvm install 8
13
+ - npm install -g puppeteer
14
+ - gem install bundler -v 2.0.1
15
+ - bundle update
13
16
  matrix:
14
17
  allow_failures:
15
18
  - rvm: ruby-head
@@ -636,22 +636,27 @@
636
636
  <ref name="ISO8601Date"/>
637
637
  </optional>
638
638
  </define>
639
+ <define name="BibliographicDateType">
640
+ <choice>
641
+ <value>published</value>
642
+ <value>accessed</value>
643
+ <value>created</value>
644
+ <value>implemented</value>
645
+ <value>obsoleted</value>
646
+ <value>confirmed</value>
647
+ <value>updated</value>
648
+ <value>issued</value>
649
+ <value>transmitted</value>
650
+ <value>copied</value>
651
+ <value>unchanged</value>
652
+ <value>circulated</value>
653
+ </choice>
654
+ </define>
639
655
  <define name="bdate">
640
656
  <element name="date">
641
657
  <attribute name="type">
642
658
  <choice>
643
- <value>published</value>
644
- <value>accessed</value>
645
- <value>created</value>
646
- <value>implemented</value>
647
- <value>obsoleted</value>
648
- <value>confirmed</value>
649
- <value>updated</value>
650
- <value>issued</value>
651
- <value>transmitted</value>
652
- <value>copied</value>
653
- <value>unchanged</value>
654
- <value>circulated</value>
659
+ <ref name="BibliographicDateType"/>
655
660
  <text/>
656
661
  </choice>
657
662
  </attribute>
@@ -174,6 +174,9 @@ module Asciidoctor
174
174
 
175
175
  def example(node)
176
176
  return term_example(node) if in_terms?
177
+ return requirement(node, "recommendation") if node.attr("style") == "recommendation"
178
+ return requirement(node, "requirement") if node.attr("style") == "requirement"
179
+ return requirement(node, "permission") if node.attr("style") == "permission"
177
180
  noko do |xml|
178
181
  xml.example **id_attr(node) do |ex|
179
182
  figure_title(node, ex)
@@ -0,0 +1,338 @@
1
+ require "isodoc"
2
+ require_relative "metadata"
3
+ require "fileutils"
4
+
5
+ module IsoDoc
6
+ module Ogc
7
+ module BaseConvert
8
+ def annex_name(annex, name, div)
9
+ div.h1 **{ class: "Annex" } do |t|
10
+ t << "#{get_anchors[annex['id']][:label]} "
11
+ t.br
12
+ t.b do |b|
13
+ name&.children&.each { |c2| parse(c2, b) }
14
+ end
15
+ end
16
+ end
17
+
18
+ def term_defs_boilerplate(div, source, term, preface)
19
+ if source.empty? && term.nil?
20
+ div << @no_terms_boilerplate
21
+ else
22
+ div << term_defs_boilerplate_cont(source, term)
23
+ end
24
+ end
25
+
26
+ def fileloc(loc)
27
+ File.join(File.dirname(__FILE__), loc)
28
+ end
29
+
30
+ def cleanup(docxml)
31
+ super
32
+ term_cleanup(docxml)
33
+ end
34
+
35
+ def term_cleanup(docxml)
36
+ docxml.xpath("//p[@class = 'Terms']").each do |d|
37
+ h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
38
+ h2.add_child("&nbsp;")
39
+ h2.add_child(d.remove)
40
+ end
41
+ docxml
42
+ end
43
+
44
+ def info(isoxml, out)
45
+ @meta.keywords isoxml, out
46
+ super
47
+ end
48
+
49
+ def load_yaml(lang, script)
50
+ y = if @i18nyaml then YAML.load_file(@i18nyaml)
51
+ elsif lang == "en"
52
+ YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
53
+ else
54
+ YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
55
+ end
56
+ super.merge(y)
57
+ end
58
+
59
+ def keywords(_docxml, out)
60
+ kw = @meta.get[:keywords]
61
+ kw.empty? and return
62
+ @prefacenum += 1
63
+ out.div **{ class: "Section3" } do |div|
64
+ clause_name(RomanNumerals.to_roman(@prefacenum).downcase, "Keywords", div, class: "IntroTitle")
65
+ div.p "The following are keywords to be used by search engines and document catalogues."
66
+ div.p kw.join(", ")
67
+ end
68
+ end
69
+
70
+ SUBMITTINGORGS =
71
+ "//bibdata/contributor[role/@type = 'author']/organization/name".freeze
72
+
73
+ def submittingorgs(docxml, out)
74
+ orgs = []
75
+ docxml.xpath(ns(SUBMITTINGORGS)).each { |org| orgs << org.text }
76
+ return if orgs.empty?
77
+ @prefacenum += 1
78
+ out.div **{ class: "Section3" } do |div|
79
+ clause_name(RomanNumerals.to_roman(@prefacenum).downcase, "Submitting Organizations", div, class: "IntroTitle")
80
+ div.p "The following organizations submitted this Document to the Open Geospatial Consortium (OGC):"
81
+ div.ul do |ul|
82
+ orgs.each do |org|
83
+ ul.li org
84
+ end
85
+ end
86
+ end
87
+ end
88
+
89
+ def submitters(docxml, out)
90
+ f = docxml.at(ns("//submitters")) || return
91
+ out.div **{ class: "Section3" } do |div|
92
+ clause_name(get_anchors[f['id']][:label], "Submitters", div, class: "IntroTitle")
93
+ f.elements.each { |e| parse(e, div) unless e.name == "title" }
94
+ end
95
+ end
96
+
97
+ def preface_names(clause)
98
+ return if clause.nil?
99
+ @prefacenum += 1
100
+ @anchors[clause["id"]] =
101
+ { label: RomanNumerals.to_roman(@prefacenum).downcase,
102
+ level: 1, xref: preface_clause_name(clause), type: "clause" }
103
+ clause.xpath(ns("./clause | ./terms | ./term | ./definitions")).each_with_index do |c, i|
104
+ section_names1(c, "#{@prefacenum}.#{i + 1}", 2)
105
+ end
106
+ end
107
+
108
+ def abstract(isoxml, out)
109
+ f = isoxml.at(ns("//preface/abstract")) || return
110
+ @prefacenum += 1
111
+ page_break(out)
112
+ out.div **attr_code(id: f["id"]) do |s|
113
+ clause_name(get_anchors[f["id"]][:label], @abstract_lbl, s, class: "AbstractTitle")
114
+ f.elements.each { |e| parse(e, s) unless e.name == "title" }
115
+ end
116
+ end
117
+
118
+ def foreword(isoxml, out)
119
+ f = isoxml.at(ns("//foreword")) || return
120
+ @prefacenum += 1
121
+ page_break(out)
122
+ out.div **attr_code(id: f["id"]) do |s|
123
+ clause_name(get_anchors[f["id"]][:label], @foreword_lbl, s, class: "ForewordTitle")
124
+ f.elements.each { |e| parse(e, s) unless e.name == "title" }
125
+ end
126
+ end
127
+
128
+ def example_parse(node, out)
129
+ name = node.at(ns("./name"))
130
+ sourcecode_name_parse(node, out, name) if name
131
+ super
132
+ end
133
+
134
+ def error_parse(node, out)
135
+ case node.name
136
+ when "recommendation" then recommendation_parse(node, out)
137
+ when "requirement" then requirement_parse(node, out)
138
+ when "permission" then permission_parse(node, out)
139
+ else
140
+ super
141
+ end
142
+ end
143
+
144
+ def anchor_names(docxml)
145
+ super
146
+ recommendation_anchor_names(docxml)
147
+ requirement_anchor_names(docxml)
148
+ permission_anchor_names(docxml)
149
+ end
150
+
151
+ def recommendation_anchor_names(docxml)
152
+ docxml.xpath(ns("//recommendation")).each_with_index do |x, i|
153
+ @anchors[x["id"]] = anchor_struct(i+1, nil, "Recommendation", "recommendation")
154
+ end
155
+ end
156
+
157
+ def requirement_anchor_names(docxml)
158
+ docxml.xpath(ns("//requirement")).each_with_index do |x, i|
159
+ @anchors[x["id"]] = anchor_struct(i+1, nil, "Requirement", "requirement")
160
+ end
161
+ end
162
+
163
+ def permission_anchor_names(docxml)
164
+ docxml.xpath(ns("//permission")).each_with_index do |x, i|
165
+ @anchors[x["id"]] = anchor_struct(i+1, nil, "Permission", "permission")
166
+ end
167
+ end
168
+
169
+ def recommend_table_attr(node)
170
+ attr_code(id: node["id"], class: "recommend",
171
+ cellspacing: 0, cellpadding: 0,
172
+ style: "border-collapse:collapse" )
173
+ end
174
+
175
+ REQ_TBL_ATTR =
176
+ { valign: "top", class: "example_label",
177
+ style: "width:100.0pt;padding:0 0 0 1em;margin-left:0pt" }.freeze
178
+
179
+ def recommend_name_parse(node, div)
180
+ name = node&.at(ns("./name"))&.text or return
181
+ div.p do |p|
182
+ p.b name
183
+ end
184
+ end
185
+
186
+ def recommendation_parse(node, out)
187
+ out.table **recommend_table_attr(node) do |t|
188
+ t.tr do |tr|
189
+ tr.td **REQ_TBL_ATTR do |td|
190
+ recommendation_label(node, td)
191
+ end
192
+ tr.td **{ valign: "top", class: "recommend" } do |td|
193
+ recommend_name_parse(node, td)
194
+ node.children.each { |n| parse(n, td) unless n.name == "name" }
195
+ end
196
+ end
197
+ end
198
+ end
199
+
200
+ def recommendation_label(node, out)
201
+ n = get_anchors[node["id"]]
202
+ label = (n.nil? || n[:label].empty?) ?
203
+ "Recommendation" : l10n("#{"Recommendation"} #{n[:label]}")
204
+ out.p **{class: "RecommendationTitle" } do |p|
205
+ p << label
206
+ end
207
+ end
208
+
209
+ def requirement_parse(node, out)
210
+ out.table **recommend_table_attr(node) do |t|
211
+ t.tr do |tr|
212
+ tr.td **REQ_TBL_ATTR do |td|
213
+ requirement_label(node, td)
214
+ end
215
+ tr.td **{ valign: "top", class: "recommend" } do |td|
216
+ recommend_name_parse(node, td)
217
+ node.children.each { |n| parse(n, td) unless n.name == "name" }
218
+ end
219
+ end
220
+ end
221
+ end
222
+
223
+ def requirement_label(node, out)
224
+ n = get_anchors[node["id"]]
225
+ label = (n.nil? || n[:label].empty?) ?
226
+ "Requirement" : l10n("#{"Requirement"} #{n[:label]}")
227
+ out.p **{class: "RecommendationTitle" } do |p|
228
+ p << label
229
+ end
230
+ end
231
+
232
+ def permission_parse(node, out)
233
+ out.table **recommend_table_attr(node) do |t|
234
+ t.tr do |tr|
235
+ tr.td **REQ_TBL_ATTR do |td|
236
+ permission_label(node, td)
237
+ end
238
+ tr.td **{ valign: "top", class: "recommend" } do |td|
239
+ recommend_name_parse(node, td)
240
+ node.children.each { |n| parse(n, td) unless n.name == "name" }
241
+ end
242
+ end
243
+ end
244
+ end
245
+
246
+ def permission_label(node, out)
247
+ n = get_anchors[node["id"]]
248
+ label = (n.nil? || n[:label].empty?) ?
249
+ "Permission" : l10n("#{"Permission"} #{n[:label]}")
250
+ out.p **{class: "RecommendationTitle" } do |p|
251
+ p << label
252
+ end
253
+ end
254
+
255
+ def initial_anchor_names(d)
256
+ @prefacenum = 0
257
+ preface_names(d.at(ns("//preface/abstract")))
258
+ @prefacenum += 1 if d.at(ns("//keyword"))
259
+ preface_names(d.at(ns("//foreword")))
260
+ #preface_names(d.at(ns("//introduction")))
261
+ @prefacenum += 1 if d.at(ns(SUBMITTINGORGS))
262
+ preface_names(d.at(ns("//submitters")))
263
+ sequential_asset_names(d.xpath(ns("//preface/abstract | //foreword | //introduction | //submitters")))
264
+ n = section_names(d.at(ns("//clause[title = 'Scope']")), 0, 1)
265
+ n = section_names(d.at(ns("//clause[title = 'Conformance']")), n, 1)
266
+ n = section_names(d.at(ns(
267
+ "//references[title = 'Normative References' or title = 'Normative references']")), n, 1)
268
+ n = section_names(d.at(ns("//sections/terms | "\
269
+ "//sections/clause[descendant::terms]")), n, 1)
270
+ n = section_names(d.at(ns("//sections/definitions")), n, 1)
271
+ middle_section_asset_names(d)
272
+ clause_names(d, n)
273
+ termnote_anchor_names(d)
274
+ termexample_anchor_names(d)
275
+ end
276
+
277
+ MIDDLE_CLAUSE =
278
+ "//clause[parent::sections][not(xmlns:title = 'Scope' or xmlns:title = 'Conformance')]"\
279
+ "[not(descendant::terms)]".freeze
280
+
281
+ def middle_section_asset_names(d)
282
+ middle_sections = "//clause[title = 'Scope' or title = 'Conformance'] | "\
283
+ "//foreword | //introduction | "\
284
+ "//references[title = 'Normative References' or title = 'Normative references'] | "\
285
+ "//sections/terms | "\
286
+ "//sections/definitions | //clause[parent::sections]"
287
+ sequential_asset_names(d.xpath(ns(middle_sections)))
288
+ end
289
+
290
+ =begin
291
+ def clause_names(docxml, sect_num)
292
+ docxml.xpath(ns(self.class::MIDDLE_CLAUSE)).each_with_index do |c, i|
293
+ section_names(c, (i + sect_num), 1)
294
+ end
295
+ end
296
+ =end
297
+
298
+ def conformance(isoxml, out, num)
299
+ f = isoxml.at(ns("//clause[title = 'Conformance']")) or return num
300
+ out.div **attr_code(id: f["id"]) do |div|
301
+ num = num + 1
302
+ clause_name(num, "Conformance", div, nil)
303
+ f.elements.each do |e|
304
+ parse(e, div) unless e.name == "title"
305
+ end
306
+ end
307
+ num
308
+ end
309
+
310
+ =begin
311
+ def clause(isoxml, out, num)
312
+ isoxml.xpath(ns(self.class::MIDDLE_CLAUSE)).each do |c|
313
+ out.div **attr_code(id: c["id"]) do |div|
314
+ num = num + 1
315
+ clause_name(num,
316
+ c&.at(ns("./title"))&.content, div, nil)
317
+ c.elements.each do |e|
318
+ parse(e, div) unless e.name == "title"
319
+ end
320
+ end
321
+ end
322
+ end
323
+ =end
324
+
325
+ def middle(isoxml, out)
326
+ middle_title(out)
327
+ i = scope isoxml, out, 0
328
+ i = conformance isoxml, out, i
329
+ i = norm_ref isoxml, out, i
330
+ i = terms_defs isoxml, out, i
331
+ i = symbols_abbrevs isoxml, out, i
332
+ clause isoxml, out
333
+ annex isoxml, out
334
+ bibliography isoxml, out
335
+ end
336
+ end
337
+ end
338
+ end
@@ -84,6 +84,7 @@
84
84
  </div>
85
85
  </div>
86
86
 
87
+ {% if status == "Published" or status == "Withdrawn" %}
87
88
  {% if doctype == "Standard" or doctype == "Standard With Suite" %}
88
89
  <div class="coverpage-warning">
89
90
  <span class="title">Warning</span>
@@ -126,18 +127,36 @@
126
127
  </div>
127
128
  {% endif %}
128
129
 
129
- {% if status != "Published" and status != "Withdrawn" %}
130
+ {% else %}
130
131
  <div class="coverpage-warning">
131
132
  <span class="title">Warning for Drafts</span>
132
133
 
133
- <p class="content">
134
- This document is not a OGC Standard. It is distributed for review and
135
- comment, and is subject to change without notice and may not be referred to as
136
- a Standard.</p>
137
- <p class="content">Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. The Open Geospatial Consortium Inc. shall not be held responsible for identifying any or all such patent rights.
138
- </p>
139
- <p class="content">Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by any implementation of the standard set forth in this document, and to provide supporting documentation.
140
- </p>
134
+ {% if doctype == "Standard" or doctype == "Standard With Suite" %}
135
+ <p class="content">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>
136
+
137
+ <p class="content">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>
138
+ {% endif %}
139
+
140
+ {% if doctype == "Best Practice" %}
141
+ <p class="content">This document defines an OGC Best Practice on a particular technology or approach related to an OGC standard. This document is not 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 official position of the OGC membership on this particular technology topic.
142
+
143
+ <p class="content">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>
144
+ {% endif %}
145
+
146
+ {% if doctype == "Discussion Paper" %}
147
+ <p class="content">This document is not an OGC Standard. This document is an OGC Discussion Paper 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. Further, an OGC Discussion Paper should not be referenced as required or mandatory technology in procurements.</p>
148
+ {% endif %}
149
+
150
+ {% if doctype == "White Paper" %}
151
+ <p class="content">This document is not an OGC Standard. This document is an OGC White Paper 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. Further, an OGC White Paper should not be referenced as required or mandatory technology in procurements.</p>
152
+ {% endif %}
153
+
154
+ {% if doctype == "Release Notes" %}
155
+ <p class="content">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.
156
+
157
+ <p class="content">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>
158
+ {% endif %}
159
+
141
160
  </div>
142
161
  {% endif %}
143
162