metanorma-ogc 2.3.12 → 2.3.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -62,8 +62,7 @@ module IsoDoc
62
62
  def insert_submitting_orgs(docxml)
63
63
  orgs = docxml.xpath(ns(submittingorgs_path))
64
64
  .each_with_object([]) { |org, m| m << org.text }
65
- return if orgs.empty?
66
-
65
+ orgs.empty? and return
67
66
  if a = submit_orgs_append_pt(docxml)
68
67
  a.next = submitting_orgs_clause(orgs)
69
68
  else
@@ -76,8 +75,7 @@ module IsoDoc
76
75
  <<~SUBMITTING
77
76
  <clause id="_#{UUIDTools::UUID.random_create}" type="submitting_orgs">
78
77
  <title>Submitting Organizations</title>
79
- <p>The following organizations submitted this Document to the
80
- Open Geospatial Consortium (OGC):</p>
78
+ <p>The following organizations submitted this Document to the Open Geospatial Consortium (OGC):</p>
81
79
  <ul>#{orgs.map { |m| "<li>#{m}</li>" }.join("\n")}</ul>
82
80
  </clause>
83
81
  SUBMITTING
@@ -87,8 +85,7 @@ module IsoDoc
87
85
  <<~KEYWORDS
88
86
  <clause id="_#{UUIDTools::UUID.random_create}" type="keywords">
89
87
  <title>Keywords</title>
90
- <p>The following are keywords to be used by search engines and
91
- document catalogues.</p>
88
+ <p>The following are keywords to be used by search engines and document catalogues.</p>
92
89
  <p>#{kwords.join(', ')}</p></clause>
93
90
  KEYWORDS
94
91
  end
@@ -123,9 +120,7 @@ module IsoDoc
123
120
  super
124
121
  docxml.xpath(ns("//foreword | //preface/abstract | " \
125
122
  "//submitters | //introduction | //acknowledgements"))
126
- .each do |f|
127
- clause1(f)
128
- end
123
+ .each { |f| clause1(f) }
129
124
  end
130
125
 
131
126
  def clause1(elem)
@@ -159,16 +154,14 @@ module IsoDoc
159
154
  end
160
155
 
161
156
  def rename_doctype(doctype, date)
162
- return unless doctype&.text == "white-paper" && date
163
-
157
+ (doctype&.text == "white-paper" && date) or return
164
158
  Date.iso8601(date.text) >= Date.iso8601("2021-12-16") and
165
159
  doctype.children = "technical-paper"
166
160
  end
167
161
 
168
162
  def ol_depth(node)
169
- return super unless node["class"] == "steps" ||
170
- node.at(".//ancestor::xmlns:ol[@class = 'steps']")
171
-
163
+ node["class"] == "steps" ||
164
+ node.at(".//ancestor::xmlns:ol[@class = 'steps']") or return super
172
165
  idx = node.xpath("./ancestor-or-self::xmlns:ol[@class = 'steps']").size
173
166
  %i(arabic alphabet roman alphabet_upper roman_upper)[(idx - 1) % 5]
174
167
  end
@@ -200,21 +193,33 @@ module IsoDoc
200
193
  xml.children = "#{f}#{xml.xpath(ns(keep)).to_xml}"
201
194
  end
202
195
 
196
+ SECT_TERMS = "//sections/terms | //sections/clause[descendant::terms]"
197
+ .freeze
198
+
203
199
  def display_order(docxml)
204
200
  i = 0
205
201
  i = display_order_xpath(docxml, "//preface/*", i)
206
202
  i = display_order_at(docxml, "//clause[@type = 'scope']", i)
207
203
  i = display_order_at(docxml, "//clause[@type = 'conformance']", i)
208
204
  i = display_order_at(docxml, @xrefs.klass.norm_ref_xpath, i)
