metanorma-ogc 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@ module IsoDoc
7
7
  module BaseConvert
8
8
  def annex_name(annex, name, div)
9
9
  div.h1 **{ class: "Annex" } do |t|
10
- t << "#{get_anchors[annex['id']][:label]} "
10
+ t << "#{anchor(annex['id'], :label)} "
11
11
  t.br
12
12
  t.b do |b|
13
13
  name&.children&.each { |c2| parse(c2, b) }
@@ -89,7 +89,7 @@ module IsoDoc
89
89
  def submitters(docxml, out)
90
90
  f = docxml.at(ns("//submitters")) || return
91
91
  out.div **{ class: "Section3" } do |div|
92
- clause_name(get_anchors[f['id']][:label], "Submitters", div, class: "IntroTitle")
92
+ clause_name(anchor(f['id'], :label), "Submitters", div, class: "IntroTitle")
93
93
  f.elements.each { |e| parse(e, div) unless e.name == "title" }
94
94
  end
95
95
  end
@@ -110,7 +110,7 @@ module IsoDoc
110
110
  @prefacenum += 1
111
111
  page_break(out)
112
112
  out.div **attr_code(id: f["id"]) do |s|
113
- clause_name(get_anchors[f["id"]][:label], @abstract_lbl, s, class: "AbstractTitle")
113
+ clause_name(anchor(f["id"], :label), @abstract_lbl, s, class: "AbstractTitle")
114
114
  f.elements.each { |e| parse(e, s) unless e.name == "title" }
115
115
  end
116
116
  end
@@ -120,7 +120,7 @@ module IsoDoc
120
120
  @prefacenum += 1
121
121
  page_break(out)
122
122
  out.div **attr_code(id: f["id"]) do |s|
123
- clause_name(get_anchors[f["id"]][:label], @foreword_lbl, s, class: "ForewordTitle")
123
+ clause_name(anchor(f["id"], :label), @foreword_lbl, s, class: "ForewordTitle")
124
124
  f.elements.each { |e| parse(e, s) unless e.name == "title" }
125
125
  end
126
126
  end
@@ -149,20 +149,29 @@ module IsoDoc
149
149
  end
150
150
 
151
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")
152
+ i = 0
153
+ docxml.xpath(ns("//recommendation")).each do |x|
154
+ next if x["id"].nil? || x["id"].empty?
155
+ @anchors[x["id"]] = anchor_struct(i+1, nil, "Recommendation", "recommendation", x["unnumbered"])
156
+ i += 1 unless x["unnumbered"]
154
157
  end
155
158
  end
156
159
 
157
160
  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")
161
+ i = 0
162
+ docxml.xpath(ns("//requirement")).each_with_index do |x|
163
+ next if x["id"].nil? || x["id"].empty?
164
+ @anchors[x["id"]] = anchor_struct(i+1, nil, "Requirement", "requirement", x["unnumbered"])
165
+ i += 1 unless x["unnumbered"]
160
166
  end
161
167
  end
162
168
 
163
169
  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")
170
+ i = 0
171
+ docxml.xpath(ns("//permission")).each do |x|
172
+ next if x["id"].nil? || x["id"].empty?
173
+ @anchors[x["id"]] = anchor_struct(i+1, nil, "Permission", "permission", x["unnumbered"])
174
+ i += 1 unless x["unnumbered"]
166
175
  end
167
176
  end
168
177
 
@@ -199,7 +208,7 @@ module IsoDoc
199
208
 
200
209
  def recommendation_label(node, out)
201
210
  n = get_anchors[node["id"]]
202
- label = (n.nil? || n[:label].empty?) ?
211
+ label = (n.nil? || n[:label].nil? || n[:label].empty?) ?
203
212
  "Recommendation" : l10n("#{"Recommendation"} #{n[:label]}")
204
213
  out.p **{class: "RecommendationTitle" } do |p|
205
214
  p << label
@@ -222,7 +231,7 @@ module IsoDoc
222
231
 
223
232
  def requirement_label(node, out)
224
233
  n = get_anchors[node["id"]]
