metanorma-ogc 2.4.3 → 2.4.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -1
  3. data/lib/isodoc/ogc/html_convert.rb +2 -2
  4. data/lib/isodoc/ogc/i18n-en.yaml +1 -1
  5. data/lib/isodoc/ogc/i18n.rb +7 -2
  6. data/lib/isodoc/ogc/metadata.rb +1 -1
  7. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +44 -11
  8. data/lib/isodoc/ogc/ogc.best-practice.xsl +44 -11
  9. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +44 -11
  10. data/lib/isodoc/ogc/ogc.community-practice.xsl +44 -11
  11. data/lib/isodoc/ogc/ogc.community-standard.xsl +44 -11
  12. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +44 -11
  13. data/lib/isodoc/ogc/ogc.draft-standard.xsl +44 -11
  14. data/lib/isodoc/ogc/ogc.engineering-report.xsl +44 -11
  15. data/lib/isodoc/ogc/ogc.other.xsl +44 -11
  16. data/lib/isodoc/ogc/ogc.policy.xsl +44 -11
  17. data/lib/isodoc/ogc/ogc.reference-model.xsl +44 -11
  18. data/lib/isodoc/ogc/ogc.release-notes.xsl +44 -11
  19. data/lib/isodoc/ogc/ogc.standard.xsl +44 -11
  20. data/lib/isodoc/ogc/ogc.test-suite.xsl +44 -11
  21. data/lib/isodoc/ogc/ogc.user-guide.xsl +44 -11
  22. data/lib/isodoc/ogc/ogc.white-paper.xsl +11 -2
  23. data/lib/isodoc/ogc/xref.rb +2 -2
  24. data/lib/metanorma/ogc/basicdoc.rng +38 -35
  25. data/lib/metanorma/ogc/biblio.rng +22 -0
  26. data/lib/metanorma/ogc/cleanup.rb +30 -10
  27. data/lib/metanorma/ogc/converter.rb +14 -1
  28. data/lib/metanorma/ogc/front.rb +13 -14
  29. data/lib/metanorma/ogc/isodoc.rng +45 -1
  30. data/lib/metanorma/ogc/processor.rb +1 -0
  31. data/lib/metanorma/ogc/validate.rb +2 -2
  32. data/lib/metanorma/ogc/version.rb +1 -1
  33. data/metanorma-ogc.gemspec +1 -1
  34. metadata +4 -4
@@ -86,25 +86,26 @@ module Metanorma
86
86
  end
87
87
 
88
88
  def section_names_terms_cleanup(xml)
89
- replace_title(xml, "//definitions[@type = 'symbols']", @i18n&.symbols)
89
+ @i18n or return
90
+ replace_title(xml, "//definitions[@type = 'symbols']", @i18n.symbols)
90
91
  replace_title(xml, "//definitions[@type = 'abbreviated_terms']",
91
- @i18n&.abbrev)
92
- replace_title(xml, "//definitions[not(@type)]", @i18n&.symbolsabbrev)
92
+ @i18n.abbrev)
93
+ replace_title(xml, "//definitions[not(@type)]", @i18n.symbolsabbrev)
93
94
  replace_title(xml, "//sections//terms#{SYMnoABBR} | " \
94
95
  "//sections//clause[.//terms]#{SYMnoABBR}",
95
- @i18n&.termsdefsymbols, true)
96
+ @i18n.termsdefsymbols, true)
96
97
  replace_title(xml, "//sections//terms#{ABBRnoSYM} | " \
97
98
  "//sections//clause[.//terms]#{ABBRnoSYM}",
98
- @i18n&.termsdefabbrev, true)
99
+ @i18n.termsdefabbrev, true)
99
100
  replace_title(xml, "//sections//terms#{SYMABBR} | " \
100
101
  "//sections//clause[.//terms]#{SYMABBR}",
101
- @i18n&.termsdefsymbolsabbrev, true)
102
+ @i18n.termsdefsymbolsabbrev, true)
102
103
  replace_title(xml, "//sections//terms#{NO_SYMABBR} | " \
103
104
  "//sections//clause[.//terms]#{NO_SYMABBR}",
104
- @i18n&.termsdefsymbolsabbrev, true)
105
+ @i18n.termsdefsymbolsabbrev, true)
105
106
  replace_title(xml, "//sections//terms[not(.//definitions)] | " \
106
107
  "//sections//clause[.//terms][not(.//definitions)]",
107
- @i18n&.termsdef, true)
108
+ @i18n.termsdef, true)
108
109
  end
