metanorma-ogc 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,8 +35,7 @@ module IsoDoc
35
35
  def insert_security(docxml)
36
36
  s = docxml&.at(ns("//preface/clause[@type = 'security']"))&.remove or
37
37
  return
38
- if a = submit_orgs_append_pt(docxml)
39
- a.next = s
38
+ if a = submit_orgs_append_pt(docxml) then a.next = s
40
39
  else
41
40
  preface_init_insert_pt(docxml)&.children&.first
42
41
  &.add_previous_sibling(s)
@@ -46,8 +45,7 @@ module IsoDoc
46
45
  def insert_executivesummary(docxml)
47
46
  s = docxml&.at(ns("//preface/clause[@type = 'executivesummary']"))
48
47
  &.remove or return
49
- if a = docxml.at(ns("//preface/abstract"))
50
- a.next = s
48
+ if a = docxml.at(ns("//preface/abstract")) then a.next = s
51
49
  else
52
50
  preface_init_insert_pt(docxml)&.children&.first
53
51
  &.add_previous_sibling(s)
@@ -56,9 +54,7 @@ module IsoDoc
56
54
 
57
55
  def insert_submitting_orgs(docxml)
58
56
  orgs = docxml.xpath(ns(submittingorgs_path))
59
- .each_with_object([]) do |org, m|
60
- m << org.text
61
- end
57
+ .each_with_object([]) { |org, m| m << org.text }
62
58
  return if orgs.empty?
63
59
 
64
60
  if a = submit_orgs_append_pt(docxml)
@@ -146,9 +142,8 @@ module IsoDoc
146
142
 
147
143
  def annex1(elem)
148
144
  lbl = @xrefs.anchor(elem["id"], :label)
149
- if t = elem.at(ns("./title"))
145
+ t = elem.at(ns("./title")) and
150
146
  t.children = "<strong>#{t.children.to_xml}</strong>"
151
- end
152
147
  prefix_name(elem, "<br/>", lbl, "title")
153
148
  end
154
149
 
@@ -188,6 +183,14 @@ module IsoDoc
188
183
  end
189
184
  end
190
185
 
186
+ def bibdata(docxml)
187
+ docxml.xpath(ns("//bibdata/contributor[@type = 'author']")).each do |a|
188
+ a.at(ns("./description"))&.text == "contributor" and
189
+ a["type"] = "contributor"
190
+ end
191
+ super
192
+ end
193
+
191
194
  def bibdata_i18n(bib)
192
195
  doctype = bib&.at(ns("./ext/doctype"))
193
196
  rename_stage(bib&.at(ns("./status/stage")), doctype, bib)
@@ -197,19 +200,17 @@ module IsoDoc
197
200
  end
198
201
 
199
202
  def rename_stage(stage, doctype, _bib)
200
- if stage&.text == "approved" &&
201
- !%w(standard abstract-specification-topic
202
- community-standard).include?(doctype&.text)
203
+ stage&.text == "approved" &&
204
+ !%w(standard abstract-specification-topic
205
+ community-standard).include?(doctype&.text) and
203
206
  stage.children = "published"
204
- end
205
207
  end
206
208
 
207
209
  def rename_doctype(doctype, date)
208
210
  return unless doctype&.text == "white-paper" && date
209
211
 
210
- if Date.iso8601(date.text) >= Date.iso8601("2021-12-16")
212
+ Date.iso8601(date.text) >= Date.iso8601("2021-12-16") and
211
213
  doctype.children = "technical-paper"
212
- end
213
214
  end
214
215
 
215
216
  def ol(docxml)
@@ -401,9 +401,9 @@
401
401
  <choice>
402
402
  <!-- iso191606 TODO -->
403
403
  <group>
404
- <oneOrMore>
404
+ <zeroOrMore>
405
405
  <ref name="street"/>
406
- </oneOrMore>
406
+ </zeroOrMore>
407
407
  <ref name="city"/>
408
408
  <optional>
409
409
  <ref name="state"/>
@@ -36,6 +36,18 @@ module Metanorma
36
36
  end
37
37
  end
38
38
 
