metanorma-ogc 2.7.8 → 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"))
@@ -26,91 +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 #{add_id_text} obligation='informative'>
51
- <title #{add_id_text}>#{@i18n.dochistory}</title>
52
- <table unnumbered="true" #{add_id_text}><thead>
53
- <tr #{add_id_text}><th #{add_id_text}>Date</th><th #{add_id_text}>Release</th><th #{add_id_text}>Author</th>
54
- <th #{add_id_text}>Paragraph Modified</th><th #{add_id_text}>Description</th></tr>
55
- </thead><tbody>#{ret}</tbody></table></annex>
56
- XML
57
- end
58
-
59
- def generate_dochistory_row(item)
60
- e = item.at(ns("./edition")) || item.at(ns("./version/draft"))
61
- date = dochistory_date(item)
62
- c = dochistory_contributors(item)
63
- l = dochistory_location(item)
64
- desc = dochistory_description(item)
65
- <<~XML
66
- <tr #{add_id_text}><td #{add_id_text}>#{date}</td><td #{add_id_text}>#{e&.text}</td><td #{add_id_text}>#{c}</td>
67
- <td #{add_id_text}>#{l}</td><td #{add_id_text}>#{desc}</td></tr>
68
- XML
69
- end
70
-
71
- def dochistory_date(item)
72
- d = item.at(ns("./date[@type = 'updated']")) ||
73
- item.at(ns("./date[@type = 'published']")) ||
74
- item.at(ns("./date[@type = 'issued']")) or return ""
75
- d.text.strip
76
- end
77
-
78
- def dochistory_contributors(item)
79
- item.xpath(ns("./contributor")).map do |c|
80
- dochistory_contributor(c)
81
- end.join(", ")
82
- end
83
-
84
- def dochistory_contributor(contrib)
85
- ret = contrib.at("./organization/subdivision") ||
86
- contrib.at("./organization/name") ||
87
- contrib.at("./person/name/abbreviation") ||
88
- contrib.at("./person/name/completename")
89
- ret and return ret.text
90
- format_personalname(contrib)
91
- end
92
-
93
- def format_personalname(contrib)
94
- Relaton::Render::Ogc::General
95
- .new(template: { book: "{{ creatornames }}" })
96
- .render("<bibitem type='book'>#{contrib.to_xml}</bibitem>",
97
- embedded: true)
98
- end
99
-
100
- def dochistory_description(item)
101
- d = item.at(ns("./amend/description")) or return ""
102
- d.children.to_xml
103
- end
104
-
105
- def dochistory_location(item)
106
- t = item.at(ns("./amend/location")) or return "All"
107
- xpath = "./amend/location/locality | ./amend/location/localityStack"
108
- r = eref_localities(item.xpath(ns(xpath)), nil, t)
109
- r.sub!(/^, /, "")
110
- r == @i18n.wholeoftext and r = "All"
111
- r
112
- end
113
-
114
35
  def bibdata_i18n(bib)
115
36
  doctype = bib&.at(ns("./ext/doctype"))
116
37
  rename_stage(bib&.at(ns("./status/stage")), doctype, bib)
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.7.8".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.8
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-06-09 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