metanorma-ogc 2.7.4 → 2.7.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.
@@ -4,15 +4,24 @@ module IsoDoc
4
4
  def middle_title(docxml); end
5
5
 
6
6
  def preface_rearrange(doc)
7
- super
7
+ [
8
+ ["//preface/abstract",
9
+ %w(executivesummary foreword introduction clause acknowledgements)],
10
+ ["//preface/executivesummary",
11
+ %w(foreword introduction clause acknowledgements)],
12
+ ["//preface/foreword",
13
+ %w(introduction clause acknowledgements)],
14
+ ["//preface/introduction",
15
+ %w(clause acknowledgements)],
16
+ ["//preface/acknowledgements", %w()],
17
+ ].each do |x|
18
+ preface_move(doc.xpath(ns(x[0])), x[1], doc)
19
+ end
8
20
  insert_preface_sections(doc)
9
21
  end
10
22
 
11
23
  def insert_preface_sections(doc)
12
- preface_insert(doc.at(ns("//preface/clause" \
13
- "[@type = 'executivesummary']")),
14
- doc.at(ns("//preface/abstract")), doc)
15
- preface_insert(doc.at(ns("//preface//submitters")),
24
+ preface_insert(doc.at(ns("//preface//clause[@type = 'submitters' or @type = 'contributors']")),
16
25
  submit_orgs_append_pt(doc), doc)
17
26
  insert_submitting_orgs(doc)
18
27
  preface_insert(doc.at(ns("//preface/clause[@type = 'security']")),
@@ -39,8 +48,8 @@ module IsoDoc
39
48
  def submit_orgs_append_pt(docxml)
40
49
  docxml.at(ns("//foreword")) ||
41
50
  docxml.at(ns("//preface/clause[@type = 'keywords']")) ||
42
- docxml.at(ns("//preface/clause[@type = 'executivesummary']")) ||
43
- docxml.at(ns("//preface/abstract"))
51
+ docxml.at(ns("//preface/abstract")) ||
52
+ docxml.at(ns("//preface/executivesummary"))
44
53
  end
45
54
 
46
55
  def insert_submitting_orgs(docxml)
@@ -78,7 +87,7 @@ module IsoDoc
78
87
  kw = @meta.get[:keywords]
79
88
  kw.empty? and return
80
89
  if abstract =
81
- docxml.at(ns("//preface/clause[@type = 'executivesummary']")) ||
90
+ docxml.at(ns("//preface/executivesummary")) ||
82
91
  docxml.at(ns("//preface/abstract"))
83
92
  abstract.next = keyword_clause(kw)
84
93
  else
@@ -88,12 +97,7 @@ module IsoDoc
88
97
  end
89
98
 
90
99
  def annex_delim(_elem)
91
- "<br/>"
92
- end
93
-
94
- def clause(docxml)
95
- super
96
- docxml.xpath(ns("//submitters")).each { |f| clause1(f) }
100
+ "<br/>"
97
101
  end
98
102
 
99
103
  def clause1(elem)
@@ -1,13 +1,6 @@
1
1
  module IsoDoc
2
2
  module Ogc
3
3
  module BaseConvert
4
- def top_element_render(node, out)
5
- case node.name
6
- when "submitters" then intro_clause node, out
7
- else super
8
- end
9
- end
10
-
11
4
  def preface(clause, out)
12
5
  case clause["type"]
13
6
  when "toc"
@@ -17,10 +10,6 @@ module IsoDoc
17
10
  end
18
11
  end
19
12
 
20
- def sections_names
21
- super + %w[submitters]
22
- end
23
-
24
13
  def intro_clause(elem, out)
25
14
  out.div class: "Section3", id: elem["id"] do |div|
26
15
  clause_name(elem, elem&.at(ns("./fmt-title")), div,
@@ -42,7 +42,7 @@ module IsoDoc
42
42
  def middle_section_asset_names(doc)
43
43
  middle_sections =
44
44
  "//clause[@type = 'scope' or @type = 'conformance'] | //foreword | " \
45
- "//introduction | //preface/abstract | //submitters | " \
45
+ "//introduction | //preface/abstract | " \
46
46
  "//acknowledgements | //preface/clause | " \
47
47
  "#{@klass.norm_ref_xpath} | //sections/terms | " \
48
48
  "//sections/definitions | //clause[parent::sections]"
@@ -69,7 +69,7 @@ module IsoDoc
69
69
  def preface_names_numbered1(clause, parentnum, num, level)
70
70
  lbl = clause_number_semx(parentnum, clause, num)
71
71
  @anchors[clause["id"]] =
72
- { label: lbl, level: level,
72
+ { label: lbl, level: level,
73
73
  xref: labelled_autonum(@labels["clause"], lbl),
74
74
  type: "clause", elem: @labels["clause"] }
75
75
  clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
@@ -110,7 +110,7 @@ module IsoDoc
110
110
  @anchors[t["id"]] = anchor_struct(
111
111
  c.print, t,
112
112
  @labels["sourcecode"], "sourcecode",
113
- { unnumb: t["unnumbered"], container: container}
113
+ { unnumb: t["unnumbered"], container: container }
114
114
  )
115
115
  end
116
116
  end
@@ -123,13 +123,12 @@ module IsoDoc
123
123
  def hierarchical_sourcecode_names(clauses, num)
124
124
  c = Counter.new
125
125
  nodeSet(clauses).each do |clause|
126
- clause.xpath(ns(LISTING)).noblank.each do |t|
127
- @anchors[t["id"]] =
128
- anchor_struct(#"#{num}#{hier_separator}#{c.increment(t).print}",
129
- hiersemx(clause, num, c.increment(t), t),
130
- t, @labels["sourcecode"],
131
- "sourcecode", { unnumb:t["unnumbered"] })
132
- end
126
+ clause.xpath(ns(LISTING)).noblank.each do |t|
127
+ @anchors[t["id"]] =
128
+ anchor_struct(hiersemx(clause, num, c.increment(t), t),
129
+ t, @labels["sourcecode"],
130
+ "sourcecode", { unnumb: t["unnumbered"] })
131
+ end
133
132
  end
134
133
  end
135
134
  end
@@ -14,7 +14,6 @@ module Metanorma
14
14
 
15
15
  def make_preface(xml, sect)
16
16
  super
17
- insert_execsummary(xml, sect)
18
17
  insert_security(xml, sect)
19
18
  insert_submitters(xml, sect)
20
19
  end
@@ -23,17 +22,9 @@ module Metanorma
23
22
  %(id="_#{UUIDTools::UUID.random_create}")
24
23
  end
25
24
 
26
- def insert_execsummary(xml, sect)
27
- summ = xml&.at("//clause[@type = 'executivesummary']")&.remove or
28
- return
29
- preface = sect.at("//preface") ||
30
- sect.add_previous_sibling("<preface/>").first
31
- preface.add_child summ
32
- end
33
-
34
25
  def insert_security(xml, sect)
35
- description = "document"
36
- description = "standard" if %w(standard community-standard)
26
+ "document"
27
+ "standard" if %w(standard community-standard)
37
28
  .include?(@doctype)
38
29
  @doctype == "engineering-report" and return remove_security(xml)
39
30
  preface = sect.at("//preface") ||
@@ -61,14 +52,13 @@ module Metanorma
61
52
  end
62
53
 
63
54
  def insert_submitters(xml, sect)
64
- if xml.at("//submitters")
65
- preface = sect.at("//preface") ||
55
+ if xml.at("//clause[@type = 'submitters' or @type = 'contributors']")
56
+ p = sect.at("//preface") ||
66
57
  sect.add_previous_sibling("<preface/>").first
67
- xml.xpath("//submitters").each do |s|
68
- s.xpath(".//table").each do |t|
69
- t["unnumbered"] = true
70
- end
71
- preface.add_child s.remove
58
+ xml.xpath("//clause[@type = 'submitters' or @type = 'contributors']")
59
+ .each do |s|
60
+ s.xpath(".//table").each { |t| t["unnumbered"] = true }
61
+ p.add_child s.remove
72
62
  end
73
63
  end
74
64
  end
@@ -11,9 +11,6 @@ module Metanorma
11
11
  # schema encapsulation of the document for validation
12
12
  #
13
13
  class Converter < Standoc::Converter
14
- #XML_ROOT_TAG = "ogc-standard".freeze
15
- #XML_NAMESPACE = "https://www.metanorma.org/ns/ogc".freeze
16
-
17
14
  register_for "ogc"
18
15
 
19
16
  def init_toc(node)
@@ -71,10 +68,8 @@ module Metanorma
71
68
 
72
69
  def override_style(node)
73
70
  s = node.attr("style")
74
- if %w(executive_summary overview future_outlook value_proposition
75
- contributors).include?(s)
71
+ if %w(overview future_outlook value_proposition contributors).include?(s)
76
72
  node.set_attr("style", "preface")
77
- s == "executive_summary" and s = "executivesummary"
78
73
  node.set_attr("type", s)
79
74
  end
80
75
  if %w(aims objectives topics outlook security).include?(s)
@@ -93,6 +88,12 @@ module Metanorma
93
88
  end
94
89
  end
95
90
 
91
+ # legacy encoding
92
+ def sectiontype1(node)
93
+ role_style(node, "executive_summary") and return "executivesummary"
94
+ super
95
+ end
96
+
96
97
  def outputs(node, ret)
97
98
  File.open("#{@filename}.xml", "w:UTF-8") { |f| f.write(ret) }
98
99
  presentation_xml_converter(node).convert("#{@filename}.xml")
@@ -105,20 +106,18 @@ module Metanorma
105
106
  end
106
107
 
107
108
  def clause_parse(attrs, xml, node)
108
- %w(executivesummary overview future_outlook value_proposition
109
+ %w(overview future_outlook value_proposition
109
110
  contributors aims objectives topics outlook security)
110
111
  .include?(node.attr("type")) and
111
112
  attrs = attrs.merge(type: node.attr("type"))
112
113
  case node.attr("heading")&.downcase || node.title.downcase
113
114
  when "submitters"
114
- return submitters_parse(attrs, xml, node)
115
+ return submitters_parse(attrs.merge(type: "submitters"), xml, node)
115
116
  when "contributors"
116
117
  return submitters_parse(attrs.merge(type: "contributors"), xml, node)
117
118
  when "conformance" then attrs = attrs.merge(type: "conformance")
118
119
  when "security considerations"
119
120
  attrs = attrs.merge(type: "security")
120
- when "executive summary"
121
- attrs = attrs.merge(type: "executivesummary")
122
121
  end
123
122
  super
124
123
  end
@@ -128,7 +127,7 @@ module Metanorma
128
127
  doctype(node) == "engineering-report" ||
129
128
  attrs[:type] == "contributors" and
130
129
  title = @i18n.contributors_clause
131
- xml.submitters **attr_code(attrs) do |xml_section|
130
+ xml.clause **attr_code(attrs) do |xml_section|
132
131
  xml_section.title title
133
132
  xml_section << node.content
134
133
  end
@@ -164,7 +163,8 @@ module Metanorma
164
163
  end
165
164
  end
166
165
 
167
- def highlight_parse(text, xml)
166
+ # KILL
167
+ def highlight_parsex(text, xml)
168
168
  xml.hi { |s| s << text }
169
169
  end
170
170
 
@@ -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.3 -->
3
+ <!-- VERSION v2.0.4 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -1328,6 +1328,7 @@ numbers</a:documentation>
1328
1328
  <ref name="foreword"/>
1329
1329
  <ref name="introduction"/>
1330
1330
  <ref name="acknowledgements"/>
1331
+ <ref name="executivesummary"/>
1331
1332
  </choice>
1332
1333
  </oneOrMore>
1333
1334
  </element>
@@ -1351,6 +1352,11 @@ numbers</a:documentation>
1351
1352
  <ref name="Content-Section"/>
1352
1353
  </element>
1353
1354
  </define>
1355
+ <define name="executivesummary">
1356
+ <element name="executivesummary">
1357
+ <ref name="Content-Section"/>
1358
+ </element>
1359
+ </define>
1354
1360
  <define name="indexsect">
1355
1361
  <element name="indexsect">
1356
1362
  <ref name="Content-Section"/>
@@ -1576,6 +1582,15 @@ used in document amendments</a:documentation>
1576
1582
  <define name="annex">
1577
1583
  <element name="annex">
1578
1584
  <ref name="Annex-Section"/>
1585
+ <zeroOrMore>
1586
+ <ref name="annex-appendix"/>
1587
+ </zeroOrMore>
1588
+ </element>
1589
+ </define>
1590
+ <define name="annex-appendix">
1591
+ <a:documentation>Appendix, distinct subclause type for annexes (annex to annex, rather than subclause to annex)</a:documentation>
1592
+ <element name="appendix">
1593
+ <ref name="Clause-Section"/>
1579
1594
  </element>
1580
1595
  </define>
1581
1596
  <define name="terms">
@@ -1,39 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar ns='https://www.metanorma.org/ns/standoc' xmlns="http://relaxng.org/ns/structure/1.0">
3
3
  <include href="relaton-ogc.rng"/>
4
- <include href="isodoc.rng">
5
- <define name="preface">
6
- <element name="preface">
7
- <optional>
8
- <ref name="abstract"/>
9
- </optional>
10
- <ref name="foreword"/>
11
- <optional>
12
- <ref name="submitters"/>
13
- </optional>
14
- </element>
15
- </define>
16
- </include>
17
- <!-- end overrides -->
18
- <define name="TextElement" combine="choice">
19
- <ref name="hi"/>
20
- </define>
21
- <define name="PureTextElement" combine="choice">
22
- <ref name="hi"/>
23
- </define>
24
- <define name="hi">
25
- <element name="hi">
26
- <zeroOrMore>
27
- <choice>
28
- <ref name="PureTextElement"/>
29
- <ref name="stem"/>
30
- </choice>
31
- </zeroOrMore>
32
- </element>
33
- </define>
34
- <define name="submitters">
35
- <element name="submitters">
36
- <ref name="Basic-Section"/>
37
- </element>
38
- </define>
4
+ <include href="isodoc.rng"/>
39
5
  </grammar>
6
+ <!-- end overrides -->
@@ -56,7 +56,7 @@ module Metanorma
56
56
  end
57
57
 
58
58
  def execsummary_validate(xmldoc)
59
- sect = xmldoc.at("//clause[@type = 'executivesummary']")
59
+ sect = xmldoc.at("//executivesummary")
60
60
  @doctype == "engineering-report" && sect.nil? and
61
61
  @log.add("Style", nil,
62
62
  "Executive Summary required for Engineering Reports!")
@@ -136,8 +136,8 @@ module Metanorma
136
136
  root.at("//bibdata/contributor[role/@type = 'author']/organization/" \
137
137
  "name") or
138
138
  @log.add("Style", nil, "Submitting Organizations is missing!")
139
- root.at("//submitters") or @log.add("Style", nil,
140
- "Submitters is missing!")
139
+ root.at("//clause[@type = 'submitters' or @type = 'contributors']") or
140
+ @log.add("Style", nil, "Submitters is missing!")
141
141
  end
142
142
 
143
143
  def norm_ref_validate(doc)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.7.4".freeze
3
+ VERSION = "2.7.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.7.4
4
+ version: 2.7.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-04-14 00:00:00.000000000 Z
11
+ date: 2025-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639