metanorma-ogc 2.8.7 → 2.8.8

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)
@@ -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"
@@ -165,17 +165,13 @@ module Metanorma
165
165
  unless %w{conceptual-model conceptual-model-and-encoding
166
166
  conceptual-model-and-implementation encoding extension
167
167
  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'")
168
+ @log.add("OGC_17", nil, params: [s])
171
169
  s = "implementation"
172
170
  end
173
171
  when "best-practice"
174
172
  unless %w{general encoding extension profile
175
173
  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'")
174
+ @log.add("OGC_18", nil, params: [s])
179
175
  s = "general"
180
176
  end
181
177
  end
@@ -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.8".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.8
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-03 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