metanorma-ogc 1.0.3 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +10 -10
  3. data/.github/workflows/ubuntu.yml +25 -11
  4. data/.github/workflows/windows.yml +11 -12
  5. data/README.adoc +3 -2
  6. data/lib/asciidoctor/ogc/biblio.rng +144 -49
  7. data/lib/asciidoctor/ogc/boilerplate.xml +37 -69
  8. data/lib/asciidoctor/ogc/converter.rb +6 -11
  9. data/lib/asciidoctor/ogc/isodoc.rng +49 -5
  10. data/lib/asciidoctor/ogc/ogc.rng +0 -4
  11. data/lib/isodoc/ogc/base_convert.rb +13 -112
  12. data/lib/isodoc/ogc/biblio.rb +13 -2
  13. data/lib/isodoc/ogc/html/html_ogc_titlepage.html +2 -6
  14. data/lib/isodoc/ogc/html/htmlstyle.scss +11 -1
  15. data/lib/isodoc/ogc/html/scripts.html +14 -27
  16. data/lib/isodoc/ogc/html/word_ogc_titlepage.html +13 -4
  17. data/lib/isodoc/ogc/html_convert.rb +1 -0
  18. data/lib/isodoc/ogc/i18n-en.yaml +3 -0
  19. data/lib/isodoc/ogc/metadata.rb +1 -31
  20. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +3387 -0
  21. data/lib/isodoc/ogc/ogc.best-practice.xsl +3387 -0
  22. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +3387 -0
  23. data/lib/isodoc/ogc/ogc.community-practice.xsl +3387 -0
  24. data/lib/isodoc/ogc/ogc.community-standard.xsl +3387 -0
  25. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +3387 -0
  26. data/lib/isodoc/ogc/ogc.engineering-report.xsl +3387 -0
  27. data/lib/isodoc/ogc/ogc.other.xsl +3387 -0
  28. data/lib/isodoc/ogc/ogc.policy.xsl +3387 -0
  29. data/lib/isodoc/ogc/ogc.reference-model.xsl +3387 -0
  30. data/lib/isodoc/ogc/ogc.release-notes.xsl +3387 -0
  31. data/lib/isodoc/ogc/ogc.standard.xsl +3387 -0
  32. data/lib/isodoc/ogc/ogc.test-suite.xsl +3387 -0
  33. data/lib/isodoc/ogc/ogc.user-guide.xsl +3387 -0
  34. data/lib/isodoc/ogc/ogc.white-paper.xsl +3387 -0
  35. data/lib/isodoc/ogc/pdf_convert.rb +18 -77
  36. data/lib/isodoc/ogc/reqt.rb +74 -114
  37. data/lib/isodoc/ogc/reqt_xref.rb +96 -0
  38. data/lib/isodoc/ogc/sections.rb +111 -0
  39. data/lib/isodoc/ogc/word_convert.rb +17 -11
  40. data/lib/metanorma/ogc/processor.rb +8 -0
  41. data/lib/metanorma/ogc/version.rb +1 -1
  42. data/metanorma-ogc.gemspec +1 -1
  43. metadata +21 -5
  44. data/lib/isodoc/ogc/html/scripts.pdf.html +0 -72
