metanorma-ogc 1.3.3 → 1.3.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -154,6 +154,7 @@ module IsoDoc
154
154
  end
155
155
 
156
156
  def references(docxml)
157
+ super
157
158
  docxml.xpath(ns("//bibitem/date")).each do |d|
158
159
  d.xpath(ns("./on | ./from | ./to")).each do |d1|
159
160
  d1.children = d1.text.sub(/^(\d\d\d\d).*$/, "\\1")
@@ -1,10 +1,10 @@
1
1
  module IsoDoc
2
2
  module Ogc
3
3
  module BaseConvert
4
- def intro_clause(f, out)
5
- out.div **{ class: "Section3", id: f["id"] } do |div|
6
- clause_name(nil, f&.at(ns("./title")), div, class: "IntroTitle")
7
- f.elements.each { |e| parse(e, div) unless e.name == "title" }
4
+ def intro_clause(elem, out)
5
+ out.div **{ class: "Section3", id: elem["id"] } do |div|
6
+ clause_name(nil, elem&.at(ns("./title")), div, class: "IntroTitle")
7
+ elem.elements.each { |e| parse(e, div) unless e.name == "title" }
8
8
  end
9
9
  end
10
10
 
@@ -14,7 +14,8 @@ module IsoDoc
14
14
  end
15
15
 
16
16
  def submittingorgs(docxml, out)
17
- f = docxml.at(ns("//preface/clause[@type = 'submitting_orgs']")) || return
17
+ f = docxml.at(ns("//preface/clause[@type = 'submitting_orgs']")) or
18
+ return
18
19
  intro_clause(f, out)
19
20
  end
20
21
 
@@ -30,7 +31,8 @@ module IsoDoc
30
31
 
31
32
  def preface(isoxml, out)
32
33
  isoxml.xpath(ns("//preface/clause[not(@type = 'keywords' or "\
33
- "@type = 'submitting_orgs' or @type = 'security')]")).each do |f|
34
+ "@type = 'submitting_orgs' or @type = 'security')]"))
35
+ .each do |f|
34
36
  intro_clause(f, out)
35
37
  end
36
38
  end
@@ -15,7 +15,7 @@ module IsoDoc
15
15
  super
16
16
  end
17
17
 
18
- def default_fonts(options)
18
+ def default_fonts(_options)
19
19
  {
20
20
  bodyfont: '"Times New Roman",serif',
21
21
  headerfont: '"Times New Roman",serif',
@@ -27,7 +27,7 @@ module IsoDoc
27
27
  }
28
28
  end
29
29
 
