metanorma-ogc 1.5.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +4 -32
  3. data/.gitignore +11 -0
  4. data/Gemfile +1 -0
  5. data/lib/isodoc/ogc/biblio.rb +7 -6
  6. data/lib/isodoc/ogc/html/htmlstyle.css +48 -28
  7. data/lib/isodoc/ogc/html/htmlstyle.scss +18 -11
  8. data/lib/isodoc/ogc/html/scripts.html +0 -1
  9. data/lib/isodoc/ogc/html/wordstyle.css +30 -18
  10. data/lib/isodoc/ogc/html/wordstyle.scss +30 -18
  11. data/lib/isodoc/ogc/html/wordstyle_wp.css +22 -12
  12. data/lib/isodoc/ogc/html/wordstyle_wp.scss +22 -12
  13. data/lib/isodoc/ogc/metadata.rb +1 -0
  14. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +500 -229
  15. data/lib/isodoc/ogc/ogc.best-practice.xsl +500 -229
  16. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +500 -229
  17. data/lib/isodoc/ogc/ogc.community-practice.xsl +500 -229
  18. data/lib/isodoc/ogc/ogc.community-standard.xsl +500 -229
  19. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +500 -229
  20. data/lib/isodoc/ogc/ogc.engineering-report.xsl +500 -229
  21. data/lib/isodoc/ogc/ogc.other.xsl +500 -229
  22. data/lib/isodoc/ogc/ogc.policy.xsl +500 -229
  23. data/lib/isodoc/ogc/ogc.reference-model.xsl +500 -229
  24. data/lib/isodoc/ogc/ogc.release-notes.xsl +500 -229
  25. data/lib/isodoc/ogc/ogc.standard.xsl +500 -229
  26. data/lib/isodoc/ogc/ogc.test-suite.xsl +500 -229
  27. data/lib/isodoc/ogc/ogc.user-guide.xsl +500 -229
  28. data/lib/isodoc/ogc/ogc.white-paper.xsl +467 -215
  29. data/lib/isodoc/ogc/presentation_xml_convert.rb +29 -5
  30. data/lib/isodoc/ogc/reqt.rb +1 -1
  31. data/lib/{asciidoctor → metanorma}/ogc/basicdoc.rng +0 -0
  32. data/lib/{asciidoctor → metanorma}/ogc/biblio.rng +0 -0
  33. data/lib/{asciidoctor → metanorma}/ogc/boilerplate.xml +0 -0
  34. data/lib/{asciidoctor → metanorma}/ogc/cleanup.rb +39 -10
  35. data/lib/{asciidoctor → metanorma}/ogc/converter.rb +14 -4
  36. data/lib/{asciidoctor → metanorma}/ogc/front.rb +2 -2
  37. data/lib/{asciidoctor → metanorma}/ogc/isodoc.rng +49 -2
  38. data/lib/{asciidoctor → metanorma}/ogc/ogc.rng +0 -0
  39. data/lib/{asciidoctor → metanorma}/ogc/reqt.rng +0 -0
  40. data/lib/{asciidoctor → metanorma}/ogc/validate.rb +1 -1
  41. data/lib/metanorma/ogc/version.rb +1 -1
  42. data/lib/metanorma/ogc.rb +1 -0
  43. data/lib/metanorma-ogc.rb +0 -1
  44. data/metanorma-ogc.gemspec +1 -1
  45. metadata +15 -16
  46. data/lib/asciidoctor/ogc.rb +0 -6
@@ -189,22 +189,33 @@ module IsoDoc
189
189
  end
190
190
 
191
191
  def bibdata_i18n(bib)
192
- stage = bib&.at(ns("./status/stage"))
193
192
  doctype = bib&.at(ns("./ext/doctype"))
193
+ rename_stage(bib&.at(ns("./status/stage")), doctype, bib)
194
+ rename_doctype(doctype, bib&.at(ns("./date[@type = 'published']")) ||
195
+ bib&.at(ns("./date[@type = 'issued']")))
196
+ super
197
+ end
198
+
199
+ def rename_stage(stage, doctype, _bib)
194
200
  if stage&.text == "approved" &&
195
201
  !%w(standard abstract-specification-topic
196
202
  community-standard).include?(doctype&.text)
197
203
  stage.children = "published"
198
204
  end
199
- super
200
205
  end
201
206
 
202
- def ol(docxml)
203
- docxml.xpath(ns("//ol")).each do |f|
204
- ol1(f)
207
+ def rename_doctype(doctype, date)
208
+ return unless doctype&.text == "white-paper" && date
209
+
210
+ if Date.iso8601(date.text) >= Date.iso8601("2021-12-16")
211
+ doctype.children = "technical-paper"
205
212
  end