@@ -0,0 +1,111 @@
1
+ module IsoDoc
2
+ module Ogc
3
+ module BaseConvert
4
+ def annex_name(annex, name, div)
5
+ div.h1 **{ class: "Annex" } do |t|
6
+ t << "#{anchor(annex['id'], :label)} "
7
+ t.br
8
+ t.b do |b|
9
+ name&.children&.each { |c2| parse(c2, b) }
10
+ end
11
+ end
12
+ end
13
+
14
+ def keywords(_docxml, out)
15
+ kw = @meta.get[:keywords]
16
+ kw.empty? and return
17
+ @prefacenum += 1
18
+ out.div **{ class: "Section3" } do |div|
19
+ clause_name(RomanNumerals.to_roman(@prefacenum).downcase,
20
+ "Keywords", div, class: "IntroTitle")
21
+ div.p "The following are keywords to be used by search engines and "\
22
+ "document catalogues."
23
+ div.p kw.join(", ")
24
+ end
25
+ end
26
+
27
+ SUBMITTINGORGS =
28
+ "//bibdata/contributor[role/@type = 'author']/organization/name".freeze
29
+
30
+ def submittingorgs(docxml, out)
31
+ orgs = []
32
+ docxml.xpath(ns(SUBMITTINGORGS)).each { |org| orgs << org.text }
33
+ return if orgs.empty?
34
+ @prefacenum += 1
35
+ out.div **{ class: "Section3" } do |div|
36
+ clause_name(RomanNumerals.to_roman(@prefacenum).downcase,
37
+ "Submitting Organizations", div, class: "IntroTitle")
38
+ div.p "The following organizations submitted this Document to the "\
39
+ "Open Geospatial Consortium (OGC):"
40
+ div.ul do |ul|
41
+ orgs.each { |org| ul.li org }
42
+ end
43
+ end
44
+ end
45
+
46
+ def submitters(docxml, out)
47
+ f = docxml.at(ns("//submitters")) || return
48
+ @prefacenum += 1
49
+ out.div **{ class: "Section3" } do |div|
50
+ clause_name(anchor(f['id'], :label), "Submitters", div,
51
+ class: "IntroTitle")
52
+ f.elements.each { |e| parse(e, div) unless e.name == "title" }
53
+ end
54
+ end
55
+
56
+ def preface(isoxml, out)
57
+ title_attr = { class: "IntroTitle" }
58
+ isoxml.xpath(ns("//preface/clause")).each do |f|
59
+ @prefacenum += 1
60
+ out.div **{ class: "Section3", id: f["id"] } do |div|
61
+ clause_name(RomanNumerals.to_roman(@prefacenum).downcase,
62
+ f&.at(ns("./title")), div, title_attr)
63
+ f.elements.each { |e| parse(e, div) unless e.name == "title" }
64
+ end
65
+ end
66
+ end
67
+
68
+ def abstract(isoxml, out)
69
+ f = isoxml.at(ns("//preface/abstract")) || return
70
+ @prefacenum += 1
71
+ page_break(out)
72
+ out.div **attr_code(id: f["id"]) do |s|
73
+ clause_name(anchor(f["id"], :label), @abstract_lbl, s,
74
+ class: "AbstractTitle")
75
+ f.elements.each { |e| parse(e, s) unless e.name == "title" }
76
+ end
77
+ end
78
+
79
+ def foreword(isoxml, out)
80
+ f = isoxml.at(ns("//foreword")) || return
81
+ @prefacenum += 1
82
+ page_break(out)
83
+ out.div **attr_code(id: f["id"]) do |s|
84
+ clause_name(anchor(f["id"], :label), @foreword_lbl, s,
85
+ class: "ForewordTitle")
86
+ f.elements.each { |e| parse(e, s) unless e.name == "title" }
87
+ end
88
+ end
89
+
90
+ def acknowledgements(isoxml, out)
91
+ f = isoxml.at(ns("//acknowledgements")) || return
92
+ @prefacenum += 1
93
+ out.div **{ class: "Section3", id: f["id"] } do |div|
94
+ clause_name(anchor(f["id"], :label), f&.at(ns("./title")), div,
95
+ class: "IntroTitle")
96
+ f.elements.each { |e| parse(e, div) unless e.name == "title" }
97
+ end
98
+ end
99
+
100
+ def conformance(isoxml, out, num)
101
+ f = isoxml.at(ns("//clause[title = 'Conformance']")) or return num
102
+ out.div **attr_code(id: f["id"]) do |div|
103
+ num = num + 1
104
+ clause_name(num, "Conformance", div, nil)
105
+ f.elements.each { |e| parse(e, div) unless e.name == "title" }
106
+ end
107
+ num
108
+ end
109
+ end
110
+ end
111
+ end
@@ -11,15 +11,17 @@ module IsoDoc
11
11
  class WordConvert < IsoDoc::WordConvert
12
12
  def initialize(options)
13
13
  @libdir = File.dirname(__FILE__)
14
+ @reqtlabels = {}
14
15
  super
15
- #FileUtils.cp html_doc_path('logo.jpg'), "logo.jpg"
16
16
  end
17
17
 
18
18
  def default_fonts(options)
