metanorma-ogc 1.5.1 → 1.5.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/lib/asciidoctor/ogc/boilerplate.xml +3 -3
  4. data/lib/asciidoctor/ogc/cleanup.rb +9 -0
  5. data/lib/asciidoctor/ogc/converter.rb +5 -3
  6. data/lib/asciidoctor/ogc/isodoc.rng +56 -17
  7. data/lib/asciidoctor/ogc/validate.rb +12 -0
  8. data/lib/isodoc/ogc/base_convert.rb +2 -1
  9. data/lib/isodoc/ogc/html/htmlstyle.css +6 -2
  10. data/lib/isodoc/ogc/html/htmlstyle.scss +6 -1
  11. data/lib/isodoc/ogc/html/ogc.css +0 -1
  12. data/lib/isodoc/ogc/html/ogc.scss +0 -1
  13. data/lib/isodoc/ogc/html/ogc_wp.css +0 -1
  14. data/lib/isodoc/ogc/html/ogc_wp.scss +0 -1
  15. data/lib/isodoc/ogc/html/scripts.html +0 -1
  16. data/lib/isodoc/ogc/html_convert.rb +1 -0
  17. data/lib/isodoc/ogc/i18n-en.yaml +10 -12
  18. data/lib/isodoc/ogc/metadata.rb +6 -2
  19. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +407 -117
  20. data/lib/isodoc/ogc/ogc.best-practice.xsl +407 -117
  21. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +407 -117
  22. data/lib/isodoc/ogc/ogc.community-practice.xsl +407 -117
  23. data/lib/isodoc/ogc/ogc.community-standard.xsl +407 -117
  24. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +407 -117
  25. data/lib/isodoc/ogc/ogc.engineering-report.xsl +407 -117
  26. data/lib/isodoc/ogc/ogc.other.xsl +407 -117
  27. data/lib/isodoc/ogc/ogc.policy.xsl +407 -117
  28. data/lib/isodoc/ogc/ogc.reference-model.xsl +407 -117
  29. data/lib/isodoc/ogc/ogc.release-notes.xsl +407 -117
  30. data/lib/isodoc/ogc/ogc.standard.xsl +407 -117
  31. data/lib/isodoc/ogc/ogc.test-suite.xsl +407 -117
  32. data/lib/isodoc/ogc/ogc.user-guide.xsl +407 -117
  33. data/lib/isodoc/ogc/ogc.white-paper.xsl +284 -94
  34. data/lib/isodoc/ogc/presentation_xml_convert.rb +39 -2
  35. data/lib/isodoc/ogc/reqt.rb +1 -1
  36. data/lib/isodoc/ogc/sections.rb +9 -2
  37. data/lib/isodoc/ogc/word_convert.rb +28 -4
  38. data/lib/isodoc/ogc/xref.rb +4 -2
  39. data/lib/metanorma/ogc/version.rb +1 -1
  40. data/metanorma-ogc.gemspec +1 -1
  41. metadata +8 -9
  42. data/README.adoc.old +0 -187
@@ -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
@@ -20,7 +20,13 @@ module IsoDoc
20
20
  end
21
21
 
22
22
  def security(docxml, out)
23
- f = docxml.at(ns("//preface/clause[@type = 'security']")) || return
23
+ f = docxml.at(ns("//preface/clause[@type = 'security']")) or return
24
+ intro_clause(f, out)
25
+ end
26
+
27
+ def executivesummary(docxml, out)
28
+ f = docxml.at(ns("//preface/clause[@type = 'executivesummary']")) or
29
+ return
24
30
  intro_clause(f, out)
25
31
  end
26
32
 
@@ -31,7 +37,8 @@ module IsoDoc
31
37
 
32
38
  def preface(isoxml, out)
33
39
  isoxml.xpath(ns("//preface/clause[not(@type = 'keywords' or "\
34
- "@type = 'submitting_orgs' or @type = 'security')]"))
40
+ "@type = 'submitting_orgs' or @type = 'security' or "\
41
+ "@type = 'executivesummary')]"))
35
42
  .each do |f|
36
43
  intro_clause(f, out)
37
44
  end
@@ -86,7 +86,7 @@ module IsoDoc
86
86
  <span lang="EN-GB"><span
87
87
  style='mso-element:field-begin'></span><span
88
88
  style='mso-spacerun:yes'>&#xA0;</span>TOC
89
- \\h \\z \\t &quot;RecommendationTitle,recommendationtitle&quot;#{' '}
89
+ \\h \\z \\t &quot;RecommendationTitle,RecommendationTestTitle,recommendationtitle,recommendationtesttitle&quot;#{' '}
90
90
  <span style='mso-element:field-separator'></span></span>
