metanorma-ogc 2.8.7 → 2.8.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.
@@ -94,10 +94,10 @@ module IsoDoc
94
94
  end
95
95
 
96
96
  def format_personalname(contrib)
97
- Relaton::Render::Ogc::General
97
+ ret = Relaton::Render::Ogc::General
98
98
  .new(template: { book: "{{ creatornames }}" })
99
- .render("<bibitem type='book'>#{contrib.to_xml}</bibitem>",
100
- embedded: true)
99
+ .render_all("<references><bibitem type='book'>#{contrib.to_xml}</bibitem></references>")
100
+ ret[nil][:citation][:author]
101
101
  end
102
102
 
103
103
  def dochistory_description(item)
@@ -690,7 +690,7 @@ Examples include GRID, LEI, CrossRef, and Ringgold</a:documentation>
690
690
  <define name="CitationType">
691
691
  <attribute name="bibitemid">
692
692
  <a:documentation>Bibliographic item that the citation applies to, referenced as the anchor of a bibliographic description</a:documentation>
693
- <data type="IDREF"/>
693
+ <ref name="IdRefType"/>
694
694
  </attribute>
695
695
  <choice>
696
696
  <zeroOrMore>
@@ -1296,17 +1296,17 @@ for which this claim of validity is made, if applicable</a:documentation>
1296
1296
  </define>
1297
1297
  <define name="validityBegins">
1298
1298
  <element name="validityBegins">
1299
- <ref name="ISO8601Date"/>
1299
+ <ref name="ISO8601DateTime"/>
1300
1300
  </element>
1301
1301
  </define>
1302
1302
  <define name="validityEnds">
1303
1303
  <element name="validityEnds">
1304
- <ref name="ISO8601Date"/>
1304
+ <ref name="ISO8601DateTime"/>
1305
1305
  </element>
1306
1306
  </define>
1307
1307
  <define name="validityRevision">
1308
1308
  <element name="revision">
1309
- <ref name="ISO8601Date"/>
1309
+ <ref name="ISO8601DateTime"/>
1310
1310
  </element>
1311
1311
  </define>
1312
1312
  <define name="TypedTitleString">
@@ -72,30 +72,6 @@ module Metanorma
72
72
  end
73
73
  end
74
74
 
75
- # KILL
76
- def section_names_terms_cleanupx(xml)
77
- @i18n or return
78
- replace_title(xml, "//definitions[@type = 'symbols']", @i18n.symbols)
79
- replace_title(xml, "//definitions[@type = 'abbreviated_terms']",
80
- @i18n.abbrev)
81
- replace_title(xml, "//definitions[not(@type)]", @i18n.symbolsabbrev)
82
- replace_title(xml, "//sections//terms#{SYM_NO_ABBR} | " \
83
- "//sections//clause[.//terms]#{SYM_NO_ABBR}",
84
- @i18n.termsdefsymbols, true)
85
- replace_title(xml, "//sections//terms#{ABBR_NO_SYM} | " \
86
- "//sections//clause[.//terms]#{ABBR_NO_SYM}",
87
- @i18n.termsdefabbrev, true)
88
- replace_title(xml, "//sections//terms#{SYMABBR} | " \
89
- "//sections//clause[.//terms]#{SYMABBR}",
90
- @i18n.termsdefsymbolsabbrev, true)
91
- replace_title(xml, "//sections//terms#{NO_SYMABBR} | " \
92
- "//sections//clause[.//terms]#{NO_SYMABBR}",
93
- @i18n.termsdefsymbolsabbrev, true)
94
- replace_title(xml, "//sections//terms[not(.//definitions)] | " \
95
- "//sections//clause[.//terms][not(.//definitions)]",
96
- @i18n.termsdef, true)
97
- end
98
-
99
75
  # as in standoc, but do not rename annex terms
100
76
  def section_names_terms1_cleanup(xml)
101
77
  auto_name_terms(xml) or return
@@ -36,8 +36,7 @@ module Metanorma
36
36
  reference-model release-notes standard user-guide white-paper
37
37
  technical-paper test-suite draft-standard}.include? d
38
38
  @warned_doctype or
39
- @log.add("Document Attributes", nil,
40
- "'#{d}' is not a legal document type: reverting to 'standard'")
39
+ @log.add("OGC_16", nil, params: [d])
41
40
  @warned_doctype = true
42
41
  d = @default_doctype
43
42
  end
@@ -177,3 +176,5 @@ module Metanorma
177
176
  end
178
177
  end
179
178
  end
