metanorma-ogc 2.8.3 → 2.8.5

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.
@@ -0,0 +1,110 @@
1
+ module Metanorma
2
+ module Ogc
3
+ class Converter < Standoc::Converter
4
+ # ignore, we generate ToC outside of asciidoctor
5
+ def toc(value); end
6
+
7
+ def sectiontype(node, level = true)
8
+ ret = sectiontype_streamline(sectiontype1(node))
9
+ return ret if ret == "terms and definitions" &&
10
+ node.attr("style") == "appendix" && node.level == 1
11
+
12
+ super
13
+ end
14
+
15
+ def section(node)
16
+ override_style(node)
17
+ super
18
+ end
19
+
20
+ def override_style(node)
21
+ s = node.attr("style")
22
+ if %w(overview future_outlook value_proposition
23
+ contributors).include?(s)
24
+ node.set_attr("style", "preface")
25
+ node.set_attr("type", s)
26
+ end
27
+ if %w(aims objectives topics outlook security).include?(s)
28
+ node.set_attr("type", s)
29
+ end
30
+ end
31
+
32
+ def sectiontype_streamline(ret)
33
+ case ret
34
+ when "preface" then "foreword"
35
+ when "foreword", "introduction" then "donotrecognise-foreword"
36
+ when "references" then "normative references"
37
+ when "glossary" then "terms and definitions"
38
+ else super
39
+ end
40
+ end
41
+
42
+ # legacy encoding
43
+ def sectiontype1(node)
44
+ role_style(node, "executive_summary") and return "executivesummary"
45
+ super
46
+ end
47
+
48
+ def clause_parse(attrs, xml, node)
49
+ %w(overview future_outlook value_proposition
50
+ contributors aims objectives topics outlook security)
51
+ .include?(node.attr("type")) and
52
+ attrs = attrs.merge(type: node.attr("type"))
53
+ case node.attr("heading")&.downcase || node.title.downcase
54
+ when "submitters"
55
+ return submitters_parse(attrs.merge(type: "submitters"), xml, node)
56
+ when "contributors"
57
+ return submitters_parse(attrs.merge(type: "contributors"), xml, node)
58
+ when "conformance" then attrs = attrs.merge(type: "conformance")
59
+ when "security considerations"
60
+ attrs = attrs.merge(type: "security")
61
+ end
62
+ super
63
+ end
64
+
65
+ def submitters_parse(attrs, xml, node)
66
+ title = @i18n.submitters
67
+ doctype(node) == "engineering-report" ||
68
+ attrs[:type] == "contributors" and
69
+ title = @i18n.contributors_clause
70
+ xml.clause **attr_code(attrs) do |xml_section|
71
+ section_title(xml_section, title)
72
+ xml_section << node.content
73
+ end
74
+ end
75
+
76
+ def term_def_parse(attrs, xml, node, _toplevel)
77
+ if node.attr("style") == "appendix" && node.level == 1
78
+ terms_annex_parse(attrs, xml, node)
79
+ else
80
+ super
81
+ end
82
+ end
83
+
84
+ def terms_annex_parse(attrs, xml, node)
85
+ attrs1 = attrs.merge(id: "_#{UUIDTools::UUID.random_create}")
86
+ xml.annex **attr_code(attrs1) do |xml_section|
87
+ section_title(xml_section, node.title)
88
+ attrs.delete(:anchor)
89
+ xml_section.terms **attr_code(attrs) do |terms|
90
+ (s = node.attr("source")) && s.split(",").each do |s1|
91
+ terms.termdocsource(nil, **attr_code(bibitemid: s1))
92
+ end
93
+ terms << node.content
94
+ end
95
+ end
96
+ end
97
+
98
+ def set_obligation(attrs, node)
99
+ if node.attr("style") == "appendix" && node.level == 1
100
+ attrs[:obligation] = if node.attributes.has_key?("obligation")
101
+ node.attr("obligation")
102
+ else "informative"
103
+ end
104
+ else
105
+ super
106
+ end
107
+ end
108
+ end
109
+ end
110
+ end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.8.3".freeze
3
+ VERSION = "2.8.5".freeze
4
4
  end
5
5
  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.8.3
4
+ version: 2.8.5
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-09-01 00:00:00.000000000 Z
11
+ date: 2025-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639
@@ -303,6 +303,7 @@ files:
303
303
  - lib/metanorma/ogc/processor.rb
304
304
  - lib/metanorma/ogc/relaton-ogc.rng
305
305
  - lib/metanorma/ogc/reqt.rng
306
+ - lib/metanorma/ogc/sections.rb
306
307
  - lib/metanorma/ogc/validate.rb
307
308
  - lib/metanorma/ogc/version.rb
308
309
  - lib/relaton/render/config.yml