30
- def default_file_locations(options)
30
+ def default_file_locations(_options)
31
31
  {
32
32
  wordstylesheet: html_doc_path("wordstyle.scss"),
33
33
  standardstylesheet: html_doc_path("ogc.scss"),
@@ -40,7 +40,7 @@ module IsoDoc
40
40
  end
41
41
 
42
42
  def convert1(docxml, filename, dir)
43
- if docxml&.at(ns('//bibdata/ext/doctype'))&.text == "white-paper"
43
+ if docxml&.at(ns("//bibdata/ext/doctype"))&.text == "white-paper"
44
44
  @wordstylesheet_name = html_doc_path("wordstyle_wp.scss")
45
45
  @standardstylesheet_name = html_doc_path("ogc_wp.scss")
46
46
  @wordcoverpage = html_doc_path("word_ogc_titlepage_wp.html")
@@ -86,7 +86,7 @@ module IsoDoc
86
86
  <span lang="EN-GB"><span
87
87
  style='mso-element:field-begin'></span><span
88
88
  style='mso-spacerun:yes'>&#xA0;</span>TOC
89
- \\h \\z \\t &quot;RecommendationTitle,recommendationtitle&quot;
89
+ \\h \\z \\t &quot;RecommendationTitle,recommendationtitle&quot;#{' '}
90
90
  <span style='mso-element:field-separator'></span></span>
91
91
  TOC
92
92
 
@@ -117,7 +117,7 @@ module IsoDoc
117
117
  toc += word_toc_entry(1, header_strip(h))
118
118
  end
119
119
  toc.sub(/(<p class="MsoToc1">)/,
120
- %{\\1#{WORD_TOC_TABLE_PREFACE1}}) + WORD_TOC_SUFFIX1
120
+ %{\\1#{WORD_TOC_TABLE_PREFACE1}}) + WORD_TOC_SUFFIX1
121
121
  end
122
122
 
123
123
  def make_FigureWordToC(docxml)
@@ -126,7 +126,7 @@ module IsoDoc
126
126
  toc += word_toc_entry(1, header_strip(h))
127
127
  end
128
128
  toc.sub(/(<p class="MsoToc1">)/,
129
- %{\\1#{WORD_TOC_FIGURE_PREFACE1}}) + WORD_TOC_SUFFIX1
129
+ %{\\1#{WORD_TOC_FIGURE_PREFACE1}}) + WORD_TOC_SUFFIX1
130
130
  end
131
131
 
132
132
  def make_RecommendationWordToC(docxml)
@@ -135,7 +135,7 @@ module IsoDoc
135
135
  toc += word_toc_entry(1, header_strip(h))
136
136
  end
137
137
  toc.sub(/(<p class="MsoToc1">)/,
138
- %{\\1#{WORD_TOC_RECOMMENDATION_PREFACE1}}) + WORD_TOC_SUFFIX1
138
+ %{\\1#{WORD_TOC_RECOMMENDATION_PREFACE1}}) + WORD_TOC_SUFFIX1
139
139
  end
140
140
 
141
141
  def make_body2(body, docxml)
@@ -179,10 +179,11 @@ module IsoDoc
179
179
  x = "//div[@class = 'boilerplate-copyright']/div[1]/p[not(@class)]"
180
180
  docxml.xpath(x).each { |p| p["align"] = "center" }
181
181
  return unless @doctype == "white-paper"
182
- docxml.xpath("//div[@class = 'boilerplate-copyright']//p[not(@class)]").
183
- each { |p| p["class"] = "license" }
184
- docxml.xpath("//div[@class = 'boilerplate-legal']//p[not(@class)]").
185
- each { |p| p["class"] = "license" }
182
+
183
+ docxml.xpath("//div[@class = 'boilerplate-copyright']//p[not(@class)]")
184
+ .each { |p| p["class"] = "license" }
185
+ docxml.xpath("//div[@class = 'boilerplate-legal']//p[not(@class)]")
186
+ .each { |p| p["class"] = "license" }
186
187
  end
187
188
 
188
189
  def word_term_cleanup(docxml)
@@ -199,7 +200,7 @@ module IsoDoc
199
200
  style_update(tr, "background:#A5A5A5;")
200
201
  end
201
202
  docxml.xpath("//table[@class = 'recommend']/tbody").each do |tr|
202
- tr.xpath("./tr").each_slice(2) do |tr1, tr2|
203
+ tr.xpath("./tr").each_slice(2) do |_tr1, tr2|
203
204
  tr2 && style_update(tr2, "background:#C9C9C9;")
204
205
  end
205
206
  end
@@ -19,6 +19,7 @@ module IsoDoc
19
19
  c = Counter.new
20
20
  clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
21
21
  next if t["id"].nil? || t["id"].empty?
22
+
22
23
  id = c.increment(t).print
23
24
  @anchors[t["id"]] = anchor_struct(id, t, label, klass,
24
25
  t["unnumbered"])
@@ -28,15 +29,15 @@ module IsoDoc
28
29
  end
29
30
 
30
31
  def req_class_paths
31
- { "class" => "@type = 'class'",
32
- "test" => "@type = 'verification'",
32
+ { "class" => "@type = 'class'",
33
+ "test" => "@type = 'verification'",
33
34
  "" => "not(@type = 'verification' or @type = 'class' or "\
34
- "@type = 'abstracttest' or @type = 'conformanceclass')", }
35
+ "@type = 'abstracttest' or @type = 'conformanceclass')" }
35
36
  end
36
37
 
37
38
  def req_class_paths2
38
39
  { "abstracttest" => "@type = 'abstracttest'",
39
- "conformanceclass" => "@type = 'conformanceclass'", }
40
+ "conformanceclass" => "@type = 'conformanceclass'" }
40
41
  end
41
42
 
42
43
  def sequential_permission_children(t, id)
@@ -55,6 +56,7 @@ module IsoDoc
55
56
  c = Counter.new
56
57
  block.xpath(ns("./#{klass}")).each do |t|
57
58
  next if t["id"].nil? || t["id"].empty?
59
+
58
60
  id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
59
61
  @anchors[t["id"]] = anchor_struct(id, t, label, klass,
60
62
  t["unnumbered"])
@@ -96,6 +98,7 @@ module IsoDoc
96
98
  c = Counter.new
97
99
  clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
98
100
  next if t["id"].nil? || t["id"].empty?
101
+
99
102
  lbl = "#{num}#{hiersep}#{c.increment(t).print}"
100
103
  @anchors[t["id"]] = anchor_struct(lbl, t, label, klass,
101
104
  t["unnumbered"])
@@ -120,15 +123,17 @@ module IsoDoc
120
123
  end
121
124
  preface_names_numbered(d.at(ns("//acknowledgements")))
122
125
  sequential_asset_names(d.xpath(ns(
123
- "//preface/abstract | //foreword | //introduction | "\
124
- "//submitters | //acknowledgements | //preface/clause")))
126
+ "//preface/abstract | //foreword | //introduction | "\
127
+ "//submitters | //acknowledgements | //preface/clause",
128
+ )))
125
129
  n = Counter.new
126
130
  n = section_names(d.at(ns("//clause[@type = 'scope']")), n, 1)
127
131
  n = section_names(d.at(ns("//clause[@type = 'conformance']")), n, 1)
128
132
  n = section_names(d.at(ns(@klass.norm_ref_xpath)), n, 1)
129
133
  n = section_names(
130
134
  d.at(ns("//sections/terms | //sections/clause[descendant::terms]")),
131
- n, 1)
135
+ n, 1
136
+ )
132
137
  n = section_names(d.at(ns("//sections/definitions")), n, 1)
133
138
  middle_section_asset_names(d)
134
139
  clause_names(d, n)
@@ -147,6 +152,7 @@ module IsoDoc
147
152
 
148
153
  def preface_names_numbered(clause)
149
154
  return if clause.nil?
155
+
150
156
  @prefacenum += 1
151
157
  pref = preface_number(@prefacenum, 1)
152
158
  @anchors[clause["id"]] =
@@ -159,7 +165,7 @@ module IsoDoc
159
165
 
160
166
  def preface_names_numbered1(clause, num, level)
161
167
  @anchors[clause["id"]] =
162
- { label: num, level: level, xref: l10n("#{@labels["clause"]} #{num}"),
168
+ { label: num, level: level, xref: l10n("#{@labels['clause']} #{num}"),
163
169
  type: "clause" }
164
170
  clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
165
171
  lbl = "#{num}.#{preface_number(i + 1, level + 1)}"
@@ -174,8 +180,8 @@ module IsoDoc
174
180
  when 3 then num.to_s
175
181
  when 4 then (96 + num).chr.to_s
176
182
  when 5 then RomanNumerals.to_roman(num).downcase
177
- when 6 then "(#{num.to_s})"
178
- when 7 then "(#{(96 + num).chr.to_s})"
183
+ when 6 then "(#{num})"
184
+ when 7 then "(#{(96 + num).chr})"
179
185
  when 8 then "(#{RomanNumerals.to_roman(num).downcase})"
180
186
  else
181
187
  num.to_s
@@ -185,6 +191,7 @@ module IsoDoc
185
191
  def reference_names(ref)
186
192
  super
187
193
  return unless @klass.ogc_draft_ref?(ref)
194
+
188
195
  @anchors[ref["id"]] = { xref: @anchors[ref["id"]][:xref] + " (draft)" }
189
196
  end
190
197
  end
data/lib/metanorma/ogc.rb CHANGED
@@ -11,9 +11,8 @@ module Metanorma
11
11
  }
12
12
  end
13
13
 
14
- ORGANIZATION_NAME_SHORT = "OGC"
15
- ORGANIZATION_NAME_LONG = "Open Geospatial Consortium"
16
- DOCUMENT_NAMESPACE = "https://standards.opengeospatial.org/document"
17
-
14
+ ORGANIZATION_NAME_SHORT = "OGC".freeze
15
+ ORGANIZATION_NAME_LONG = "Open Geospatial Consortium".freeze
16
+ DOCUMENT_NAMESPACE = "https://standards.opengeospatial.org/document".freeze
18
17
  end
19
18
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "1.3.3".freeze
3
+ VERSION = "1.3.7".freeze
4
4
  end
5
5
  end
@@ -22,11 +22,11 @@ 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
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
26
26
 
27
27
  spec.add_dependency "iso-639"
28
- spec.add_dependency "isodoc", "~> 1.6.0"
29
- spec.add_dependency "metanorma-standoc", "~> 1.9.0"
28
+ spec.add_dependency "isodoc", "~> 1.7.0"
29
+ spec.add_dependency "metanorma-standoc", "~> 1.10.0"
30
30
 
31
31
  spec.add_development_dependency "byebug", "~> 9.1"
32
32
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
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.3.3
4
+ version: 1.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-24 00:00:00.000000000 Z
11
+ date: 2021-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.6.0
33
+ version: 1.7.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.6.0
40
+ version: 1.7.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: metanorma-standoc
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.9.0
47
+ version: 1.10.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.9.0
54
+ version: 1.10.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: byebug
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -292,7 +292,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
292
292
  requirements:
293
293
  - - ">="
294
294
  - !ruby/object:Gem::Version
295
- version: 2.4.0
295
+ version: 2.5.0
296
296
  required_rubygems_version: !ruby/object:Gem::Requirement
297
297
  requirements:
298
298
  - - ">="