metanorma-acme 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +133 -29
- data/lib/asciidoctor/acme/converter.rb +5 -8
- data/lib/asciidoctor/acme/isostandard.rng +8 -0
- data/lib/isodoc/acme/html/html_acme_titlepage.html +1 -1
- data/lib/isodoc/acme/html/word_acme_titlepage.html +2 -2
- data/lib/isodoc/acme/metadata.rb +4 -0
- data/lib/metanorma/acme/version.rb +1 -1
- metadata +2 -3
- data/lib/asciidoctor/acme/pdf.js +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbac64a224ed9b71d32900fbbad69d7d4b8b2fd62cecd0415c3f7fdd4390dff5
|
4
|
+
data.tar.gz: 46e0fa032335f5b72b226a852664230ca17ae91bc72901bab36cc1dfb9311d32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '039a1899119e0fe18e72c41b74de185299df2650190832f0a093f4aafb2cf32b08c3ccc5d8370bc419d860f1d79fd05d6ea42cd0ead658019b182b40ccfd6eb2'
|
7
|
+
data.tar.gz: a0c67c605103c0d07f02093583781efad988c3213a2b4ca62011b2d0707e627f25125ecc83ea6b61a32b80171941457bbb4b269f0d820a715cb192e31c81d368
|
data/README.adoc
CHANGED
@@ -1,44 +1,148 @@
|
|
1
|
-
= metanorma-
|
1
|
+
= metanorma-ogc: Asciidoctor processor for Open Geospatial Consortium documents
|
2
2
|
|
3
|
-
image:https://img.shields.io/gem/v/metanorma-
|
4
|
-
image:https://img.shields.io/travis/riboseinc/metanorma-
|
5
|
-
image:https://codeclimate.com/github/riboseinc/metanorma-
|
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.
|
6
8
|
|
7
9
|
== Functionality
|
8
10
|
|
9
|
-
This
|
10
|
-
|
11
|
+
This gem processes http://asciidoctor.org/[Asciidoctor] documents following
|
12
|
+
a template for generating OGC documents.
|
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
|
11
31
|
|
12
|
-
|
13
|
-
following asciidoctor document variables to set the stylesheets that are passed as arguments to the `isodoc` gem:
|
32
|
+
The preferred way to invoke this gem is via the `metanorma` script:
|
14
33
|
|
15
|
-
[source,
|
34
|
+
[source,console]
|
16
35
|
----
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
:htmlstylesheet: (stylesheet for HTML)
|
21
|
-
:htmlcoverpage: (cover page for HTML)
|
22
|
-
:htmlintropage: (intro page for HTML)
|
23
|
-
:scripts: (scripts for HTML)
|
24
|
-
:wordstylesheet: (default stylesheet for Word)
|
25
|
-
:standardstylesheet: (standard-specific stylesheet for Word)
|
26
|
-
:header: (header/footer HTML for Word)
|
27
|
-
:wordcoverpage: (cover page for Word)
|
28
|
-
:wordintropage: (intro page for Word)
|
29
|
-
:ulstyle: (list style selector for unordered lists for Word)
|
30
|
-
:olstyle: (list style selector for ordered lists for Word)
|
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
|
31
39
|
----
|
32
40
|
|
33
|
-
|
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.
|
34
46
|
|
35
|
-
|
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]
|
36
52
|
----
|
37
|
-
|
53
|
+
$ asciidoctor -b ogc -r 'metanorma-ogc' a.adoc
|
38
54
|
----
|
39
55
|
|
40
|
-
|
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. These include:
|
102
|
+
|
103
|
+
`:edition:`:: The document edition
|
104
|
+
|
105
|
+
`:revdate:`:: The date the document was last updated
|
106
|
+
|
107
|
+
`:copyright-year:`:: The year which will be claimed as when the copyright for
|
108
|
+
the document was issued
|
109
|
+
|
110
|
+
`:title:`:: The main component of the English title of the document
|
111
|
+
(mandatory). (The first line of the AsciiDoc document, which contains the title
|
112
|
+
introduced with `=`, is ignored)
|
113
|
+
|
114
|
+
`:doctype:`:: The document type (mandatory). The permitted types are:
|
115
|
+
+
|
116
|
+
--
|
117
|
+
code:: Code Artifact
|
118
|
+
presentation:: Presentation
|
119
|
+
proposal:: Proposal; includes IETF DRAFT
|
120
|
+
standard:: Recommendation; includes IETF RFC
|
121
|
+
report:: report
|
122
|
+
--
|
123
|
+
|
124
|
+
`:status:``:: The document status. The permitted types are: `proposal`,
|
125
|
+
`working-draft`, `committee-draft`, `draft-standard`, `final-draft`,
|
126
|
+
`published`, `withdrawn`.
|
127
|
+
|
128
|
+
`:technical-committee:`:: The name of the relevant M3D technical committee
|
129
|
+
(mandatory)
|
130
|
+
|
131
|
+
`:language:` :: The language of the document (only `en` for now) (mandatory)
|
132
|
+
|
133
|
+
The attribute `:draft:`, if present, includes review notes in the XML output;
|
134
|
+
these are otherwise suppressed.
|
135
|
+
|
136
|
+
== Asciidoctor features specific to OGC
|
137
|
+
|
138
|
+
The https://github.com/riboseinc/metanorma-standoc[metanorma-standoc]
|
139
|
+
gem documents the customisations of Asciidoctor markup common to all metanorma gems.
|
140
|
+
The following markup is specific to this gem:
|
141
|
+
|
142
|
+
|
143
|
+
== Examples
|
41
144
|
|
42
|
-
|
145
|
+
* link:spec/examples/rfc6350.adoc[] is an Metanorma Asciidoctor version of https://tools.ietf.org/html/rfc6350[RFC 6350].
|
146
|
+
* link:spec/examples/rfc6350.html[] is an HTML file generated from the Asciidoctor.
|
147
|
+
* link:spec/examples/rfc6350.doc[] is a Word document generated from the Asciidoctor.
|
43
148
|
|
44
|
-
The use of HTML and CSS for Word is idiosyncratic, and involves some trial and error; consult the documentation above for more information.
|
@@ -104,13 +104,6 @@ module Asciidoctor
|
|
104
104
|
d
|
105
105
|
end
|
106
106
|
|
107
|
-
def pdf_convert(filename)
|
108
|
-
url = "#{Dir.pwd}/#{filename}.html"
|
109
|
-
pdfjs = File.join(File.dirname(__FILE__), 'pdf.js')
|
110
|
-
system "export NODE_PATH=$(npm root --quiet -g);
|
111
|
-
node #{pdfjs} file://#{url} #{filename}.pdf"
|
112
|
-
end
|
113
|
-
|
114
107
|
def document(node)
|
115
108
|
init(node)
|
116
109
|
ret1 = makexml(node)
|
@@ -121,7 +114,7 @@ module Asciidoctor
|
|
121
114
|
File.open(filename, "w") { |f| f.write(ret) }
|
122
115
|
html_converter(node).convert filename unless node.attr("nodoc")
|
123
116
|
word_converter(node).convert filename unless node.attr("nodoc")
|
124
|
-
|
117
|
+
pdf_converter(node).convert filename unless node.attr("nodoc")
|
125
118
|
end
|
126
119
|
@files_to_delete.each { |f| FileUtils.rm f }
|
127
120
|
ret
|
@@ -161,6 +154,10 @@ module Asciidoctor
|
|
161
154
|
IsoDoc::Acme::HtmlConvert.new(html_extract_attributes(node))
|
162
155
|
end
|
163
156
|
|
157
|
+
def pdf_converter(node)
|
158
|
+
IsoDoc::Acme::PdfConvert.new(html_extract_attributes(node))
|
159
|
+
end
|
160
|
+
|
164
161
|
def word_converter(node)
|
165
162
|
IsoDoc::Acme::WordConvert.new(doc_extract_attributes(node))
|
166
163
|
end
|
@@ -744,6 +744,9 @@
|
|
744
744
|
</define>
|
745
745
|
<define name="preface">
|
746
746
|
<element name="preface">
|
747
|
+
<optional>
|
748
|
+
<ref name="preface_abstract"/>
|
749
|
+
</optional>
|
747
750
|
<ref name="foreword"/>
|
748
751
|
<optional>
|
749
752
|
<ref name="introduction"/>
|
@@ -811,6 +814,11 @@
|
|
811
814
|
</optional>
|
812
815
|
</element>
|
813
816
|
</define>
|
817
|
+
<define name="preface_abstract">
|
818
|
+
<element name="abstract">
|
819
|
+
<ref name="Basic-Section"/>
|
820
|
+
</element>
|
821
|
+
</define>
|
814
822
|
<define name="foreword">
|
815
823
|
<element name="foreword">
|
816
824
|
<ref name="Basic-Section"/>
|
@@ -18,7 +18,7 @@ margin-left:4.25pt;margin-right:4.25pt'>
|
|
18
18
|
|
19
19
|
<p class="MsoNormal" align="center" style='text-align:center;border:none;
|
20
20
|
mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span
|
21
|
-
lang="EN-GB" style='font-size:16.0pt'>{{ status }} {{ doctype }}</span></p>
|
21
|
+
lang="EN-GB" style='font-size:16.0pt'>{% if unpublished %}{{ status }} {% endif %}{{ doctype }}</span></p>
|
22
22
|
|
23
23
|
{% if security %}
|
24
24
|
<p class="MsoNormal" align="center" style='text-align:center;border:none;
|
@@ -39,7 +39,7 @@ mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0
|
|
39
39
|
mso-border-alt:solid windowtext .5pt;padding:1.0pt 4.0pt 1.0pt 4.0pt;
|
40
40
|
margin-left:4.25pt;margin-right:4.25pt'>
|
41
41
|
|
42
|
-
{% if
|
42
|
+
{% if unpublished %}
|
43
43
|
<p class="MsoNormal" align="center" style='margin-bottom:6.0pt;text-align:center;
|
44
44
|
border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:
|
45
45
|
1.0pt 4.0pt 1.0pt 4.0pt'><b style='mso-bidi-font-weight:normal'><span
|
data/lib/isodoc/acme/metadata.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-acme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -278,7 +278,6 @@ files:
|
|
278
278
|
- lib/asciidoctor/acme/converter.rb
|
279
279
|
- lib/asciidoctor/acme/isodoc.rng
|
280
280
|
- lib/asciidoctor/acme/isostandard.rng
|
281
|
-
- lib/asciidoctor/acme/pdf.js
|
282
281
|
- lib/isodoc/acme.rb
|
283
282
|
- lib/isodoc/acme/html/acme.scss
|
284
283
|
- lib/isodoc/acme/html/header.html
|
data/lib/asciidoctor/acme/pdf.js
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
try {
|
4
|
-
require.resolve("puppeteer");
|
5
|
-
} catch(e) {
|
6
|
-
console.error("puppeteer Node library is not installed; will not generate PDF");
|
7
|
-
process.exit(e.code);
|
8
|
-
}
|
9
|
-
|
10
|
-
const puppeteer = require('puppeteer');
|
11
|
-
|
12
|
-
const createPdf = async() => {
|
13
|
-
let browser;
|
14
|
-
try {
|
15
|
-
browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});
|
16
|
-
const page = await browser.newPage();
|
17
|
-
await page.goto(process.argv[2], {waitUntil: 'networkidle2'});
|
18
|
-
await page.pdf({
|
19
|
-
path: process.argv[3],
|
20
|
-
format: 'A4'
|
21
|
-
});
|
22
|
-
} catch (err) {
|
23
|
-
console.log(err.message);
|
24
|
-
} finally {
|
25
|
-
if (browser) {
|
26
|
-
browser.close();
|
27
|
-
}
|
28
|
-
process.exit();
|
29
|
-
}
|
30
|
-
};
|
31
|
-
createPdf();
|