metanorma-ogc 0.0.2

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 +7 -0
  2. data/.gitignore +1 -0
  3. data/.hound.yml +3 -0
  4. data/.rubocop.yml +10 -0
  5. data/.travis.yml +16 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE +25 -0
  9. data/README.adoc +323 -0
  10. data/Rakefile +6 -0
  11. data/bin/console +14 -0
  12. data/bin/rspec +17 -0
  13. data/bin/setup +8 -0
  14. data/lib/asciidoctor/ogc.rb +7 -0
  15. data/lib/asciidoctor/ogc/biblio.rng +890 -0
  16. data/lib/asciidoctor/ogc/converter.rb +253 -0
  17. data/lib/asciidoctor/ogc/front.rb +163 -0
  18. data/lib/asciidoctor/ogc/isodoc.rng +1091 -0
  19. data/lib/asciidoctor/ogc/isostandard.rng +1068 -0
  20. data/lib/asciidoctor/ogc/ogc.rng +210 -0
  21. data/lib/isodoc/ogc.rb +10 -0
  22. data/lib/isodoc/ogc/html/header.html +181 -0
  23. data/lib/isodoc/ogc/html/html_ogc_intro.html +85 -0
  24. data/lib/isodoc/ogc/html/html_ogc_titlepage.html +172 -0
  25. data/lib/isodoc/ogc/html/htmlstyle.scss +1054 -0
  26. data/lib/isodoc/ogc/html/ogc.scss +644 -0
  27. data/lib/isodoc/ogc/html/scripts.html +82 -0
  28. data/lib/isodoc/ogc/html/scripts.pdf.html +70 -0
  29. data/lib/isodoc/ogc/html/word_ogc_intro.html +92 -0
  30. data/lib/isodoc/ogc/html/word_ogc_titlepage.html +194 -0
  31. data/lib/isodoc/ogc/html/wordstyle.scss +1104 -0
  32. data/lib/isodoc/ogc/html_convert.rb +355 -0
  33. data/lib/isodoc/ogc/i18n-en.yaml +1 -0
  34. data/lib/isodoc/ogc/metadata.rb +102 -0
  35. data/lib/isodoc/ogc/pdf_convert.rb +357 -0
  36. data/lib/isodoc/ogc/word_convert.rb +345 -0
  37. data/lib/metanorma-ogc.rb +8 -0
  38. data/lib/metanorma/ogc.rb +11 -0
  39. data/lib/metanorma/ogc/processor.rb +43 -0
  40. data/lib/metanorma/ogc/version.rb +5 -0
  41. data/metanorma-ogc.gemspec +45 -0
  42. metadata +338 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b4bc547f80aee864499bdc9d50864f3a11eb5bddae33a783dc170045a785bf22