109
110
 
110
111
  def termdef_cleanup(xmldoc)
@@ -115,8 +116,7 @@ module Metanorma
115
116
  # skip annex/terms/terms, which is empty node
116
117
  def termdef_subclause_cleanup(xmldoc)
117
118
  xmldoc.xpath("//annex//clause[terms]").each do |t|
118
- next unless t.xpath("./clause | ./terms | ./definitions").size == 1
119
-
119
+ t.xpath("./clause | ./terms | ./definitions").size == 1 or next
120
120
  t.children.each { |n| n.parent = t.parent }
121
121
  t.remove
122
122
  end
@@ -224,6 +224,26 @@ module Metanorma
224
224
  partid: partid&.to_i || 0,
225
225
  type: id ? id["type"] : nil }
226
226
  end
227
+
228
+ # Numbers sort *before* letters; we leave out using thorn to force that sort order.
229
+ # case insensitive
230
+ def symbol_key(sym)
231
+ @c.decode(asciimath_key(sym).text)
232
+ .gsub(/[\[\]{}<>()]/, "").gsub(/\s/m, "")
233
+ .gsub(/[[:punct:]]|[_^]/, ":\\0").gsub("`", "")
234
+ end
235
+
236
+ def symbols_cleanup(docxml)
237
+ docxml.xpath("//definitions/dl").each do |dl|
238
+ dl_out = extract_symbols_list(dl)
239
+ dl_out.sort! do |a, b|
240
+ a[:key].downcase <=> b[:key].downcase || a[:key] <=> b[:key] ||
241
+ a[:dt] <=> b[:dt]
242
+ end
243
+ dl.children = dl_out.map { |d| d[:dt].to_s + d[:dd].to_s }.join("\n")
244
+ end
245
+ docxml
246
+ end
227
247
  end
228
248
  end
229
249
  end
@@ -154,7 +154,9 @@ module Metanorma
154
154
  end
155
155
 
156
156
  def presentation_xml_converter(node)
157
- IsoDoc::Ogc::PresentationXMLConvert.new(html_extract_attributes(node))
157
+ IsoDoc::Ogc::PresentationXMLConvert
158
+ .new(html_extract_attributes(node)
159
+ .merge(output_formats: ::Metanorma::Ogc::Processor.new.output_formats))
158
160
  end
159
161
 
160
162
  def html_converter(node)
@@ -170,6 +172,17 @@ module Metanorma
170
172
  def doc_converter(node)
171
173
  IsoDoc::Ogc::WordConvert.new(doc_extract_attributes(node))
172
174
  end
175
+
176
+ # preempt subdoctype warning
177
+ def adoc2xml(text, flavour)
178
+ Nokogiri::XML(text).root and return text
179
+ c = Asciidoctor
180
+ .convert("= X\nA\n:semantic-metadata-headless: true\n" \
181
+ ":novalid:\n:docsubtype: implementation\n" \
182
+ ":doctype: standard\n\n#{text}\n",
183
+ backend: flavour, header_footer: true)
184
+ Nokogiri::XML(c).at("//xmlns:sections")
185
+ end
173
186
  end
174
187
  end
175
188
  end
@@ -11,8 +11,7 @@ module Metanorma
11
11
  end
12
12
 
13
13
  def corporate_author(node, xml)
14
- return unless node.attr("submitting-organizations")
15
-
14
+ node.attr("submitting-organizations") or return
16
15
  csv_split(HTMLEntities.new
17
16
  .decode(node.attr("submitting-organizations")), ";")&.each do |org|
18
17
  xml.contributor do |c|