209
- i = display_order_at(docxml, "//sections/terms | " \
210
- "//sections/clause[descendant::terms]", i)
211
- i = display_order_at(docxml, "//sections/definitions", i)
212
- i = display_order_xpath(docxml, @xrefs.klass.middle_clause(docxml), i)
205
+ i = display_order_clauses(docxml, i)
213
206
  i = display_order_xpath(docxml, "//annex", i)
214
207
  i = display_order_xpath(docxml, @xrefs.klass.bibliography_xpath, i)
215
208
  display_order_xpath(docxml, "//indexsect", i)
216
209
  end
217
210
 
211
+ def display_order_clauses(docxml, idx)
212
+ if docxml.at(ns("//bibdata/ext/doctype"))&.text == "engineering-report"
213
+ xpath = "#{SECT_TERMS} | //sections/definitions | " +
214
+ @xrefs.klass.middle_clause(docxml)
215
+ return display_order_xpath(docxml, xpath, idx)
216
+ end
217
+ idx = display_order_at(docxml, SECT_TERMS, idx)
218
+ idx = display_order_at(docxml, "//sections/definitions", idx)
219
+ display_order_xpath(docxml, @xrefs.klass.middle_clause(docxml),
220
+ idx)
221
+ end
222
+
218
223
  def norm_ref_entry_code(_ordinal, _idents, _ids, _standard, _datefn, _bib)
219
224
  ""
220
225
  end
@@ -11,12 +11,23 @@ module IsoDoc
11
11
  n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
12
12
  n = section_names(doc.at(ns("//clause[@type = 'conformance']")), n, 1)
13
13
  n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
14
- n = section_names(
15
- doc.at(ns("//sections/terms | //sections/clause[descendant::terms]")),
16
- n, 1
17
- )
18
- n = section_names(doc.at(ns("//sections/definitions")), n, 1)
19
- clause_names(doc, n)
14
+ initial_anchor_names_middle(doc, n,
15
+ doc.at(ns("//bibdata/ext/doctype"))&.text)
16
+ end
17
+ end
18
+
19
+ TERMS_SECT = "//sections/terms | //sections/clause[descendant::terms]"
20
+ .freeze
21
+
22
+ def initial_anchor_names_middle(doc, num, doctype)
23
+ if doctype == "engineering-report"
24
+ doc.xpath(ns(@klass.middle_clause(doc)) +
25
+ " | #{ns(TERMS_SECT)} | " + ns("//sections/definitions"))
26
+ .each_with_index { |c, _i| section_names(c, num, 1) }
27
+ else
28
+ num = section_names(doc.at(ns(TERMS_SECT)), num, 1)
29
+ num = section_names(doc.at(ns("//sections/definitions")), num, 1)
30
+ clause_names(doc, num)
20
31
  end
21
32
  end
22
33
 
@@ -88,7 +88,8 @@ module Metanorma
88
88
 
89
89
  def clause_parse(attrs, xml, node)
90
90
  case node.attr("heading")&.downcase || node.title.downcase
91
- when "submitters" then return submitters_parse(attrs, xml, node)
91
+ when "submitters", "contributors"
92
+ return submitters_parse(attrs, xml, node)
92
93
  when "conformance" then attrs = attrs.merge(type: "conformance")
93
94
  when "security considerations"
94
95
  attrs = attrs.merge(type: "security")
@@ -99,8 +100,11 @@ module Metanorma
99
100
  end
100
101
 
101
102
  def submitters_parse(attrs, xml, node)
103
+ title = @i18n.submitters
104
+ doctype(node) == "engineering-report" and
105
+ title = @i18n.contributors_clause
102
106
  xml.submitters **attr_code(attrs) do |xml_section|
103
- xml_section.title @i18n.submitters
107
+ xml_section.title title
104
108
  xml_section << node.content
105
109
  end
106
110
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.3.12".freeze
3
+ VERSION = "2.3.14".freeze
4
4
  end
5
5
  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: 2.3.12
4
+ version: 2.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-19 00:00:00.000000000 Z
11
+ date: 2023-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639