206
213
  end
207
214
 
215
+ def ol(docxml)
216
+ docxml.xpath(ns("//ol")).each { |f| ol1(f) }
217
+ end
218
+
208
219
  def ol1(elem)
209
220
  return unless elem["class"] == "steps"
210
221
 
@@ -213,6 +224,19 @@ module IsoDoc
213
224
  roman_upper)[(idx - 1) % 5]
214
225
  end
215
226
 
227
+ def termsource1(elem)
228
+ while elem&.next_element&.name == "termsource"
229
+ elem << "; #{elem.next_element.remove.children.to_xml}"
230
+ end
231
+ elem.children = l10n("[<strong>#{@i18n.source}:</strong> "\
232
+ "#{elem.children.to_xml.strip}]")
233
+ end
234
+
235
+ def bibliography_bibitem_number_skip(bibitem)
236
+ @xrefs.klass.implicit_reference(bibitem) ||
237
+ bibitem.at(ns(".//docidentifier[@type = 'metanorma-ordinal']"))
238
+ end
239
+
216
240
  include Init
217
241
  end
218
242
  end
@@ -114,7 +114,7 @@ module IsoDoc
114
114
 
115
115
  def preserve_in_nested_table?(node)
116
116
  return true if %w(recommendation requirement permission
117
- table).include?(node.name)
117
+ table ol dl ul).include?(node.name)
118
118
 
119
119
  false
120
120
  end
File without changes
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- module Asciidoctor
1
+ module Metanorma
2
2
  module Ogc
3
3
  class Converter < Standoc::Converter
4
4
  def sections_cleanup(xml)
@@ -58,6 +58,9 @@ module Asciidoctor
58
58
  super
59
59
  a = xmldoc.at("//bibdata/status/stage")
60
60
  a.text == "published" and a.children = "approved"
61
+ doctype = xmldoc.at("//bibdata/ext/doctype")
62
+ doctype.text == "technical-paper" and
63
+ doctype.children = "white-paper"
61
64
  end
62
65
 
63
66
  def section_names_terms_cleanup(xml)
@@ -171,15 +174,41 @@ module Asciidoctor
171
174
  xmldoc.xpath(REQRECPER).each do |r|
172
175
  next unless r["type"]
173
176
 
174
- r["type"] = case r["type"]
175
- when "requirement", "recommendation", "permission"
176
- "general"
177
- when "requirements_class" then "class"
178
- when "conformance_test" then "verification"
179
- when "conformance_class" then "conformanceclass"
180
- when "abstract_test" then "abstracttest"
181
- else r["type"]
182
- end
177
+ requirement_type1(r)
178
+ end
179
+ end
180
+
181
+ def requirement_type1(reqt)
182
+ reqt["type"] = case reqt["type"]
183
+ when "requirement", "recommendation", "permission"
184
+ "general"
185
+ when "requirements_class" then "class"
186
+ when "conformance_test" then "verification"
187
+ when "conformance_class" then "conformanceclass"
188
+ when "abstract_test" then "abstracttest"
189
+ else reqt["type"]
190
+ end
191
+ end
192
+
193
+ def normref_cleanup(xmldoc)
194
+ r1 = xmldoc.at("//references[title[translate(text(), 'R', 'r') = "\
195
+ "'Normative references']]")
196
+ r2 = xmldoc.at("//references[title[text() = 'References']]")
197
+ if r1 && r2
198
+ r2["normative"] = false
199
+ end
200
+ super
201
+ end
202
+
203
+ def obligations_cleanup_inherit(xml)
204
+ xml.xpath("//annex").each do |r|
205
+ r["obligation"] = "informative" unless r["obligation"]
206
+ end
207
+ xml.xpath("//clause[not(ancestor::boilerplate)]").each do |r|
208
+ r["obligation"] = "normative" unless r["obligation"]
209
+ end
210
+ xml.xpath(::Metanorma::Standoc::Utils::SUBCLAUSE_XPATH).each do |r|
211
+ o = r&.at("./ancestor::*/@obligation")&.text and r["obligation"] = o
183
212
  end
184
213
  end
185
214
  end
@@ -1,11 +1,11 @@
1
1
  require "asciidoctor"
2
- require "asciidoctor/standoc/converter"
2
+ require "metanorma/standoc/converter"
3
3
  require "fileutils"
4
4
  require_relative "front"
5
5
  require_relative "validate"
6
6
  require_relative "cleanup"
7
7
 
8
- module Asciidoctor
8
+ module Metanorma
9
9
  module Ogc
10
10
  # A {Converter} implementation that generates RSD output, and a document
11
11
  # schema encapsulation of the document for validation
@@ -31,7 +31,7 @@ module Asciidoctor
31
31
  change-request-supporting-document community-practice