19
19
  {
20
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Times New Roman",serif'),
21
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Times New Roman",serif'),
22
- monospacefont: '"Courier New",monospace'
20
+ bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
21
+ '"Times New Roman",serif'),
22
+ headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
23
+ '"Times New Roman",serif'),
24
+ monospacefont: '"Courier New",monospace'
23
25
  }
24
26
  end
25
27
 
@@ -35,7 +37,6 @@ module IsoDoc
35
37
  }
36
38
  end
37
39
 
38
-
39
40
  def metadata_init(lang, script, labels)
40
41
  @meta = Metadata.new(lang, script, labels)
41
42
  end
@@ -144,17 +145,27 @@ module IsoDoc
144
145
  def word_cleanup(docxml)
145
146
  super
146
147
  word_recommend_cleanup(docxml)
148
+ word_copyright_cleanup(docxml)
147
149
  word_license_cleanup(docxml)
148
150
  word_term_cleanup(docxml)
149
151
  docxml
150
152
  end
151
153
 
152
154
  def word_license_cleanup(docxml)
153
- docxml.xpath("//div[@class = 'boilerplate-license']//p[not(@class)]").each do |p|
155
+ x = "//div[@class = 'boilerplate-license']//p[not(@class)]"
156
+ docxml.xpath(x).each do |p|
154
157
  p["class"] = "license"
155
158
  end
156
159
  end
157
160
 
161
+ # center only the Copyright notice
162
+ def word_copyright_cleanup(docxml)
163
+ x = "//div[@class = 'boilerplate-copyright']/div[1]/p[not(@class)]"
164
+ docxml.xpath(x).each do |p|
165
+ p["align"] = "center"
166
+ end
167
+ end
168
+
158
169
  def word_term_cleanup(docxml)
159
170
  docxml.xpath("//p[@class = 'TermNum']//p[@class = 'Terms']").each do |p|
160
171
  p.replace(p.children)
@@ -175,11 +186,6 @@ module IsoDoc
175
186
  end
176
187
  end
177
188
 
178
- def authority_cleanup(docxml)
179
- docxml&.at("//div[@id = 'boilerplate-contact']")&.remove
180
- super
181
- end
182
-
183
189
  include BaseConvert
184
190
  end
185
191
  end
@@ -2,6 +2,14 @@ require "metanorma/processor"
2
2
 
3
3
  module Metanorma
4
4
  module Ogc
5
+ def self.fonts_used
6
+ {
7
+ doc: ["Arial", "Courier New", "Times New Roman"],
8
+ pdf: ["Arial", "Courier New", "Times New Roman"],
9
+ html: ["Overpass", "Space Mono"]
10
+ }
11
+ end
12
+
5
13
  class Processor < Metanorma::Processor
6
14
 
7
15
  def initialize
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.8"
4
4
  end
5
5
  end
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_dependency "htmlentities", "~> 4.3.4"
28
28
  spec.add_dependency "ruby-jing"
29
- spec.add_dependency "metanorma-standoc", "~> 1.3.20"
29
+ spec.add_dependency "metanorma-standoc", "~> 1.4.0"
30
30
  spec.add_dependency "isodoc", "~> 1.0.20"
31
31
  spec.add_dependency "iso-639"
32
32
 
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.0.3
4
+ version: 1.0.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: 2020-03-20 00:00:00.000000000 Z
11
+ date: 2020-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3.20
47
+ version: 1.4.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.3.20
54
+ version: 1.4.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: isodoc
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -250,15 +250,31 @@ files:
250
250
  - lib/isodoc/ogc/html/htmlstyle.scss
251
251
  - lib/isodoc/ogc/html/ogc.scss
252
252
  - lib/isodoc/ogc/html/scripts.html
253
- - lib/isodoc/ogc/html/scripts.pdf.html
254
253
  - lib/isodoc/ogc/html/word_ogc_intro.html
255
254
  - lib/isodoc/ogc/html/word_ogc_titlepage.html
256
255
  - lib/isodoc/ogc/html/wordstyle.scss
257
256
  - lib/isodoc/ogc/html_convert.rb
258
257
  - lib/isodoc/ogc/i18n-en.yaml
