metanorma-ogc 2.7.8 → 2.7.10

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,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.7 -->
3
+ <!-- VERSION v2.0.8 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -72,6 +72,46 @@ but to `@anchor`, the user-supplied cross-reference</a:documentation>
72
72
  </oneOrMore>
73
73
  </element>
74
74
  </define>
75
+ <define name="review">
76
+ <a:documentation>Generalise BasicDoc element from just review comments, to general annotations;
77
+ the type attribute defaults to `review` for reviews</a:documentation>
78
+ <element name="annotation">
79
+ <ref name="RequiredId"/>
80
+ <ref name="ReviewAttributes"/>
81
+ <oneOrMore>
82
+ <ref name="paragraph">
83
+ <a:documentation>Reviewer comments content</a:documentation>
84
+ </ref>
85
+ </oneOrMore>
86
+ </element>
87
+ </define>
88
+ <define name="ruby_pronunciation">
89
+ <a:documentation>Ruby annotation giving pronunciation of text: change tag from BasicDoc for disambiguation</a:documentation>
90
+ <element name="ruby-pronunciation">
91
+ <attribute name="value">
92
+ <a:documentation>Ruby annotation value</a:documentation>
93
+ </attribute>
94
+ <ref name="LocalizedStringAttributes"/>
95
+ </element>
96
+ </define>
97
+ <define name="ruby_annotation">
98
+ <a:documentation>Ruby annotation giving information other than pronunciation of text: change tag from BasicDoc for disambiguation</a:documentation>
99
+ <element name="ruby-annotation">
100
+ <attribute name="value">
101
+ <a:documentation>Ruby annotation value</a:documentation>
102
+ </attribute>
103
+ <ref name="LocalizedStringAttributes"/>
104
+ </element>
105
+ </define>
106
+ <define name="annotation">
107
+ <a:documentation>Source code annotation, corresponding to a callout</a:documentation>
108
+ <element name="callout-annotation">
109
+ <ref name="RequiredId"/>
110
+ <oneOrMore>
111
+ <ref name="paragraph"/>
112
+ </oneOrMore>
113
+ </element>
114
+ </define>
75
115
  <define name="section-title">
76
116
  <a:documentation>Title(s) of a clause</a:documentation>
77
117
  <element name="title">
@@ -540,7 +580,7 @@ normative or informative references, some split references into sections organiz
540
580
  <ref name="OptionalId"/>
541
581
  <optional>
542
582
  <attribute name="style">
543
- <a:documentation>CSS style: only background-color supported</a:documentation>
583
+ <a:documentation>CSS style: only background-color, color, border supported</a:documentation>
544
584
  </attribute>
545
585
  </optional>
546
586
  </define>
@@ -620,7 +660,7 @@ This is done if the footnote reference is already presented in some other form,
620
660
  <ref name="RequiredId"/>
621
661
  <optional>
622
662
  <attribute name="style">
623
- <a:documentation>CSS style: only background-color supported</a:documentation>
663
+ <a:documentation>CSS style: only background-color, color, border supported</a:documentation>
624
664
  </attribute>
625
665
  </optional>
626
666
  </define>
@@ -700,6 +740,11 @@ titlecase, or lowercase</a:documentation>
700
740
  <a:documentation>Width of the table block in rendering</a:documentation>
701
741
  </attribute>
702
742
  </optional>
743
+ <optional>
744
+ <attribute name="style">
745
+ <a:documentation>CSS style: only background-color, color, border supported</a:documentation>
746
+ </attribute>
747
+ </optional>
703
748
  <ref name="BlockAttributes"/>
704
749
  </define>
705
750
  <define name="FigureAttributes" combine="interleave">
@@ -1417,7 +1462,7 @@ numbers</a:documentation>
1417
1462
  </optional>
1418
1463
  <ref name="DocumentBody"/>
1419
1464
  <optional>
1420
- <ref name="review-container">
1465
+ <ref name="annotation-container">
1421
1466
  <a:documentation>Annotations to the document</a:documentation>
1422
1467
  </ref>
1423
1468
  </optional>
@@ -1461,8 +1506,8 @@ numbers</a:documentation>
1461
1506
  </oneOrMore>
1462
1507
  </element>
1463
1508
  </define>
1464
- <define name="review-container">
1465
- <element name="review-container">
1509
+ <define name="annotation-container">
1510
+ <element name="annotation-container">
1466
1511
  <oneOrMore>
1467
1512
  <ref name="review"/>
1468
1513
  </oneOrMore>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.7.8".freeze
3
+ VERSION = "2.7.10".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.10
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-07-05 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