32
32
  community-standard discussion-paper engineering-report
33
33
  reference-model release-notes standard user-guide white-paper
34
- test-suite}.include? d
34
+ technical-paper test-suite}.include? d
35
35
  @warned_doctype or
36
36
  @log.add("Document Attributes", nil,
37
37
  "'#{d}' is not a legal document type: reverting to 'standard'")
@@ -134,6 +134,16 @@ module Asciidoctor
134
134
  super
135
135
  end
136
136
 
137
+ def set_obligation(attrs, node)
138
+ if node.attr("style") == "appendix" && node.level == 1
139
+ attrs[:obligation] = if node.attributes.has_key?("obligation")
140
+ node.attr("obligation")
141
+ else "informative"
142
+ end
143
+ else super
144
+ end
145
+ end
146
+
137
147
  def presentation_xml_converter(node)
138
148
  IsoDoc::Ogc::PresentationXMLConvert.new(html_extract_attributes(node))
139
149
  end
@@ -145,7 +155,7 @@ module Asciidoctor
145
155
  def pdf_converter(node)
146
156
  return nil if node.attr("no-pdf")
147
157
 
148
- IsoDoc::Ogc::PdfConvert.new(html_extract_attributes(node))
158
+ IsoDoc::Ogc::PdfConvert.new(pdf_extract_attributes(node))
149
159
  end
150
160
 
151
161
  def doc_converter(node)
@@ -1,8 +1,8 @@
1
1
  require "asciidoctor"
2
- require "asciidoctor/standoc/converter"
2
+ require "metanorma/standoc/converter"
3
3
  require "fileutils"
4
4
 
5
- module Asciidoctor
5
+ module Metanorma
6
6
  module Ogc
7
7
  class Converter < Standoc::Converter
8
8
  def metadata_author(node, xml)
@@ -32,6 +32,19 @@
32
32
  <ref name="DocumentType"/>
33
33
  </element>
34
34
  </define>
35
+ <define name="bibitem">
36
+ <element name="bibitem">
37
+ <attribute name="id">
38
+ <data type="ID"/>
39
+ </attribute>
40
+ <optional>
41
+ <attribute name="hidden">
42
+ <data type="boolean"/>
43
+ </attribute>
44
+ </optional>
45
+ <ref name="BibliographicItem"/>
46
+ </element>
47
+ </define>
35
48
  <define name="section-title">
36
49
  <element name="title">
37
50
  <zeroOrMore>
@@ -690,6 +703,7 @@
690
703
  <ref name="terms"/>
691
704
  <ref name="term-clause"/>
692
705
  <ref name="definitions"/>
706
+ <ref name="floating-title"/>
693
707
  </choice>
694
708
  </oneOrMore>
695
709
  </element>
@@ -1680,6 +1694,7 @@
1680
1694
  <ref name="clause-subsection"/>
1681
1695
  <ref name="terms"/>
1682
1696
  <ref name="definitions"/>
1697
+ <ref name="floating-title"/>
1683
1698
  </choice>
1684
1699
  </oneOrMore>
1685
1700
  </choice>
@@ -1722,6 +1737,7 @@
1722
1737
  <ref name="terms"/>
1723
1738
  <ref name="definitions"/>
1724
1739
  <ref name="references"/>
1740
+ <ref name="floating-title"/>
1725
1741
  </choice>
1726
1742
  </zeroOrMore>
1727
1743
  </group>
@@ -1796,6 +1812,20 @@
1796
1812
  <data type="ID"/>
1797
1813
  </attribute>
1798
1814
  </optional>
1815
+ <optional>
1816
+ <attribute name="language"/>
1817
+ </optional>
1818
+ <optional>
1819
+ <attribute name="script"/>
1820
+ </optional>
1821
+ <optional>
1822
+ <attribute name="tag"/>
1823
+ </optional>
1824
+ <optional>
1825
+ <attribute name="multilingual-rendering">
1826
+ <ref name="MultilingualRenderingType"/>
1827
+ </attribute>
1828
+ </optional>
1799
1829
  <oneOrMore>
1800
1830
  <ref name="preferred"/>
1801
1831
  </oneOrMore>
@@ -1959,7 +1989,11 @@
1959
1989
  </optional>
1960
1990
  <element name="name">
1961
1991
  <zeroOrMore>
1962
- <ref name="PureTextElement"/>
1992
+ <choice>
1993
+ <ref name="PureTextElement"/>
1994
+ <ref name="stem"/>
1995
+ <ref name="index"/>
1996
+ </choice>
1963
1997
  </zeroOrMore>
1964
1998
  </element>
1965
1999
  <optional>
@@ -1973,7 +2007,7 @@
1973
2007
  </element>