4
+ data.tar.gz: 263220f48a361168f89d853975c96c9cec0c2f9c3044ae18ca9615bf74ba99d8
5
+ SHA512:
6
+ metadata.gz: 5ef6af5cbf07a656265054c8d50403b8e3a622c8a786f6b8ffa78aa73c990646369818dd3263374b2d18ef4f7fb257d412ba555ae8d4d88e38d322acf1feaa58
7
+ data.tar.gz: cb737469297eb470b92478bbbcb2a5be63164a892348435b212ca076d21f9ada68aa200a6c67eef7b70b4d3fc9e2f5abef49cd7fdff5a6d7d18cf8923a970ab2
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ .DS_Store
data/.hound.yml ADDED
@@ -0,0 +1,3 @@
1
+ ruby:
2
+ Enabled: true
3
+ config_file: .rubocop.yml
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ # This project follows the Ribose OSS style guide.
2
+ # https://github.com/riboseinc/oss-guides
3
+ # All project-specific additions and overrides should be specified in this file.
4
+
5
+ inherit_from:
6
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
+ AllCops:
8
+ TargetRubyVersion: 2.3
9
+ Rails:
10
+ Enabled: true
data/.travis.yml ADDED
@@ -0,0 +1,16 @@
1
+ dist: trusty
2
+ sudo: false
3
+ language: ruby
4
+ rvm:
5
+ - 2.5
6
+ - 2.4
7
+ - 2.3
8
+ - ruby-head
9
+ before_install:
10
+ - gem install bundler -v 1.16.1
11
+ - npm install -g puppeteer
12
+ - npm install
13
+ - unset _JAVA_OPTIONS
14
+ matrix:
15
+ allow_failures:
16
+ - rvm: ruby-head
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at ronald.tse@ribose.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) {|repo| "https://github.com/#{repo}" }
3
+
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2018, Ribose
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.adoc ADDED
@@ -0,0 +1,323 @@
1
+ = metanorma-ogc: Metanorma processor for the Open Geospatial Consortium document class
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.org/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 Metanorma documents into the OGC document class.
12
+
13
+ It provides the following functions:
14
+
15
+ . Compiles Metanorma input into the Metanorma-OGC XML format
16
+ . Validates XML output against the Metanorma-OGC document model
17
+ ** Errors are reported to console against the XML, and are intended for users to
18
+ check that they have provided all necessary components of the
19
+ document.
20
+ . Metanorma-OGC XML is then converted into desired output formats.
21
+
22
+ The following outputs are supported:
23
+
24
+ * Primary: the canonical Metanorma-OGC XML representation (`.xml`).
25
+ * Secondary: the Metanorma-OGC XML representation is processed to generate the following outputs
26
+ as end deliverable OGC documents.
27
+ ** HTML (`.html`)
28
+ ** PDF (`.pdf`)
29
+ ** Word (`.doc`)
30
+
31
+ == Structure
32
+
33
+ This gem inherits from the https://github.com/riboseinc/metanorma-standoc
34
+ gem, and aligns closely to it.
35
+
36
+
37
+ === Quickstart
38
+
39
+ Please see https://www.metanorma.com for instructions to get started.
40
+
41
+ If you are using a Mac, the https://github.com/riboseinc/metanorma-macos-setup
42
+ repository has instructions on setting up your machine to run Metanorma
43
+ scripts such as this one. You need only run the following in a Terminal console:
44
+
45
+ [source,console]
46
+ ----
47
+ $ bash <(curl -s https://raw.githubusercontent.com/riboseinc/metanorma-macos-setup/master/metanorma-setup)
48
+ $ gem install metanorma-cli
49
+ $ gem install metanorma-ogc
50
+ ----
51
+
52
+
53
+ == Usage
54
+
55
+ Using the `metanorma` CLI:
56
+
57
+ [source,console]
58
+ ----
59
+ $ metanorma --type ogc a.adoc # output HTML
60
+ $ metanorma --type ogc --extensions html a.adoc # output just HTML
61
+ $ metanorma --type ogc --extensions xml a.adoc # output Metanorma XML
62
+ ----
63
+
64
+
65
+ == Authoring
66
+
67
+ Please refer to the Metanorma-ISO documentation for general documentation.
68
+
69
+ * Metanorma-ISO general documentation: https://www.metanorma.com/software/metanorma-iso/
70
+
71
+ * Metanorma-ISO guidance: https://www.metanorma.com/software/metanorma-iso/docs/guidance/
72
+
73
+
74
+ ////
75
+ ** http://asciimath.org[AsciiMathML] is used for mathematical formatting.
76
+ The gem uses the https://github.com/asciidoctor/asciimath[Ruby AsciiMath parser],
77
+ which is syntactically stricter than the common MathJax processor;
78
+ if you do not get expected results, try bracketing terms your in AsciiMathML
79
+ expressions.
80
+ ////
81
+
82
+
83
+ == Approach
84
+
85
+ === Document model
86
+
87
+ The OGC document model is detailed here:
88
+
89
+ * https://github.com/riboseinc/metanorma-model-ogc[OGC document model]
90
+
91
+ It is an instance of the
92
+ https://github.com/riboseinc/metanorma-model-standoc[StandardDocument model].
93
+
94
+
95
+ === Document input
96
+
97
+ Document input to Metanorma is for the compilation of content into the
98
+ Metanorma XML document.
99
+
100
+ The Metanorma-OGC processor supports AsciiDoc input.
101
+
102
+ AsciiDoc is selected has been selected as the authoring tool to generate the document
103
+ model representation of OGC standards.
104
+
105
+ Similar to Markdown, AsciiDoc is a lightweight markup format, but
106
+ combines the rigor and expressivity of DocBook.
107
+ A number of editors (through plugins) support preview of AsciiDoc files,
108
+ so textual content can be previewed without running the Metanorma toolchain.
109
+
110
+ The Metanorma processor automates numbering of headings, figures,
111
+ tables etc, automatically generates references and citations,
112
+ and the resulting output presentations.
113
+
114
+ NOTE: The Asciidoctor gem is used for AsciiDoc input parsing.
115
+
116
+
117
+ == Document attributes
118
+
119
+ === Common attributes
120
+
121
+ Metadata of the document is provided through AsciiDoc document attributes.
122
+
123
+ https://github.com/riboseinc/metanorma-standoc[Metanorma-Standoc]
124
+ documents all common Metanorma document attributes.
125
+ Where these preexisting metanorma attributes correspond to attributes already used
126
+ by OGC in their Asciidoctor template, they are treated as synonyms of the Metanorma
127
+ attributes. The attributes relevant to OGC documents include:
128
+
129
+ `:edition:`:: The document version; e.g. `2.0`.
130
+
131
+ `:revdate:`:: The date the document was last updated.
132
+
133
+ `:copyright-year:` (OGC: `:copyrightYear`):: The year which will be claimed as when the copyright for
134
+ the document was issued.
135
+
136
+ `:title:`:: The main component of the English title of the document
137
+ (mandatory). (The first line of the AsciiDoc document, which contains the title
138
+ introduced with `=`, is ignored)
139
+
140
+ `:doctype:`:: The document type (mandatory). The permitted types are:
141
+ +
142
+ --
143
+ * Standards
144
+ `standard`::: Implementation Standard
145
+ `standard-with-suite`::: Implementation Standard with Compliance Suite
146
+ `abstract-specification`::: Abstract Specification
147
+ `community-standard`::: Community Standard
148
+ `profile`::: Profile / Application Profile
149
+ `best-practice`::: Best Practices Document
150
+
151
+ * Other
152
+ `engineering-report`::: Engineering Report
153
+ `discussion-paper`::: Discussion Paper
154
+ `reference-model`::: OGC Reference Model
155
+ `user-guide`::: User Guide
156
+ `policy`::: OGC Policy Document
157
+ `guide`::: Guide
158
+ `amendment`::: Technical Amendment
159
+ `technical-corrigendum`::: Corrigendum (errata) Changes to OGC Standards
160
+ `administrative`::: Internal administrative documents
161
+ --
162
+
163
+ `:status:`:: Document status/stage. The permitted types are:
164
+ +
165
+ `rfc`::: OGC RFC (proposal)
166
+ `candidate`::: Candidate Standard
167
+ `published`::: Published
168
+ `deprecated`::: Deprecated
169
+ `retired`::: Retired
170
+
171
+ `:committee:`:: The name of the relevant committee producing the document (mandatory). The legal values are:
172
+ `technical`, `planning`, `strategic-member-advisory`
173
+ `:subcommittee:`:: The name of the relevant subcommittee producing the document
174
+ `:workgroup:` (OGC: `:workingGroup:`):: The name of the relevant working group producing the document (mandatory)
175
+
176
+ `:language:`:: The language of the document (e.g. `en`) (mandatory)
177
+
178
+ `:published-date:` (OGC: `:publicationDate:`):: The publication date for the document.
179
+ `:issued-date:` (OGC: `:approvalDate:`):: The approval date for the document.
180
+ `:created-date:`:: The creation date for the document.
181
+ `:received-date:` (OGC: `:submissionDate:`):: The date at which the document was submitted to the standards body.
182
+
183
+ `:uri:`:: The URI to which this standard is published.
184
+ `:xml-uri:`:: The URI for the Metanorma XML as which this standard is published.
185
+ `:pdf-uri:`:: The URI for the PDF as which this standard is published.
186
+ `:doc-uri:`:: The URI for the DOC as which this standard is published.
187
+ `:docnumber:` (OGC: `docReference`):: The internal identifier referring to this document.
188
+
189
+ `:draft:`:: If present, review notes are included in the
190
+ Metanorma XML output; otherwise they are suppressed.
191
+
192
+
193
+ === OGC-specific attributes
194
+
195
+ The following document attributes are specific to this document class:
196
+
197
+ `:external-id:`:: The external identifier referring to this document.
198
+ `:referenceURLID:`:: The identifier embedded into a document type-specific
199
+ external URL.
200
+ `:previous-uri:`:: URI of previous version of the document.
201
+ `:subcommittee-type:`:: The type of the relevant subcommittee producing the document
202
+ `:subcommittee-number:`:: The number of the relevant subcommittee producing the document
203
+ `:workgroup-type:`:: The type of the relevant workgroup producing the document
204
+ `:workgroup-number:`:: The number of the relevant workgroup producing the document
205
+
206
+ `:keywords:`:: Comma-delimited list of the keywords associated with the document.
207
+ `:submitting-organizations:`:: Semicolon-delimited list of the submitting organisations
208
+ for this document. (The organisation names themselves may contain commas; e.g.
209
+ `University of Calgary, Canada; National Central University, Taiwan`.
210
+
211
+ `:fullname{_i}:`:: The full name of a person who is a contributor to the document.
212
+ A second person is indicated by using a numeric suffix: `:fullname:`, `:fullname_2:`, `fullname_3:`, &c.
213
+
214
+ `:surname{_i}:`:: The surname of a person who is a contributor to the document.
215
+ `:givenname{_i}:`:: The given name(s) of a person who is a contributor to the document.
216
+ `:role{_i}:`:: The role of a a person who is a contributor to the document. By default,
217
+ they are coded as an `editor`; they can also be represented as an `author`.
218
+
219
+ OGC `:editor:`:: corresponds to `:fullname:` with `role` = "editor"
220
+
221
+ == Asciidoctor features specific to OGC
222
+
223
+ The https://github.com/riboseinc/metanorma-standoc[metanorma-standoc]
224
+ gem documents the customisations of Asciidoctor markup common to all metanorma gems.
225
+ The following markup is specific to this gem:
226
+
227
+ === Section names
228
+
229
+ The Normative References section may be named just "References", reflecting OGC practice.
230
+
231
+ === Preliminary elements
232
+
233
+ The following clauses are preliminary elements, and are moved into the frontispiece
234
+ of the document (in Metanorma, the document preface):
235
+
236
+ * Abstract
237
+ * Keywords
238
+ * Preface
239
+ * Submitting Organizations
240
+ * Submitters
241
+
242
+ The abstract is recognised as the first clause with an `abstract` style attribute:
243
+
244
+ [source,asciidoc]
245
+ ----
246
+ [abstract]
247
+ == Abstract
248
+
249
+ xxx
250
+ ----
251
+
252
+ The preface is recognised as the text between the Asciidoctor document attributes and
253
+ the first Asciidoctor section title; it must not be given a section title of its own.
254
+
255
+ [source,asciidoc]
256
+ ----
257
+ :received-date: 2019-01-01
258
+
259
+ .Preface
260
+
261
+ preface text
262
+
263
+ === Submitters
264
+ ----
265
+
266
+ Keywords and Submitting Organizations consist of lists. They are treated as document metadata,
267
+ and are entered as a document attribute.
268
+ The prefatory text introducing them is added automatically.
269
+
270
+ Submitters are treated as a table, contained in a section with the title `Submitters`:
271
+
272
+ [source,asciidoc]
273
+ ----
274
+ === Submitters
275
+
276
+ |===
277
+ |Name |Representing |OGC member
278
+
279
+ |Steve Liang | University of Calgary, Canada / SensorUp Inc. | Yes
280
+ |===
281
+ ----
282
+
283
+ === Examples
284
+
285
+ Unlike the normal case in Metanorma, examples can have captions:
286
+
287
+ [source,asciidoc]
288
+ ----
289
+ [example]
290
+ .Example caption
291
+ ====
292
+ Text
293
+ ====
294
+ ----
295
+
296
+ === Recommendations, requirements, and permissions
297
+
298
+ Distinct recommendations, requirements and permissions are recognised in Metanorma
299
+ Asciidoctor as tables whose first cell contains the text _Recommendation_, _Requirement_, _Permission_,
300
+ optionally followed by a number (which is ignored in parsing; the elements are renumberd
301
+ automatically in rendering.) These are currently constituted of two elements: an internal
302
+ label, which is parsed as the first paragraph of the second table cell, and the body of
303
+ the recommendation etc., which is parsed as the remainder of the second table cell.
304
+
305
+ [source,asciidoc]
306
+ ----
307
+ [[recommendation1]]
308
+ |===
309
+ |Recommendation |/ogc/recommendation/wfs/2 +
310
+
311
+ If the API definition document uses the OpenAPI Specification 3.0,
312
+ the document SHOULD conform to the
313
+ <<rc_oas30,OpenAPI Specification 3.0 requirements class>>.
314
+ |===
315
+ ----
316
+
317
+
318
+ == Examples
319
+
320
+ * link:spec/examples/rfc6350.adoc[] is an Metanorma AsciiDoc version of https://tools.ietf.org/html/rfc6350[RFC 6350].
321
+ * link:spec/examples/rfc6350.html[] is an HTML file generated from the Asciidoctor.
322
+ * link:spec/examples/rfc6350.doc[] is a Word document generated from the Asciidoctor.
323
+