@@ -49,8 +48,7 @@ module Metanorma
49
48
  end
50
49
 
51
50
  def ogc_editor(node, xml)
52
- return unless node.attr("editor")
53
-
51
+ node.attr("editor") or return
54
52
  xml.contributor do |c|
55
53
  c.role type: "editor"
56
54
  c.person do |p|
@@ -78,12 +76,15 @@ module Metanorma
78
76
  end
79
77
 
80
78
  def default_publisher
81
- "Open Geospatial Consortium"
79
+ "OGC"
82
80
  end
83
81
 
84
- def metadata_committee(node, xml)
85
- return unless node.attr("committee")
82
+ def org_abbrev
83
+ { "Open Geospatial Consortium" => "OGC" }
84
+ end
86
85
 
86
+ def metadata_committee(node, xml)
87
+ node.attr("committee") or return
87
88
  xml.editorialgroup do |a|
88
89
  metadata_committee1(node, a)
89
90
  end
@@ -102,12 +103,10 @@ module Metanorma
102
103
  end
103
104
 
104
105
  def externalid(node)
105
- return node.attr("external-id") if node.attr("external-id")
106
-
106
+ i = node.attr("external-id") and return i
107
107
  d = doctype(node)
108
108
  a = node.attr("abbrev")
109
- return unless d && a
110
-
109
+ d && a or return
111
110
  url = "http://www.opengis.net/doc/#{IsoDoc::Ogc::DOCTYPE_ABBR[d]}/#{a}"
112
111
  v = (node.attr("edition") || node.attr("version")) and url += "/#{v}"
113
112
  url
@@ -181,12 +180,12 @@ module Metanorma
181
180
  unless %w{general encoding extension profile
182
181
  profile-with-extension}.include? s
183
182
  @log.add("Document Attributes", nil,
184
- "'#{s}' is not a permitted subtype of Standard: " \
185
- "reverting to 'implementation'")
183
+ "'#{s}' is not a permitted subtype of best-practice: " \
184
+ "reverting to 'general'")
186
185
  s = "general"
187
186
  end
188
187
  end
189
- s and xml.subdoctype s
188
+ s && !s.empty? and xml.subdoctype s
190
189
  end
191
190
 
192
191
  def title(node, xml)
@@ -17,7 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
- <!-- VERSION v1.2.5 -->
20
+ <!-- VERSION v1.2.9 -->
21
21
  <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">
22
22
  <include href="reqt.rng"/>
23
23
  <include href="basicdoc.rng">
@@ -1013,6 +1013,14 @@
1013
1013
  </oneOrMore>
1014
1014
  </element>
1015
1015
  </define>
1016
+ <define name="BasicBlock" combine="choice">
1017
+ <ref name="columnbreak"/>
1018
+ </define>
1019
+ <define name="columnbreak">
1020
+ <element name="columnbreak">
1021
+ <empty/>
1022
+ </element>
1023
+ </define>
1016
1024
  <define name="MultilingualRenderingType">
1017
1025
  <choice>
1018
1026
  <value>common</value>
@@ -1046,6 +1054,17 @@
1046
1054
  <ref name="date_inline"/>
1047
1055
  </choice>
1048
1056
  </define>
1057
+ <define name="PureTextElement" combine="choice">
1058
+ <ref name="passthrough_inline"/>
1059
+ </define>
1060
+ <define name="passthrough_inline">
1061
+ <element name="passthrough">
1062
+ <optional>
1063
+ <attribute name="formats"/>
1064
+ </optional>
1065
+ <text/>
1066
+ </element>
1067
+ </define>
1049
1068
  <define name="add">
1050
1069
  <element name="add">
1051
1070
  <choice>
@@ -1084,6 +1103,9 @@
1084
1103
  <optional>
1085
1104
  <attribute name="style"/>
1086
1105
  </optional>
1106
+ <optional>
1107
+ <attribute name="custom-charset"/>
1108
+ </optional>
1087
1109
  <oneOrMore>
1088
1110
  <ref name="TextElement"/>
1089
1111
  </oneOrMore>
