metanorma-ogc 2.7.7 → 2.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,8 +20,15 @@ module IsoDoc
20
20
  insert_preface_sections(doc)
21
21
  end
22
22
 
23
+ def section(docxml)
24
+ dochistory_insert(docxml)
25
+ @xrefs.parse docxml
26
+ super
27
+ end
28
+
23
29
  def insert_preface_sections(doc)
24
- preface_insert(doc.at(ns("//preface//clause[@type = 'submitters' or @type = 'contributors']")),
30
+ preface_insert(doc.at(ns("//preface//clause[@type = 'submitters' or " \
31
+ "@type = 'contributors']")),
25
32
  submit_orgs_append_pt(doc), doc)
26
33
  insert_submitting_orgs(doc)
27
34
  preface_insert(doc.at(ns("//preface/clause[@type = 'security']")),
@@ -29,6 +36,84 @@ module IsoDoc
29
36
  insert_keywords(doc)
30
37
  end
31
38
 
39
+ def dochistory_insert(docxml)
40
+ updates = docxml.xpath(ns(UPDATE_RELATIONS))
41
+ updates.empty? and return
42
+ fwd = annex_insert_point(docxml)
43
+ generate_dochistory(updates, fwd)
44
+ end
45
+
46
+ def annex_insert_point(docxml)
47
+ docxml.at(ns("//annex[last()]")) || docxml.at(ns("//sections"))
48
+ end
49
+
50
+ def generate_dochistory(updates, pref)
51
+ ret = updates.map { |u| generate_dochistory_row(u) }.flatten.join("\n")
52
+ pref.next = <<~XML
53
+ <annex #{add_id_text} obligation='informative'>
54
+ <title #{add_id_text}>#{@i18n.dochistory}</title>
55
+ <table unnumbered="true" #{add_id_text}><thead>
56
+ <tr #{add_id_text}><th #{add_id_text}>Date</th><th #{add_id_text}>Release</th><th #{add_id_text}>Author</th>
57
+ <th #{add_id_text}>Paragraph Modified</th><th #{add_id_text}>Description</th></tr>
58
+ </thead><tbody>#{ret}</tbody></table></annex>
59
+ XML
60
+ end
61
+
62
+ def generate_dochistory_row(item)
63
+ e = item.at(ns("./edition")) || item.at(ns("./version/draft"))
64
+ date = dochistory_date(item)
65
+ c = dochistory_contributors(item)
66
+ l = dochistory_location(item)
67
+ desc = dochistory_description(item)
68
+ <<~XML
69
+ <tr #{add_id_text}><td #{add_id_text}>#{date}</td><td #{add_id_text}>#{e&.text}</td><td #{add_id_text}>#{c}</td>
70
+ <td #{add_id_text}>#{l}</td><td #{add_id_text}>#{desc}</td></tr>
71
+ XML
72
+ end
73
+
74
+ def dochistory_date(item)
75
+ d = item.at(ns("./date[@type = 'updated']")) ||
76
+ item.at(ns("./date[@type = 'published']")) ||
77
+ item.at(ns("./date[@type = 'issued']")) or return ""
78
+ d.text.strip
79
+ end
80
+
81
+ def dochistory_contributors(item)
82
+ item.xpath(ns("./contributor")).map do |c|
83
+ dochistory_contributor(c)
84
+ end.join(", ")
85
+ end
86
+
87
+ def dochistory_contributor(contrib)
88
+ ret = contrib.at("./organization/subdivision") ||
89
+ contrib.at("./organization/name") ||
90
+ contrib.at("./person/name/abbreviation") ||
91
+ contrib.at("./person/name/completename")
92
+ ret and return ret.text
93
+ format_personalname(contrib)
94
+ end
95
+
96
+ def format_personalname(contrib)
97
+ Relaton::Render::Ogc::General
98
+ .new(template: { book: "{{ creatornames }}" })
99
+ .render("<bibitem type='book'>#{contrib.to_xml}</bibitem>",
100
+ embedded: true)
101
+ end
102
+
103
+ def dochistory_description(item)
104
+ d = item.at(ns("./amend/description")) or return ""
105
+ d.children.to_xml
106
+ end
107
+
108
+ def dochistory_location(item)
109
+ t = item.at(ns("./amend/location")) or return "All"
110
+ xpath = "./amend/location/locality | ./amend/location/localityStack"
111
+ r = eref_localities(item.xpath(ns(xpath)), nil, t)
112
+ r.sub!(/^, /, "")
113
+ r == @i18n.wholeoftext and r = "All"
114
+ r
115
+ end
116
+
32
117
  def preface_init_insert_pt(docxml)
33
118
  docxml.at(ns("//preface")) ||
34
119
  docxml.at(ns("//sections"))
@@ -66,18 +151,18 @@ module IsoDoc
66
151
 
67
152
  def submitting_orgs_clause(orgs)
68
153
  <<~SUBMITTING
69
- <clause id="_#{UUIDTools::UUID.random_create}" type="submitting_orgs">
70
- <title>Submitting Organizations</title>
154
+ <clause #{add_id_text} type="submitting_orgs">
155
+ <title #{add_id_text}>Submitting Organizations</title>
71
156
  <p>The following organizations submitted this Document to the Open Geospatial Consortium (OGC):</p>
72
- <ul>#{orgs.map { |m| "<li>#{m}</li>" }.join("\n")}</ul>
157
+ <ul #{add_id_text}>#{orgs.map { |m| "<li #{add_id_text}>#{m}</li>" }.join("\n")}</ul>
73
158
  </clause>
74
159
  SUBMITTING
75
160
  end
76
161
 
77
162
  def keyword_clause(kwords)
78
163
  <<~KEYWORDS
79
- <clause id="_#{UUIDTools::UUID.random_create}" type="keywords">
80
- <title>Keywords</fmt>
164
+ <clause #{add_id_text} type="keywords">
165
+ <title #{add_id_text}>Keywords</title>
81
166
  <p>The following are keywords to be used by search engines and document catalogues.</p>
82
167
  <p>#{kwords.join(', ')}</p></clause>
83
168
  KEYWORDS
@@ -26,88 +26,12 @@ module IsoDoc
26
26
  a["type"] = "contributor"
27
27
  end
28
28
  super
29
- dochistory_insert(docxml)
30
29
  end
31
30
 
32
31
  UPDATE_RELATIONS = <<~XPATH.freeze
33
32
  //bibdata/relation[@type = 'updatedBy' or @type = 'merges' or @type = 'splits' or @type = 'hasDraft']/bibitem
34
33
  XPATH
35
34
 
36
- def dochistory_insert(docxml)
37
- updates = docxml.xpath(ns(UPDATE_RELATIONS))
38
- updates.empty? and return
39
- fwd = annex_insert_point(docxml)
40
- generate_dochistory(updates, fwd)
41
- end
42
-
43
- def annex_insert_point(docxml)
44
- docxml.at(ns("//annex[last()]")) || docxml.at(ns("//sections"))
45
- end
46
-
47
- def generate_dochistory(updates, pref)
48
- ret = updates.map { |u| generate_dochistory_row(u) }.flatten.join("\n")
49
- pref.next = <<~XML
50
- <annex id='_#{UUIDTools::UUID.random_create}' obligation='informative'>
51
- <title>#{@i18n.dochistory}</title>
52
- <table><thead>
53
- <tr><th>Date</th><th>Release</th><th>Author</th><th>Paragraph Modified</th><th>Description</th></tr>
54
- </thead><tbody>#{ret}</tbody></table></annex>
55
- XML
56
- end
57
-
58
- def generate_dochistory_row(item)
59
- e = item.at(ns("./edition")) || item.at(ns("./version/draft"))
60
- date = dochistory_date(item)
61
- c = dochistory_contributors(item)
62
- l = dochistory_location(item)
63
- desc = dochistory_description(item)
64
- "<tr><td>#{date}</td><td>#{e&.text}</td><td>#{c}</td>" \
65
- "<td>#{l}</td><td>#{desc}</td></tr>"
66
- end
67
-
68
- def dochistory_date(item)
69
- d = item.at(ns("./date[@type = 'updated']")) ||
70
- item.at(ns("./date[@type = 'published']")) ||
71
- item.at(ns("./date[@type = 'issued']")) or return ""
72
- d.text.strip
73
- end
74
-
75
- def dochistory_contributors(item)
76
- item.xpath(ns("./contributor")).map do |c|
77
- dochistory_contributor(c)
78
- end.join(", ")
79
- end
80
-
81
- def dochistory_contributor(contrib)
82
- ret = contrib.at("./organization/subdivision") ||
83
- contrib.at("./organization/name") ||
84
- contrib.at("./person/name/abbreviation") ||
85
- contrib.at("./person/name/completename")
86
- ret and return ret.text
87
- format_personalname(contrib)
88
- end
89
-
90
- def format_personalname(contrib)
91
- Relaton::Render::Ogc::General
92
- .new(template: { book: "{{ creatornames }}" })
93
- .render("<bibitem type='book'>#{contrib.to_xml}</bibitem>",
94
- embedded: true)
95
- end
96
-
97
- def dochistory_description(item)
98
- d = item.at(ns("./amend/description")) or return ""
99
- d.children.to_xml
100
- end
101
-
102
- def dochistory_location(item)
103
- t = item.at(ns("./amend/location")) or return "All"
104
- xpath = "./amend/location/locality | ./amend/location/localityStack"
105
- r = eref_localities(item.xpath(ns(xpath)), nil, t)
106
- r.sub!(/^, /, "")
107
- r == @i18n.wholeoftext and r = "All"
108
- r
109
- end
110
-
111
35
  def bibdata_i18n(bib)
112
36
  doctype = bib&.at(ns("./ext/doctype"))
113
37
  rename_stage(bib&.at(ns("./status/stage")), doctype, bib)
@@ -18,10 +18,6 @@ module Metanorma
18
18
  insert_submitters(xml, sect)
19
19
  end
20
20
 
21
- def add_id_txt
22
- %(id="_#{UUIDTools::UUID.random_create}")
23
- end
24
-
25
21
  def insert_security(xml, sect)
26
22
  "document"
27
23
  "standard" if %w(standard community-standard)
@@ -45,8 +41,8 @@ module Metanorma
45
41
  description = "standard" if %w(standard community-standard)
46
42
  .include?(doctype)
47
43
  <<~CLAUSE
48
- <clause type='security' #{add_id_txt}>
49
- <title>Security considerations</title>
44
+ <clause type='security' #{add_id_text}>
45
+ <title #{add_id_text}>Security considerations</title>
50
46
  <p>#{@i18n.security_empty.sub('%', description)}</p></clause>
51
47
  CLAUSE
52
48
  end
@@ -28,11 +28,6 @@ module Metanorma
28
28
  File.join(@libdir, "boilerplate.adoc")
29
29
  end
30
30
 
31
- def makexml(node)
32
- @draft = node.attributes.has_key?("draft")
33
- super
34
- end
35
-
36
31
  def doctype(node)
37
32
  d = super
38
33
  d1 = ::IsoDoc::Ogc::DOCTYPE_ABBR.invert[d] and d = d1
@@ -124,7 +119,7 @@ module Metanorma
124
119
  attrs[:type] == "contributors" and
125
120
  title = @i18n.contributors_clause
126
121
  xml.clause **attr_code(attrs) do |xml_section|
127
- xml_section.title title
122
+ section_title(xml_section, title)
128
123
  xml_section << node.content
129
124
  end
130
125
  end
@@ -149,7 +144,7 @@ module Metanorma
149
144
  def terms_annex_parse(attrs, xml, node)
150
145
  attrs1 = attrs.merge(id: "_#{UUIDTools::UUID.random_create}")
151
146
  xml.annex **attr_code(attrs1) do |xml_section|
152
- xml_section.title { |name| name << node.title }
147
+ section_title(xml_section, node.title)
153
148
  attrs.delete(:anchor)
154
149
  xml_section.terms **attr_code(attrs) do |terms|
155
150
  (s = node.attr("source")) && s.split(",").each do |s1|
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <!-- VERSION v2.0.6 -->
3
+ <!-- VERSION v2.0.7 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -76,6 +76,7 @@ but to `@anchor`, the user-supplied cross-reference</a:documentation>
76
76
  <a:documentation>Title(s) of a clause</a:documentation>
77
77
  <element name="title">
78
78
  <a:documentation>Title proper for a clause</a:documentation>
79
+ <ref name="RequiredId"/>
79
80
  <zeroOrMore>
80
81
  <ref name="TextElement"/>
81
82
  </zeroOrMore>
@@ -83,10 +84,19 @@ but to `@anchor`, the user-supplied cross-reference</a:documentation>
83
84
  <zeroOrMore>
84
85
  <element name="variant-title">
85
86
  <a:documentation>Alternate title for a clause</a:documentation>
87
+ <ref name="RequiredId"/>
86
88
  <ref name="TypedTitleString"/>
87
89
  </element>
88
90
  </zeroOrMore>
89
91
  </define>
92
+ <define name="tname">
93
+ <element name="name">
94
+ <ref name="RequiredId"/>
95
+ <oneOrMore>
96
+ <ref name="NestedTextElement"/>
97
+ </oneOrMore>
98
+ </element>
99
+ </define>
90
100
  <define name="UlBody">
91
101
  <optional>
92
102
  <ref name="tname">
@@ -475,6 +485,7 @@ normative or informative references, some split references into sections organiz
475
485
  <!-- exclude figures? -->
476
486
  <define name="dd">
477
487
  <element name="dd">
488
+ <ref name="OptionalId"/>
478
489
  <zeroOrMore>
479
490
  <!-- exclude figures? -->
480
491
  <ref name="BasicBlock"/>
@@ -526,6 +537,7 @@ normative or informative references, some split references into sections organiz
526
537
  </choice>
527
538
  </define>
528
539
  <define name="TrAttributes">
540
+ <ref name="OptionalId"/>
529
541
  <optional>
530
542
  <attribute name="style">
531
543
  <a:documentation>CSS style: only background-color supported</a:documentation>
@@ -595,6 +607,7 @@ gives an explicit page orientation</a:documentation>
595
607
  </include>
596
608
  <!-- end overrides -->
597
609
  <define name="FnAttributes" combine="interleave">
610
+ <ref name="RequiredId"/>
598
611
  <optional>
599
612
  <attribute name="hiddenref">
600
613
  <a:documentation>If true, number the footnote as normal, but suppress display of the footnote reference in the document body.
@@ -604,6 +617,7 @@ This is done if the footnote reference is already presented in some other form,
604
617
  </optional>
605
618
  </define>
606
619
  <define name="TdAttributes" combine="interleave">
620
+ <ref name="RequiredId"/>
607
621
  <optional>
608
622
  <attribute name="style">
609
623
  <a:documentation>CSS style: only background-color supported</a:documentation>
@@ -1821,7 +1835,7 @@ used in document amendments</a:documentation>
1821
1835
  </element>
1822
1836
  </define>
1823
1837
  <define name="TermAttributes">
1824
- <ref name="OptionalId"/>
1838
+ <ref name="RequiredId"/>
1825
1839
  <ref name="LocalizedStringAttributes"/>
1826
1840
  <ref name="BlockAttributes"/>
1827
1841
  </define>
@@ -2164,6 +2178,7 @@ used in document amendments</a:documentation>
2164
2178
  <define name="termdefinition">
2165
2179
  <a:documentation>The definition of a term applied in the current document</a:documentation>
2166
2180
  <element name="definition">
2181
+ <ref name="RequiredId"/>
2167
2182
  <optional>
2168
2183
  <attribute name="type">
2169
2184
  <a:documentation>Type of definition, used to differentiate it from other definitions of the same term if present</a:documentation>
@@ -2185,6 +2200,7 @@ used in document amendments</a:documentation>
2185
2200
  </define>
2186
2201
  <define name="verbaldefinition">
2187
2202
  <element name="verbal-definition">
2203
+ <ref name="RequiredId"/>
2188
2204
  <oneOrMore>
2189
2205
  <choice>
2190
2206
  <a:documentation>Content of the verbal representation of the term</a:documentation>
@@ -2205,6 +2221,7 @@ used in document amendments</a:documentation>
2205
2221
  <define name="nonverbalrep">
2206
2222
  <a:documentation>Non-verbal representation of the term</a:documentation>
2207
2223
  <element name="non-verbal-representation">
2224
+ <ref name="RequiredId"/>
2208
2225
  <oneOrMore>
2209
2226
  <choice>
2210
2227
  <a:documentation>Content of the non-verbal representation of the term</a:documentation>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.7.7".freeze
3
+ VERSION = "2.7.9".freeze
4
4
  end
5
5
  end
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
27
27
 
28
28
  spec.add_dependency "iso-639"
29
- spec.add_dependency "metanorma-standoc", "~> 3.0.0"
29
+ spec.add_dependency "metanorma-standoc", "~> 3.1.0"
30
30
 
31
31
  spec.add_development_dependency "debug"
32
32
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
@@ -39,7 +39,6 @@ spec.add_development_dependency "rubocop-performance"
39
39
  spec.add_development_dependency "sassc-embedded", "~> 1"
40
40
  spec.add_development_dependency "simplecov", "~> 0.15"
41
41
  spec.add_development_dependency "timecop", "~> 0.9"
42
- spec.add_development_dependency "vcr", "~> 6.1.0"
43
42
  spec.add_development_dependency "webmock"
44
43
  spec.add_development_dependency "xml-c14n"
45
44
  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.7.7
4
+ version: 2.7.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-05-26 00:00:00.000000000 Z
11
+ date: 2025-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.0
33
+ version: 3.1.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: 3.0.0
40
+ version: 3.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: debug
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -192,20 +192,6 @@ dependencies:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0.9'
195
- - !ruby/object:Gem::Dependency
196
- name: vcr
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - "~>"
200
- - !ruby/object:Gem::Version
201
- version: 6.1.0
202
- type: :development
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - "~>"
207
- - !ruby/object:Gem::Version
208
- version: 6.1.0
209
195
  - !ruby/object:Gem::Dependency
210
196
  name: webmock
211
197
  requirement: !ruby/object:Gem::Requirement