225
- label = (n.nil? || n[:label].empty?) ?
234
+ label = (n.nil? || n[:label].nil? || n[:label].empty?) ?
226
235
  "Requirement" : l10n("#{"Requirement"} #{n[:label]}")
227
236
  out.p **{class: "RecommendationTitle" } do |p|
228
237
  p << label
@@ -245,7 +254,7 @@ module IsoDoc
245
254
 
246
255
  def permission_label(node, out)
247
256
  n = get_anchors[node["id"]]
248
- label = (n.nil? || n[:label].empty?) ?
257
+ label = (n.nil? || n[:label].nil? || n[:label].empty?) ?
249
258
  "Permission" : l10n("#{"Permission"} #{n[:label]}")
250
259
  out.p **{class: "RecommendationTitle" } do |p|
251
260
  p << label
@@ -257,7 +266,7 @@ module IsoDoc
257
266
  preface_names(d.at(ns("//preface/abstract")))
258
267
  @prefacenum += 1 if d.at(ns("//keyword"))
259
268
  preface_names(d.at(ns("//foreword")))
260
- #preface_names(d.at(ns("//introduction")))
269
+ preface_names(d.at(ns("//introduction")))
261
270
  @prefacenum += 1 if d.at(ns(SUBMITTINGORGS))
262
271
  preface_names(d.at(ns("//submitters")))
263
272
  sequential_asset_names(d.xpath(ns("//preface/abstract | //foreword | //introduction | //submitters")))
@@ -1,5 +1,5 @@
1
- <div class="document-stage-band" id='{{ status | downcase | replace: " ", "-" }}-band'>
2
- <p class="document-stage">{{ status }}</p>
1
+ <div class="document-stage-band" id='{{ stage | downcase | replace: " ", "-" }}-band'>
2
+ <p class="document-stage">{{ stage }}</p>
3
3
  </div>
4
4
 
5
5
  <div class="document-type-band" id='{{ doctype | downcase | replace: " ", "-" }}-band'>
@@ -80,11 +80,11 @@
80
80
  </div>
81
81
 
82
82
  <div class="coverpage-stage-block" >
83
- <p><span class="coverpage-maturity" id="{{ status | replace: ' ', '-' | downcase }}">{{ status }}</span></p>
83
+ <p><span class="coverpage-maturity" id="{{ stage | replace: ' ', '-' | downcase }}">{{ stage }}</span></p>
84
84
  </div>
85
85
  </div>
86
86
 
87
- {% if status == "Published" or status == "Withdrawn" %}
87
+ {% if stage == "Published" or stage == "Withdrawn" %}
88
88
  {% if doctype == "Standard" or doctype == "Standard With Suite" %}
89
89
  <div class="coverpage-warning">
90
90
  <span class="title">Warning</span>
@@ -49,7 +49,7 @@ style='mso-color-alt:windowtext'><a href="http://www.opengeospatial.org/legal/">
49
49
  style='mso-color-alt:windowtext'>http://www.opengeospatial.org/legal/</span></a></span></span>.<b
50
50
  style='mso-bidi-font-weight:normal'><o:p></o:p></b></span></p>
51
51
 
52
- {% if status == "Published" or status == "Withdrawn" %}
52
+ {% if stage == "Published" or stage == "Withdrawn" %}
53
53
 
54
54
  {% if doctype == "Standard" or doctype == "Standard With Suite" %}
55
55
  <p class="MsoNormal" align="center" style='margin-bottom:6.0pt;text-align:center;
@@ -99,7 +99,7 @@ style='font-size:10.0pt;mso-bidi-font-size:11.0pt;mso-bidi-font-weight:bold'>Thi
99
99
  <o:p></o:p></span></p>
100
100
  {% endif %}
101
101
 
102
- {% if status == "Policy" %}
102
+ {% if stage == "Policy" %}
103
103
  <p class="MsoNormal" align="center" style='margin-bottom:6.0pt;text-align:center;
104
104
  border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:
105
105
  1.0pt 4.0pt 1.0pt 4.0pt'><b style='mso-bidi-font-weight:normal'><span