91
91
  TOC
92
92
 
@@ -131,13 +131,37 @@ module IsoDoc
131
131
 
132
132
  def make_RecommendationWordToC(docxml)
133
133
  toc = ""
134
- docxml.xpath("//p[@class = 'RecommendationTitle']").each do |h|
134
+ docxml.xpath("//p[@class = 'RecommendationTitle' or @class = 'RecommendationTestTitle']").sort_by do |h|
135
+ recommmendation_sort_key(h.text)
136
+ end.each do |h|
135
137
  toc += word_toc_entry(1, header_strip(h))
136
138
  end
137
139
  toc.sub(/(<p class="MsoToc1">)/,
138
140
  %{\\1#{WORD_TOC_RECOMMENDATION_PREFACE1}}) + WORD_TOC_SUFFIX1
139
141
  end
140
142
 
143
+ def recommmendation_sort_key(header)
144
+ m = /^([^0-9]+) (\d+)/.match(header) || /^([^:]+)/.match(header)
145
+ "#{recommmendation_sort_key1(m[1])}::#{'%04d' % m[2].to_i}"
146
+ end
147
+
148
+ def recommmendation_sort_key1(type)
149
+ case type.downcase
150
+ when "requirements class" then "01"
151
+ when "recommendations class" then "02"
152
+ when "permissions class" then "03"
153
+ when "requirement" then "04"
154
+ when "recommendation" then "05"
155
+ when "permission" then "06"
156
+ when "conformance class" then "07"
157
+ when "abstract test" then "08"
158
+ when "requirements test" then "09"
159
+ when "recommendations test" then "10"
160
+ when "permissions test" then "11"
161
+ else "z"
162
+ end
163
+ end
164
+
141
165
  def make_body2(body, docxml)
142
166
  body.div **{ class: "WordSection2" } do |div2|
143
167
  @prefacenum = 0
@@ -145,6 +169,7 @@ module IsoDoc
145
169
  boilerplate docxml, div2
146
170
  preface_block docxml, div2
147
171
  abstract docxml, div2
172
+ executivesummary docxml, div2
148
173
  keywords docxml, div2
149
174
  foreword docxml, div2
150
175
  introduction docxml, div2
@@ -211,8 +236,7 @@ module IsoDoc
211
236
  @wordstylesheet = wordstylesheet_update
212
237
  Html2Doc.process(
213
238
  result,
214
- filename: filename,
215
- imagedir: @localdir,
239
+ filename: filename, imagedir: @localdir,
216
240
  stylesheet: @wordstylesheet&.path,
217
241
  header_file: header&.path, dir: dir,
218
242
  asciimathdelims: [@openmathdelim, @closemathdelim],
@@ -141,14 +141,16 @@ module IsoDoc
141
141
 
142
142
  def preface_anchor_names(doc)
143
143
  @prefacenum = 0
144
- ["//preface/abstract", "//preface/clause[@type = 'keywords']",
144
+ ["//preface/abstract", "//preface/clause[@type = 'executivesummary']",
145
+ "//preface/clause[@type = 'keywords']",
145
146
  "//foreword", "//introduction", "//preface/clause[@type = 'security']",
146
147
  "//preface/clause[@type = 'submitting_orgs']",
147
148
  "//submitters"].each do |path|
148
149
  preface_names_numbered(doc.at(ns(path)))
149
150
  end
150
151
  doc.xpath(ns("//preface/clause[not(@type = 'keywords' or "\
151
- "@type = 'submitting_orgs' or @type = 'security')]"))
152
+ "@type = 'submitting_orgs' or @type = 'security' or "\
153
+ "@type = 'executivesummary')]"))
152
154
  .each { |c| preface_names_numbered(c) }
153
155
  preface_names_numbered(doc.at(ns("//acknowledgements")))
154
156
  sequential_asset_names(
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "1.5.1".freeze
3
+ VERSION = "1.5.4.1".freeze
4
4
  end
5
5
  end
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency "iso-639"
28
28
  spec.add_dependency "metanorma-standoc", "~> 1.11.0"
29
29
 
30
- spec.add_development_dependency "byebug", "~> 9.1"
30
+ spec.add_development_dependency "debug"
31
31
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
32
32
  spec.add_development_dependency "guard", "~> 2.14"
33
33
  spec.add_development_dependency "guard-rspec", "~> 4.7"
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.1
4
+ version: 1.5.4.1
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-04 00:00:00.000000000 Z
11
+ date: 2021-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.11.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: byebug
42
+ name: debug
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '9.1'
47
+ version: '0'
48
48
  type: :development
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: '9.1'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: equivalent-xml
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -195,7 +195,6 @@ files:
195
195
  - Gemfile
196
196
  - LICENSE
197
197
  - README.adoc
198
- - README.adoc.old
199
198
  - Rakefile
200
199
  - bin/console
201
200
  - bin/rspec
@@ -287,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
286
  - !ruby/object:Gem::Version
288
287
  version: '0'
289
288
  requirements: []
290
- rubygems_version: 3.2.22
289
+ rubygems_version: 3.2.32
291
290
  signing_key:
292
291
  specification_version: 4
293
292
  summary: Metanorma for the Open Geospatial Consortium.
data/README.adoc.old DELETED
@@ -1,187 +0,0 @@
1
- = metanorma-ogc: Asciidoctor processor for Open Geospatial Consortium documents
2
-
3
- image:https://img.shields.io/gem/v/metanorma-ogc.svg["Gem Version", link="https://rubygems.org/gems/metanorma-ogc"]
4
- image:https://img.shields.io/travis/riboseinc/metanorma-ogc/master.svg["Build Status", link="https://travis-ci.com/riboseinc/metanorma-ogc"]
5
- image:https://codeclimate.com/github/riboseinc/metanorma-ogc/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/riboseinc/metanorma-ogc"]
6
-
7
- WARNING: This gem is still under development.
8
-
9
- == Functionality
10
-
11
- This gem processes documents following a template for generating OGC documents.
12
- For http://asciidoctor.org/[Asciidoctor] input, the Metanorma toolchain uses the Asciidoctor gem as its parser.
13
-
14
- The gem currently inherits from the https://github.com/riboseinc/metanorma-standoc
15
- gem, and aligns closely to it. Refer to the ISO gem documentation
16
- for guidance, including https://github.com/riboseinc/metanorma-iso/wiki/Guidance-for-authoring
17
-
18
- The following outputs are generated.
19
-
20
- * an XML representation of the document, intended as a document model for OGC documents.
21
- * The XML representation is processed in turn to generate the following outputs
22
- as end deliverable OGC documents.
23
- ** HTML
24
- ** http://asciimath.org[AsciiMathML] is to be used for mathematical formatting.
25
- The gem uses the https://github.com/asciidoctor/asciimath[Ruby AsciiMath parser],
26
- which is syntactically stricter than the common MathJax processor;
27
- if you do not get expected results, try bracketing terms your in AsciiMathML
28
- expressions.
29
-
30
- == Usage
31
-
32
- The preferred way to invoke this gem is via the `metanorma` script:
33
-
34
- [source,console]
35
- ----
36
- $ metanorma --type ogc a.adoc # output HTML
37
- $ metanorma --type ogc --extensions html a.adoc # output just HTML
38
- $ metanorma --type ogc --extensions xml a.adoc # output RSD XML
39
- ----
40
-
41
- The gem translates the document into Metanorma XML format, and then
42
- validates its output against the Metanorma XML document model; errors are
43
- reported to console against the XML, and are intended for users to
44
- check that they have provided all necessary components of the
45
- document.
46
-
47
- The gem then converts the XML into HTML.
48
-
49
- The gem can also be invoked directly within asciidoctor, though this is deprecated:
50
-
51
- [source,console]
52
- ----
53
- $ asciidoctor -b ogc -r 'metanorma-ogc' a.adoc
54
- ----
55
-
56
- === Installation
57
-
58
- If you are using a Mac, the https://github.com/riboseinc/metanorma-macos-setup
59
- repository has instructions on setting up your machine to run Metanorma
60
- scripts such as this one. You need only run the following in a Terminal console:
61
-
62
- [source,console]
63
- ----
64
- $ bash <(curl -s https://raw.githubusercontent.com/riboseinc/metanorma-macos-setup/master/metanorma-setup)
65
- $ gem install metanorma-ogc
66
- $ gem install metanorma-cli
67
- ----
68
-
69
- == Approach
70
-
71
- === Document model
72
-
73
- The OGC Document model used by this gem is an instance of the
74
- https://github.com/riboseinc/isodoc-models[StandardDocument model].
75
-
76
- The Metanorma XML format intends to introduce rigor into the OGC
77
- standards authoring process, and is prescribed in a separate document.
78
-
79
- === Asciidoctor
80
-
81
- Asciidoctor has been selected as the authoring tool to generate the document
82
- model representation of OGC standards. It is a document formatting tool like
83
- Markdown and DocBook, which combines the relative ease of use of the former
84
- (using relatively lightweight markup), and the rigor and expressively of the
85
- latter (it has a well-defined syntax, and was in fact initially developed as a
86
- DocBook document authoring tool). Asciidoctor has built-in capability to output
87
- Text, DocBook and HTML; so it can be used to preview the file as it is being
88
- autA
89
-
90
- Generating documents via a document model substantially automated formatting
91
- associated with the document, including automating numbering of headings, figures,
92
- tables etc, and automatically generating references and citations.
93
- hored.
94
-
95
- == Document Attributes
96
-
97
- === Common attributes
98
-
99
- The gem relies on Asciidoctor document attributes to provide necessary
100
- metadata about the document. The https://github.com/riboseinc/metanorma-standoc[metanorma-standoc]
101
- gem documents the Asciidoctor document attributes common to all metanorma gems.
102
- Where these preexisting metanorma attributes correspond to attributes already used
103
- by OGC in their Asciidoctor template, they are treated as synonyms of the Metanorma
104
- attributes. These include:
105
-
106
- `:edition:`:: The document version; e.g. `2.0`.
107
-
108
- `:revdate:`:: The date the document was last updated
109
-
110
- `:copyright-year:`:: The year which will be claimed as when the copyright for
111
- the document was issued
112
-
113
- `:title:`:: The main component of the English title of the document
114
- (mandatory). (The first line of the AsciiDoc document, which contains the title
115
- introduced with `=`, is ignored)
116
-
117
- `:doctype:`:: The document type (mandatory). The permitted types are:
118
- +
119
- --
120
- * Standards
121
- implementation-standard::: Implementation Standard (with or without Compliance Suite)
122
- abstract-specification::: Abstract Specification (with or without Compliance Suite)
123
- community-standard::: Community Standard (with or without Compliance Suite)
124
- profile::: Profile (with or without Compliance Suite)
125
- best-practices::: Best Practices Document
126
- * Other
127
- engineering-report::: Engineering Report
128
- discussion-paper::: Discussion Paper
129
- white-paper::: White Paper
130
- user-guide::: User Guide
131
- policy-directive::: Technical Committee Policy Directive
132
- informative::: Informative
133
- --
134
-
135
- `:status:``:: The document status. The permitted types are:
136
-
137
- * SWG Work
138
- * OAB Review
139
- * OGC-NA Review
140
- * Public Review
141
- * Prepare for Approval
142
- * TC Approval to Vote
143
- * TC Vote
144
- * PC Vote
145
- * Published
146
-
147
- `:committee:` (OGC: `:workingGroup:`):: The name of the relevant committee (mandatory)
148
-
149
- `:language:` :: The language of the document (only `en` for now) (mandatory)
150
-
151
- `:published-date` (OGC: `:publicationDate:`):: The publication date for the document.
152
- `:issued-date` (OGC: `:approvalDate:`):: The approval date for the document.
153
- `:created-date`:: The creation date for the document.
154
- `:submitted-date` (OGC: `:submissionDate:`):: The date at which the document was submitted to the standards body.
155
-
156
- `:uri:`:: The URI to which this standard is published.
157
- `:docnumber:` (OGC: `docReference`):: The internal identifier referring to this document.
158
-
159
- The attribute `:draft:`, if present, includes review notes in the XML output;
160
- these are otherwise suppressed.
161
-
162
- == Asciidoctor features specific to OGC
163
-
164
- The https://github.com/riboseinc/metanorma-standoc[metanorma-standoc]
165
- gem documents the customisations of Asciidoctor markup common to all metanorma gems.
166
- The following markup is specific to this gem:
167
-
168
- `:external-id:`:: The external identifier referring to this document.
169
- `:referenceURLID:`:: The identifier embedded into a document type-specific
170
- external URL.
171
-
172
- `:fullname{_i}`:: The full name of a person who is a contributor to the document.
173
- A second person is indicated by using a numeric suffix: `:fullname`, `:fullname_2`, `fullname_3`, &c.
174
-
175
- `:surname{_i}`:: The surname of a person who is a contributor to the document.
176
- `:givenname{_i}`:: The given name(s) of a person who is a contributor to the document.
177
- `:role{_i}`:: The role of a a person who is a contributor to the document. By default,
178
- they are coded as an `editor`; they can also be represented as an `author`.
179
-
180
- OGC `:editor:`:: corresponds to `:fullname:` with `role` = "editor"
181
-
182
- == Examples
183
-
184
- * link:spec/examples/rfc6350.adoc[] is an Metanorma Asciidoctor version of https://tools.ietf.org/html/rfc6350[RFC 6350].
185
- * link:spec/examples/rfc6350.html[] is an HTML file generated from the Asciidoctor.
186
- * link:spec/examples/rfc6350.doc[] is a Word document generated from the Asciidoctor.
187
-