179
+
180
+ require_relative "log"
@@ -5,12 +5,6 @@ require "fileutils"
5
5
  module Metanorma
6
6
  module Ogc
7
7
  class Converter < Standoc::Converter
8
- def safe_xml_string(node, key, value)
9
- node.send key do |n|
10
- n << value
11
- end
12
- end
13
-
14
8
  def org_author(node, xml)
15
9
  node.attr("submitting-organizations") or return
16
10
  csv_split(@c.decode(node.attr("submitting-organizations")),
@@ -18,7 +12,7 @@ module Metanorma
18
12
  xml.contributor do |c|
19
13
  c.role type: "author"
20
14
  c.organization do |a|
21
- safe_xml_string(a, "name", org)
15
+ add_noko_elem(a, "name", org)
22
16
  end
23
17
  end
24
18
  end
@@ -40,7 +34,7 @@ module Metanorma
40
34
  type = node.attr("role#{suffix}")&.downcase || "editor"
41
35
  if type == "contributor"
42
36
  contrib.role type: "author" do |r|
43
- safe_xml_string(r, "description", type)
37
+ add_noko_elem(r, "description", type)
44
38
  end
45
39
  else contrib.role type: type
46
40
  end
@@ -52,7 +46,7 @@ module Metanorma
52
46
  c.role type: "editor"
53
47
  c.person do |p|
54
48
  p.name do |n|
55
- n.completename node.attr("editor")
49
+ add_noko_elem(n, "completename", node.attr("editor"))
56
50
  end
57
51
  end
58
52
  end
@@ -71,10 +65,10 @@ module Metanorma
71
65
 
72
66
  def personal_author_name(node, xml, suffix)
73
67
  if node.attr("fullname#{suffix}")
74
- safe_xml_string(xml, "completename", node.attr("fullname#{suffix}"))
68
+ add_noko_elem(xml, "completename", node.attr("fullname#{suffix}"))
75
69
  else
76
- safe_xml_string(xml, "forename", node.attr("givenname#{suffix}"))
77
- safe_xml_string(xml, "surname", node.attr("surname#{suffix}"))
70
+ add_noko_elem(xml, "forename", node.attr("givenname#{suffix}"))
71
+ add_noko_elem(xml, "surname", node.attr("surname#{suffix}"))
78
72
  end
79
73
  end
80
74
 
@@ -108,12 +102,15 @@ module Metanorma
108
102
  end
109
103
 
110
104
  def metadata_id(node, xml)
111
- e = externalid(node) and xml.docidentifier e, type: "ogc-external"
105
+ add_noko_elem(xml, "docidentifier", externalid(node),
106
+ type: "ogc-external")
112
107
  node.attr("referenceurlid") and
113
- xml.docidentifier externalurl(node), type: "ogc-external"
114
- docnumber = node.attr("docnumber") || node.attr("docreference")
115
- id = node.attr("docidentifier") || docnumber
116
- xml.docidentifier id, type: "ogc-internal", primary: "true"
108
+ add_noko_elem(xml, "docidentifier", externalurl(node),
109
+ type: "ogc-external")
110
+ id = node.attr("docidentifier") || node.attr("docnumber") ||
111
+ node.attr("docreference")
112
+ add_noko_elem(xml, "docidentifier", id, type: "ogc-internal",
113
+ primary: "true")
117
114
  end
118
115
 
119
116
  def externalurl(node)
@@ -126,8 +123,7 @@ module Metanorma
126
123
 
127
124
  def metadata_source(node, xml)
128
125
  super
129
- node.attr("previous-uri") && xml.uri(node.attr("previous-uri"),
130
- type: "previous")
126
+ add_noko_elem(xml, "uri", node.attr("previous-uri"), type: "previous")
131
127
  end
132
128
 
133
129
  def metadata_copyright(node, xml)
@@ -146,7 +142,7 @@ module Metanorma
146
142
  def ogc_date(node, xml, ogcname, metanormaname)
147
143
  if node.attr(ogcname)
148
144
  xml.date type: metanormaname do |d|
149
- d.on node.attr(ogcname)
145
+ add_noko_elem(d, "on", node.attr(ogcname))
150
146
  end
151
147
  end
152
148
  end
@@ -165,17 +161,13 @@ module Metanorma
165
161
  unless %w{conceptual-model conceptual-model-and-encoding
166
162
  conceptual-model-and-implementation encoding extension
167
163
  implementation profile profile-with-extension}.include? s
168
- @log.add("Document Attributes", nil,
169
- "'#{s}' is not a permitted subtype of Standard: " \
170
- "reverting to 'implementation'")
164
+ @log.add("OGC_17", nil, params: [s])
171
165
  s = "implementation"
172
166
  end
173
167
  when "best-practice"
174
168
  unless %w{general encoding extension profile
175
169
  profile-with-extension}.include? s
176
- @log.add("Document Attributes", nil,
177
- "'#{s}' is not a permitted subtype of best-practice: " \
178
- "reverting to 'general'")
170
+ @log.add("OGC_18", nil, params: [s])
179
171
  s = "general"
180
172
  end
181
173
  end
@@ -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.1.3 -->
3
+ <!-- VERSION v2.1.4 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -905,15 +905,32 @@ titlecase, or lowercase</a:documentation>
905
905
  </element>
906
906
  </define>
907
907
  <define name="image" combine="choice">
908
- <element name="svg">
909
- <a:documentation>Add svg mark up to image</a:documentation>
910
- <oneOrMore>
911
- <choice>
912
- <text/>
913
- <ref name="AnyElement"/>
914
- </choice>
915
- </oneOrMore>
916
- </element>
908
+ <choice>
909
+ <element name="image">
910
+ <ref name="RequiredId"/>
911
+ <ref name="ImageAttributes"/>
912
+ <optional>
913
+ <element name="svg">
914
+ <a:documentation>Allow svg in image/svg, for consistency</a:documentation>
915
+ <oneOrMore>
916
+ <choice>
917
+ <text/>
918
+ <ref name="AnyElement"/>
919
+ </choice>
920
+ </oneOrMore>
921
+ </element>
922
+ </optional>
923
+ </element>
924
+ <element name="svg">
925
+ <a:documentation>Add svg mark up to image</a:documentation>
926
+ <oneOrMore>
927
+ <choice>
928
+ <text/>
929
+ <ref name="AnyElement"/>
930
+ </choice>
931
+ </oneOrMore>
932
+ </element>
933
+ </choice>
917
934
  </define>
918
935
  <define name="ParagraphFnBody" combine="interleave">
919
936
  <ref name="BlockSource">
@@ -0,0 +1,68 @@
1
+ module Metanorma
2
+ module Ogc
3
+ class Converter
4
+ OGC_LOG_MESSAGES = {
5
+ # rubocop:disable Naming/VariableNumber
6
+ "OGC_1": { category: "Document Attributes",
7
+ error: "%s is not a recognised status",
8
+ severity: 2 },
9
+ "OGC_2": { category: "Document Attributes",
10
+ error: "%s is not an allowed status for %s",
11
+ severity: 2 },
12
+ "OGC_3": { category: "Document Attributes",
13
+ error: "Version not permitted for %s",
14
+ severity: 2 },
15
+ "OGC_4": { category: "Document Attributes",
16
+ error: "Version required for %s",
17
+ severity: 2 },
18
+ "OGC_5": { category: "Style",
19
+ error: "Executive Summary required for Engineering Reports!",
20
+ severity: 2 },
21
+ "OGC_6": { category: "Style",
22
+ error: "Executive Summary only allowed for Engineering Reports!",
23
+ severity: 2 },
24
+ "OGC_7": { category: "Style",
25
+ error: "(section sequencing) %s",
26
+ severity: 2 },
27
+ "OGC_8": { category: "Style",
28
+ error: "Document must contain at least one clause",
29
+ severity: 2 },
30
+ "OGC_9": { category: "Style",
31
+ error: "Normative References are mandatory",
32
+ severity: 2 },
33
+ "OGC_10": { category: "Style",
34
+ error: "Abstract is missing!",
35
+ severity: 2 },
36
+ "OGC_11": { category: "Style",
37
+ error: "Keywords are missing!",
38
+ severity: 2 },
39
+ "OGC_12": { category: "Style",
40
+ error: "Preface is missing!",
41
+ severity: 2 },
42
+ "OGC_13": { category: "Style",
43
+ error: "Submitting Organizations is missing!",
44
+ severity: 2 },
45
+ "OGC_14": { category: "Style",
46
+ error: "Submitters is missing!",
47
+ severity: 2 },
48
+ "OGC_15": { category: "Bibliography",
49
+ error: "Engineering report should not contain normative references",
50
+ severity: 2 },
51
+ "OGC_16": { category: "Document Attributes",
52
+ error: "'%s' is not a legal document type: reverting to 'standard'",
53
+ severity: 2 },
54
+ "OGC_17": { category: "Document Attributes",
55
+ error: "'%s' is not a permitted subtype of Standard: reverting to 'implementation'",
56
+ severity: 2 },
57
+ "OGC_18": { category: "Document Attributes",
58
+ error: "'%s' is not a permitted subtype of best-practice: reverting to 'general'",
59
+ severity: 2 },
60
+ }.freeze
61
+ # rubocop:enable Naming/VariableNumber
62
+
63
+ def log_messages
64
+ super.merge(OGC_LOG_MESSAGES)
65
+ end
66
+ end
67
+ end
68
+ end
@@ -24,8 +24,7 @@ module Metanorma
24
24
  stage = xmldoc&.at("//bibdata/status/stage")&.text
25
25
  %w(draft swg-draft oab-review public-rfc tc-vote work-item-draft
26
26
  approved deprecated retired rescinded legacy).include? stage or
27
- @log.add("Document Attributes", nil,
28
- "#{stage} is not a recognised status")
27
+ @log.add("OGC_1", nil, params: [stage])
29
28
  stage_type_validate(stage, @doctype)
30
29
  end
31
30
 
@@ -40,29 +39,24 @@ module Metanorma
40
39
  else %w(swg-draft oab-review public-rfc tc-vote work-item-draft
41
40
  deprecated rescinded legacy).include?(stage)
42
41
  end and
43
- @log.add("Document Attributes", nil,
44
- "#{stage} is not an allowed status for #{doctype}")
42
+ @log.add("OGC_2", nil, params: [stage, doctype])
45
43
  end
46
44
 
47
45
  def version_validate(xmldoc)
48
46
  version = xmldoc.at("//bibdata/edition")&.text
49
47
  if %w(engineering-report discussion-paper).include? @doctype
50
- version.nil? or @log.add("Document Attributes", nil,
51
- "Version not permitted for #{@doctype}")
48
+ version.nil? or @log.add("OGC_3", nil, params: [@doctype])
52
49
  else
53
- version.nil? and @log.add("Document Attributes", nil,
54
- "Version required for #{@doctype}")
50
+ version.nil? and @log.add("OGC_4", nil, params: [@doctype])
55
51
  end
56
52
  end
57
53
 
58
54
  def execsummary_validate(xmldoc)
59
55
  sect = xmldoc.at("//executivesummary")
60
56
  @doctype == "engineering-report" && sect.nil? and
61
- @log.add("Style", nil,
62
- "Executive Summary required for Engineering Reports!")
57
+ @log.add("OGC_5", nil)
63
58
  @doctype != "engineering-report" && !sect.nil? and
64
- @log.add("Style", nil,
65
- "Executive Summary only allowed for Engineering Reports!")
59
+ @log.add("OGC_6", nil)
66
60
  end
67
61
 
68
62
  def section_validate(doc)
@@ -100,7 +94,7 @@ module Metanorma
100
94
 
101
95
  test = accepted.map { |a| n.at(a) }
102
96
  if test.all?(&:nil?)
103
- @log.add("Style", nil, msg)
97
+ @log.add("OGC_7", nil, params: [msg])
104
98
  end
105
99
  names
106
100
  end
@@ -116,35 +110,31 @@ module Metanorma
116
110
  n = names.shift
117
111
  end
118
112
  if n.nil? || n.name != "clause"
119
- @log.add("Style", nil,
120
- "Document must contain at least one clause")
113
+ @log.add("OGC_8", nil)
121
114
  return
122
115
  end
123
116
  root.at("//references | //clause[descendant::references]" \
124
117
  "[not(parent::clause)]") or
125
- @log.add("Style", nil, "Normative References are mandatory")
118
+ @log.add("OGC_9", nil)
126
119
  end
127
120
 
128
121
  def preface_sequence_validate(root)
129
122
  @doctype == "engineering-report" and return
130
- root.at("//preface/abstract") or @log.add("Style", nil,
131
- "Abstract is missing!")
123
+ root.at("//preface/abstract") or @log.add("OGC_10", nil)
132
124
  root.at("//bibdata/keyword | //bibdata/ext/keyword") or
133
- @log.add("Style", nil, "Keywords are missing!")
134
- root.at("//foreword") or @log.add("Style", nil,
135
- "Preface is missing!")
125
+ @log.add("OGC_11", nil)
126
+ root.at("//foreword") or @log.add("OGC_12", nil)
136
127
  root.at("//bibdata/contributor[role/@type = 'author']/organization/" \
137
128
  "name") or
138
- @log.add("Style", nil, "Submitting Organizations is missing!")
129
+ @log.add("OGC_13", nil)
139
130
  root.at("//clause[@type = 'submitters' or @type = 'contributors']") or
140
- @log.add("Style", nil, "Submitters is missing!")
131
+ @log.add("OGC_14", nil)
141
132
  end
142
133
 
143
134
  def norm_ref_validate(doc)
144
135
  @doctype == "engineering-report" or return super
145
136
  doc.xpath("//references[@normative = 'true']").each do |b|
146
- @log.add("Bibliography", b,
147
- "Engineering report should not contain normative references")
137
+ @log.add("OGC_15", b)
148
138
  end
149
139
  end
150
140
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.8.7".freeze
3
+ VERSION = "2.8.9".freeze
4
4
  end
5
5
  end
@@ -1,8 +1,8 @@
1
1
  template:
2
- standard: "{% if creatornames %}{{ creatornames }} ({{role}}){%else%}{{ publisher_abbrev}}{%endif%} : {{authoritative_identifier|first}} {{draft}} , <em>{{ title }}</em>. {{ publisher }}{%if place%},{%endif%} {{ place }} ({{date}}). {{uri}}."
2
+ standard: "{% if creatornames %}{{ creatornames }} ({{role}}){%else%}{{ publisher_abbrev}}{%endif%} : {{authoritative_identifier|first}} {{draft}} , <em>{{ title }}</em>$$$ {{ publisher }}{%if place%},{%endif%} {{ place }} ({{date}})$$$ {{uri}}$$$"
3
3
  misc: standard
4
4
  techreport: standard
5
- book: "{{ creatornames }} ({{role}}) : <em>{{ title }}</em> . {{ publisher }}, {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%} ({{date}})."
5
+ book: "{{ creatornames }} ({{role}}) : <em>{{ title }}</em> $$$ {{ publisher }}, {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%} ({{date}})$$$"
6
6
  booklet: book
7
7
  manual: book
8
8
  proceedings: book
@@ -12,11 +12,11 @@ template:
12
12
  webresource: book
13
13
  unpublished: book
14
14
  presentation: book
15
- inbook: "{{ creatornames }} ({{role}}) : {{ title }} . {{ labels['in'] | capitalize }}: {{ host_creatornames}} ({{ host_role}}) : <em>{{host_title}}</em>. {{ extent}}. {{ publisher }}{%if place%},{%endif%} {{ place }} . ({{date}})."
15
+ inbook: "{{ creatornames }} ({{role}}) : {{ title }} $$$ {{ labels['in'] | capitalize }}: {{ host_creatornames}} ({{ host_role}}) : <em>{{host_title}}</em>$$$ {{ extent}}$$$ {{ publisher }}{%if place%},{%endif%} {{ place }} $$$ ({{date}})$$$"
16
16
  inproceedings: inbook
17
17
  incollection: inbook
18
- journal: "<em>{{ title}}</em> . {{ publisher }}{%if place%},{%endif%} {{ place }} . ({{date}})."
19
- article: "{{ creatornames }} ({{role}}) : {{ title }}. {{ series }} {{ extent }} ({{date}})."
18
+ journal: "<em>{{ title}}</em> $$$ {{ publisher }}{%if place%},{%endif%} {{ place }} $$$ ({{date}})$$$"
19
+ article: "{{ creatornames }} ({{role}}) : {{ title }}$$$ {{ series }} {{ extent }} ({{date}})$$$"
20
20
  nametemplate:
21
21
  one: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }} {{initials[0] | join: '' | remove: '.' | remove: '_' }}{% endif %}"
22
22
  two: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }} {{initials[0] | join: '' | remove: '.' | remove: '_' }}{% endif %} , {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{surname[1]}} {{ initials[1] | join: '' | remove: '.' | remove: '_' }}{% endif %}"
@@ -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.1.0"
29
+ spec.add_dependency "metanorma-standoc", "~> 3.2.0"
30
30
 
31
31
  spec.add_development_dependency "debug"
32
32
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
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.8.7
4
+ version: 2.8.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-10-13 00:00:00.000000000 Z
11
+ date: 2025-11-17 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.1.0
33
+ version: 3.2.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.1.0
40
+ version: 3.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: debug
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -299,6 +299,7 @@ files:
299
299
  - lib/metanorma/ogc/converter.rb
300
300
  - lib/metanorma/ogc/front.rb
301
301
  - lib/metanorma/ogc/isodoc.rng
302
+ - lib/metanorma/ogc/log.rb
302
303
  - lib/metanorma/ogc/ogc.rng
303
304
  - lib/metanorma/ogc/processor.rb
304
305
  - lib/metanorma/ogc/relaton-ogc.rng