@@ -186,7 +186,7 @@ page;mso-element-left:39.9pt;mso-element-top:693.25pt;mso-height-rule:exactly'>
186
186
  auto;mso-element-anchor-vertical:page;mso-element-anchor-horizontal:page;
187
187
  mso-element-left:39.9pt;mso-element-top:693.25pt;mso-height-rule:exactly'><span
188
188
  lang=EN-GB style='font-size:10.0pt;mso-color-alt:windowtext;font-weight:normal'>Document
189
- stage:&nbsp;&nbsp;&nbsp;<span style='mso-tab-count:1'>        </span>{{ status }}<o:p></o:p></span></p>
189
+ stage:&nbsp;&nbsp;&nbsp;<span style='mso-tab-count:1'>        </span>{{ stage }}<o:p></o:p></span></p>
190
190
  <p class=zzCover align=left style='margin-bottom:0cm;margin-bottom:.0001pt;
191
191
  text-align:left;mso-hyphenate:none;tab-stops:99.0pt;mso-element:frame;
192
192
  mso-element-frame-hspace:7.1pt;mso-element-frame-vspace:7.1pt;mso-element-wrap:
@@ -74,6 +74,7 @@ module IsoDoc
74
74
  abstract docxml, div3
75
75
  keywords docxml, div3
76
76
  foreword docxml, div3
77
+ introduction docxml, div3
77
78
  submittingorgs docxml, div3
78
79
  submitters docxml, div3
79
80
  middle docxml, div3
@@ -7,7 +7,6 @@ module IsoDoc
7
7
  class Metadata < IsoDoc::Metadata
8
8
  def initialize(lang, script, labels)
9
9
  super
10
- set(:status, "XXX")
11
10
  end
12
11
 
13
12
  def title(isoxml, _out)
@@ -20,7 +19,7 @@ module IsoDoc
20
19
  end
21
20
 
22
21
  def author(isoxml, _out)
23
- tc = isoxml.at(ns("//bibdata/editorialgroup/committee"))
22
+ tc = isoxml.at(ns("//bibdata/ext/editorialgroup/committee"))
24
23
  set(:tc, tc.text) if tc
25
24
  authors = isoxml.xpath(ns("//bibdata/contributor[role/@type = 'author']/person"))
26
25
  set(:authors, extract_person_names(authors))
@@ -33,16 +32,12 @@ module IsoDoc
33
32
  set(:externalid, isoxml&.at(ns("//bibdata/docidentifier[@type = 'ogc-external']"))&.text)
34
33
  end
35
34
 
36
- def status_print(status)
37
- status.split(/-/).map{ |w| w.capitalize }.join(" ")
38
- end
39
-
40
35
  def status_abbr(status)
41
36
  end
42
37
 
43
38
  def keywords(isoxml, _out)
44
39
  keywords = []
45
- isoxml.xpath(ns("//bibdata/keyword")).each do |kw|
40
+ isoxml.xpath(ns("//bibdata/ext/keyword")).each do |kw|
46
41
  keywords << kw.text
47
42
  end
48
43
  set(:keywords, keywords)
@@ -52,7 +47,7 @@ module IsoDoc
52
47
  super
53
48
  revdate = get[:revdate]
54
49
  set(:revdate_monthyear, monthyr(revdate))
55
- set(:edition, isoxml&.at(ns("//version/edition"))&.text)
50
+ set(:edition, isoxml&.at(ns("//bibdata/edition"))&.text)
56
51
  set(:language, ISO_639.find_by_code(isoxml&.at(ns("//bibdata/language"))&.text))
57
52
  end
58
53
 
@@ -81,6 +76,14 @@ module IsoDoc
81
76
  super
82
77
  a = xml.at(ns("//bibdata/uri[@type = 'previous']")) and set(:previousuri, a.text)
83
78
  end
79
+
80
+ def doctype(isoxml, _out)
81
+ b = isoxml&.at(ns("//bibdata/ext/doctype"))&.text || return
82
+ t = b.split(/[- ]/).map do |w|
83
+ w.capitalize unless %w(SWG).include? w
84
+ end.join(" ")
85
+ set(:doctype, t)
86
+ end
84
87
  end
85
88
  end
86
89
  end