@@ -1386,6 +1408,9 @@
1386
1408
  <optional>
1387
1409
  <attribute name="number"/>
1388
1410
  </optional>
1411
+ <optional>
1412
+ <attribute name="branch-number"/>
1413
+ </optional>
1389
1414
  <optional>
1390
1415
  <attribute name="obligation">
1391
1416
  <choice>
@@ -1609,6 +1634,9 @@
1609
1634
  <optional>
1610
1635
  <attribute name="number"/>
1611
1636
  </optional>
1637
+ <optional>
1638
+ <attribute name="branch-number"/>
1639
+ </optional>
1612
1640
  <optional>
1613
1641
  <attribute name="type"/>
1614
1642
  </optional>
@@ -1660,6 +1688,9 @@
1660
1688
  <optional>
1661
1689
  <attribute name="number"/>
1662
1690
  </optional>
1691
+ <optional>
1692
+ <attribute name="branch-number"/>
1693
+ </optional>
1663
1694
  <optional>
1664
1695
  <ref name="section-title"/>
1665
1696
  </optional>
@@ -1757,6 +1788,9 @@
1757
1788
  <optional>
1758
1789
  <attribute name="number"/>
1759
1790
  </optional>
1791
+ <optional>
1792
+ <attribute name="branch-number"/>
1793
+ </optional>
1760
1794
  <optional>
1761
1795
  <attribute name="obligation">
1762
1796
  <choice>
@@ -1924,6 +1958,16 @@
1924
1958
  <data type="boolean"/>
1925
1959
  </attribute>
1926
1960
  </optional>
1961
+ <optional>
1962
+ <attribute name="type">
1963
+ <choice>
1964
+ <value>letter</value>
1965
+ <value>symbol</value>
1966
+ <value>formula</value>
1967
+ <value>equation</value>
1968
+ </choice>
1969
+ </attribute>
1970
+ </optional>
1927
1971
  <element name="name">
1928
1972
  <oneOrMore>
1929
1973
  <choice>
@@ -40,6 +40,7 @@ module Metanorma
40
40
  end
41
41
 
42
42
  def output(isodoc_node, inname, outname, format, options={})
43
+ options_preprocess(options)
43
44
  case format
44
45
  when :html then IsoDoc::Ogc::HtmlConvert.new(options)
45
46
  .convert(inname, isodoc_node, nil, outname)
@@ -25,7 +25,7 @@ module Metanorma
25
25
  @doctype == "engineering-report" and return
26
26
  stage = xmldoc&.at("//bibdata/status/stage")&.text
27
27
  %w(draft swg-draft oab-review public-rfc tc-vote work-item-draft
28
- approved deprecated retired rescinded).include? stage or
28
+ approved deprecated retired rescinded legacy).include? stage or
29
29
  @log.add("Document Attributes", nil,
30
30
  "#{stage} is not a recognised status")
31
31
  stage_type_validate(stage, @doctype)
@@ -40,7 +40,7 @@ module Metanorma
40
40
  when "best-practice", "community-practice"
41
41
  %w(draft swg-draft work-item-draft).include?(stage)
42
42
  else %w(swg-draft oab-review public-rfc tc-vote
43
- work-item-draft deprecated rescinded).include?(stage)
43
+ work-item-draft deprecated rescinded legacy).include?(stage)
44
44
  end
45
45
  err and @log.add("Document Attributes", nil,
46
46
  "#{stage} is not an allowed status for #{doctype}")
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.4.3".freeze
3
+ VERSION = "2.4.7".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(">= 2.7.0")
27
27
 
28
28
  spec.add_dependency "iso-639"
29
- spec.add_dependency "metanorma-standoc", "~> 2.6.0"
29
+ spec.add_dependency "metanorma-standoc", "~> 2.7.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.4.3
4
+ version: 2.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-25 00:00:00.000000000 Z
11
+ date: 2023-12-10 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: 2.6.0
33
+ version: 2.7.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: 2.6.0
40
+ version: 2.7.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: debug
43
43
  requirement: !ruby/object:Gem::Requirement