1974
2008
  </optional>
1975
2009
  <optional>
1976
- <element name="grammar-info">
2010
+ <element name="grammar">
1977
2011
  <ref name="Grammar"/>
1978
2012
  </element>
1979
2013
  </optional>
@@ -2516,4 +2550,17 @@
2516
2550
  </oneOrMore>
2517
2551
  </element>
2518
2552
  </define>
2553
+ <define name="floating-title">
2554
+ <element name="floating-title">
2555
+ <attribute name="id">
2556
+ <data type="ID"/>
2557
+ </attribute>
2558
+ <attribute name="depth">
2559
+ <data type="int"/>
2560
+ </attribute>
2561
+ <zeroOrMore>
2562
+ <ref name="TextElement"/>
2563
+ </zeroOrMore>
2564
+ </element>
2565
+ </define>
2519
2566
  </grammar>
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- module Asciidoctor
1
+ module Metanorma
2
2
  module Ogc
3
3
  class Converter < Standoc::Converter
4
4
  def validate(doc)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "1.5.3".freeze
3
+ VERSION = "2.0.0".freeze
4
4
  end
5
5
  end
data/lib/metanorma/ogc.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "metanorma/ogc/version"
2
2
  require "metanorma/ogc/processor"
3
+ require "metanorma/ogc/converter"
3
4
 
4
5
  module Metanorma
5
6
  module Ogc
data/lib/metanorma-ogc.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require "metanorma/ogc"
2
2
  require "asciidoctor"
3
- require "asciidoctor/ogc"
4
3
  require "isodoc/ogc"
5
4
 
6
5
  if defined? Metanorma
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
26
26
 
27
27
  spec.add_dependency "iso-639"
28
- spec.add_dependency "metanorma-standoc", "~> 1.11.0"
28
+ spec.add_dependency "metanorma-standoc", "~> 2.0.0"
29
29
 
30
30
  spec.add_development_dependency "debug"
31
31
  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: 1.5.3
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-29 00:00:00.000000000 Z
11
+ date: 2022-01-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: 1.11.0
33
+ version: 2.0.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: 1.11.0
40
+ version: 2.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: debug
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -199,17 +199,6 @@ files:
199
199
  - bin/console
200
200
  - bin/rspec
201
201
  - bin/setup
202
- - lib/asciidoctor/ogc.rb
203
- - lib/asciidoctor/ogc/basicdoc.rng
204
- - lib/asciidoctor/ogc/biblio.rng
205
- - lib/asciidoctor/ogc/boilerplate.xml
206
- - lib/asciidoctor/ogc/cleanup.rb
207
- - lib/asciidoctor/ogc/converter.rb
208
- - lib/asciidoctor/ogc/front.rb
209
- - lib/asciidoctor/ogc/isodoc.rng
210
- - lib/asciidoctor/ogc/ogc.rng
211
- - lib/asciidoctor/ogc/reqt.rng
212
- - lib/asciidoctor/ogc/validate.rb
213
202
  - lib/isodoc/ogc.rb
214
203
  - lib/isodoc/ogc/base_convert.rb
215
204
  - lib/isodoc/ogc/biblio.rb
@@ -264,7 +253,17 @@ files:
264
253
  - lib/isodoc/ogc/xref.rb
265
254
  - lib/metanorma-ogc.rb
266
255
  - lib/metanorma/ogc.rb
256
+ - lib/metanorma/ogc/basicdoc.rng
257
+ - lib/metanorma/ogc/biblio.rng
258
+ - lib/metanorma/ogc/boilerplate.xml
259
+ - lib/metanorma/ogc/cleanup.rb
260
+ - lib/metanorma/ogc/converter.rb
261
+ - lib/metanorma/ogc/front.rb
262
+ - lib/metanorma/ogc/isodoc.rng
263
+ - lib/metanorma/ogc/ogc.rng
267
264
  - lib/metanorma/ogc/processor.rb
265
+ - lib/metanorma/ogc/reqt.rng
266
+ - lib/metanorma/ogc/validate.rb
268
267
  - lib/metanorma/ogc/version.rb
269
268
  - metanorma-ogc.gemspec
270
269
  homepage: https://github.com/metanorma/metanorma-ogc
@@ -286,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
286
285
  - !ruby/object:Gem::Version
287
286
  version: '0'
288
287
  requirements: []
289
- rubygems_version: 3.2.22
288
+ rubygems_version: 3.2.32
290
289
  signing_key:
291
290
  specification_version: 4
292
291
  summary: Metanorma for the Open Geospatial Consortium.
@@ -1,6 +0,0 @@
1
- require "asciidoctor/ogc/converter"
2
-
3
- module Asciidoctor
4
- module Ogc
5
- end
6
- end