@@ -72,6 +72,7 @@ module IsoDoc
72
72
  abstract docxml, div3
73
73
  keywords docxml, div3
74
74
  foreword docxml, div3
75
+ introduction docxml, div3
75
76
  submittingorgs docxml, div3
76
77
  submitters docxml, div3
77
78
  middle docxml, div3
@@ -140,6 +140,7 @@ module IsoDoc
140
140
  abstract docxml, div2
141
141
  keywords docxml, div2
142
142
  foreword docxml, div2
143
+ introduction docxml, div2
143
144
  submittingorgs docxml, div2
144
145
  submitters docxml, div2
145
146
  div2.p { |p| p << "&nbsp;" } # placeholder
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "0.0.9"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -22,12 +22,13 @@ Gem::Specification.new do |spec|
22
22
  spec.bindir = "exe"
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
25
26
 
26
27
  spec.add_dependency "asciidoctor", "~> 1.5.7"
27
28
  spec.add_dependency "htmlentities", "~> 4.3.4"
28
29
  spec.add_dependency "ruby-jing"
29
- spec.add_dependency "metanorma-standoc", "~> 1.1.0"
30
- spec.add_dependency "isodoc", "~> 0.9.0"
30
+ spec.add_dependency "metanorma-standoc", "~> 1.2.0"
31
+ spec.add_dependency "isodoc", "~> 0.10.0"
31
32
  spec.add_dependency "iso-639"
32
33
 
33
34
  spec.add_development_dependency "bundler", "~> 2.0.1"
@@ -41,5 +42,4 @@ Gem::Specification.new do |spec|
41
42
  spec.add_development_dependency "simplecov", "~> 0.15"
42
43
  spec.add_development_dependency "timecop", "~> 0.9"
43
44
  spec.add_development_dependency "metanorma", "~> 0.3.0"
44
- spec.add_development_dependency "metanorma-cli", "~> 1.1.2"
45
45
  end
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: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-14 00:00:00.000000000 Z
11
+ date: 2019-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.1.0
61
+ version: 1.2.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.1.0
68
+ version: 1.2.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: isodoc
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.9.0
75
+ version: 0.10.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.9.0
82
+ version: 0.10.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: iso-639
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -248,20 +248,6 @@ dependencies:
248
248
  - - "~>"
249
249
  - !ruby/object:Gem::Version
250
250
  version: 0.3.0
251
- - !ruby/object:Gem::Dependency
252
- name: metanorma-cli
253
- requirement: !ruby/object:Gem::Requirement
254
- requirements:
255
- - - "~>"
256
- - !ruby/object:Gem::Version
257
- version: 1.1.2
258
- type: :development
259
- prerelease: false
260
- version_requirements: !ruby/object:Gem::Requirement
261
- requirements:
262
- - - "~>"
263
- - !ruby/object:Gem::Version
264
- version: 1.1.2
265
251
  description: 'Metanorma for the Open Geospatial Consortium.
266
252
 
267
253
  '
@@ -293,6 +279,7 @@ files:
293
279
  - lib/asciidoctor/ogc/isostandard.rng
294
280
  - lib/asciidoctor/ogc/ogc.rng
295
281
  - lib/asciidoctor/ogc/reqt.rng
282
+ - lib/asciidoctor/ogc/validate.rb
296
283
  - lib/isodoc/ogc.rb
297
284
  - lib/isodoc/ogc/base_convert.rb
298
285
  - lib/isodoc/ogc/html/header.html
@@ -327,7 +314,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
327
314
  requirements:
328
315
  - - ">="
329
316
  - !ruby/object:Gem::Version
330
- version: '0'
317
+ version: 2.4.0
331
318
  required_rubygems_version: !ruby/object:Gem::Requirement
332
319
  requirements:
333
320
  - - ">="
@@ -335,7 +322,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
335
322
  version: '0'
336
323
  requirements: []
337
324
  rubyforge_project:
338
- rubygems_version: 2.7.6
325
+ rubygems_version: 2.7.7
339
326
  signing_key:
340
327
  specification_version: 4
341
328
  summary: Metanorma for the Open Geospatial Consortium.