39
+ def personal_role(node, contrib, suffix)
40
+ type = node.attr("role#{suffix}")&.downcase || "editor"
41
+ if type == "contributor"
42
+ contrib.role **{ type: "author" } do |r|
43
+ r.description do |d|
44
+ d << type
45
+ end
46
+ end
47
+ else contrib.role **{ type: type }
48
+ end
49
+ end
50
+
39
51
  def ogc_editor(node, xml)
40
52
  return unless node.attr("editor")
41
53
 
@@ -51,7 +63,7 @@ module Metanorma
51
63
 
52
64
  def personal_author1(node, xml, suffix)
53
65
  xml.contributor do |c|
54
- c.role **{ type: node&.attr("role#{suffix}")&.downcase || "editor" }
66
+ personal_role(node, c, suffix)
55
67
  c.person do |p|
56
68
  p.name do |n|
57
69
  if node.attr("fullname#{suffix}")
@@ -32,6 +32,43 @@
32
32
  <ref name="DocumentType"/>
33
33
  </element>
34
34
  </define>
35
+ <define name="index">
36
+ <element name="index">
37
+ <optional>
38
+ <attribute name="to">
39
+ <data type="IDREF"/>
40
+ </attribute>
41
+ </optional>
42
+ <element name="primary">
43
+ <oneOrMore>
44
+ <choice>
45
+ <ref name="PureTextElement"/>
46
+ <ref name="stem"/>
47
+ </choice>
48
+ </oneOrMore>
49
+ </element>
50
+ <optional>
51
+ <element name="secondary">
52
+ <oneOrMore>
53
+ <choice>
54
+ <ref name="PureTextElement"/>
55
+ <ref name="stem"/>
56
+ </choice>
57
+ </oneOrMore>
58
+ </element>
59
+ </optional>
60
+ <optional>
61
+ <element name="tertiary">
62
+ <oneOrMore>
63
+ <choice>
64
+ <ref name="PureTextElement"/>
65
+ <ref name="stem"/>
66
+ </choice>
67
+ </oneOrMore>
68
+ </element>
69
+ </optional>
70
+ </element>
71
+ </define>
35
72
  <define name="bibitem">
36
73
  <element name="bibitem">
37
74
  <attribute name="id">
@@ -1027,6 +1064,26 @@
1027
1064
  </zeroOrMore>
1028
1065
  </element>
1029
1066
  </define>
1067
+ <define name="sub">
1068
+ <element name="sub">
1069
+ <zeroOrMore>
1070
+ <choice>
1071
+ <ref name="PureTextElement"/>
1072
+ <ref name="stem"/>
1073
+ </choice>
1074
+ </zeroOrMore>
1075
+ </element>
1076
+ </define>
1077
+ <define name="sup">
1078
+ <element name="sup">
1079
+ <zeroOrMore>
1080
+ <choice>
1081
+ <ref name="PureTextElement"/>
1082
+ <ref name="stem"/>
1083
+ </choice>
1084
+ </zeroOrMore>
1085
+ </element>
1086
+ </define>
1030
1087
  <define name="pagebreak">
1031
1088
  <element name="pagebreak">
1032
1089
  <optional>
@@ -2216,7 +2273,18 @@
2216
2273
  <ref name="MultilingualRenderingType"/>
2217
2274
  </attribute>
2218
2275
  </optional>
2219
- <ref name="paragraph"/>
2276
+ <oneOrMore>
2277
+ <choice>
2278
+ <ref name="formula"/>
2279
+ <ref name="ul"/>
2280
+ <ref name="ol"/>
2281
+ <ref name="dl"/>
2282
+ <ref name="quote"/>
2283
+ <ref name="sourcecode"/>
2284
+ <ref name="paragraph"/>
2285
+ <ref name="figure"/>
2286
+ </choice>
2287
+ </oneOrMore>
2220
2288
  </element>
2221
2289
  </define>
2222
2290
  <define name="termsource">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.0.1".freeze
3
+ VERSION = "2.0.2".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.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-17 00:00:00.000000000 Z
11
+ date: 2022-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639