259
258
  - lib/isodoc/ogc/metadata.rb
259
+ - lib/isodoc/ogc/ogc.abstract-specification-topic.xsl
260
+ - lib/isodoc/ogc/ogc.best-practice.xsl
261
+ - lib/isodoc/ogc/ogc.change-request-supporting-document.xsl
262
+ - lib/isodoc/ogc/ogc.community-practice.xsl
263
+ - lib/isodoc/ogc/ogc.community-standard.xsl
264
+ - lib/isodoc/ogc/ogc.discussion-paper.xsl
265
+ - lib/isodoc/ogc/ogc.engineering-report.xsl
266
+ - lib/isodoc/ogc/ogc.other.xsl
267
+ - lib/isodoc/ogc/ogc.policy.xsl
268
+ - lib/isodoc/ogc/ogc.reference-model.xsl
269
+ - lib/isodoc/ogc/ogc.release-notes.xsl
270
+ - lib/isodoc/ogc/ogc.standard.xsl
271
+ - lib/isodoc/ogc/ogc.test-suite.xsl
272
+ - lib/isodoc/ogc/ogc.user-guide.xsl
273
+ - lib/isodoc/ogc/ogc.white-paper.xsl
260
274
  - lib/isodoc/ogc/pdf_convert.rb
261
275
  - lib/isodoc/ogc/reqt.rb
276
+ - lib/isodoc/ogc/reqt_xref.rb
277
+ - lib/isodoc/ogc/sections.rb
262
278
  - lib/isodoc/ogc/word_convert.rb
263
279
  - lib/metanorma-ogc.rb
264
280
  - lib/metanorma/ogc.rb
@@ -1,72 +0,0 @@
1
- <script>
2
- //TOC generation
3
- $('#toc').toc({
4
- 'selectors': toclevel(), //elements to use as headings
5
- 'container': 'main', //element to find all selectors in
6
- 'smoothScrolling': true, //enable or disable smooth scrolling on click
7
- 'prefix': 'toc', //prefix for anchor tags and class names
8
- 'onHighlight': function(el) {}, //called when a new section is highlighted
9
- 'highlightOnScroll': false, //add class to heading that is currently in focus
10
- 'highlightOffset': 100, //offset to trigger the next headline
11
- 'anchorName': function(i, heading, prefix) { //custom function for anchor name
12
- return prefix+i;
13
- },
14
- 'headerText': function(i, heading, $heading) { //custom function building the header-item text
15
- return $heading.text();
16
- },
17
- 'itemClass': function(i, heading, $heading, prefix) { // custom function for item class
18
- return $heading[0].tagName.toLowerCase();
19
- }
20
- });
21
-
22
- </script>
23
-
24
- <script>
25
- //TOC toggle animation
26
- $('#toggle').on('click', function(){
27
- if( $('nav').is(':visible') ) {
28
- $('nav').animate({ 'left': '-353px' }, 'slow', function(){
29
- $('nav').hide();
30
- });
31
- $('.container').animate({ 'padding-left': '31px' }, 'slow');
32
- }
33
- else {
34
- $('nav').show();
35
- $('nav').animate({ 'left': '0px' }, 'slow');
36
- $('.container').animate({ 'padding-left': '360px' }, 'slow');
37
- }
38
- });
39
- </script>
40
-
41
- <script>
42
- // Scroll to top button
43
- window.onscroll = function() {scrollFunction()};
44
-
45
- function scrollFunction() {
46
- if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
47
- document.getElementById("myBtn").style.display = "block";
48
- } else {
49
- document.getElementById("myBtn").style.display = "none";
50
- }
51
- }
52
-
53
- // When the user clicks on the button, scroll to the top of the document
54
- function topFunction() {
55
- document.body.scrollTop = 0;
56
- document.documentElement.scrollTop = 0;
57
- }
58
- </script>
59
-
60
- <script>
61
- /*
62
- $(document).ready(function() {
63
- $('[id^=toc]').each(function ()
64
- {
65
- var currentToc = $(this);
66
- var url = window.location.href;
67
- currentToc.wrap("<a href='" + url + "#" + currentToc.attr("id") + "' </a>");
68
- });
69
- });
70
- */
71
- </script>
72
-