metanorma 1.5.9 → 1.5.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +5 -214
- data/lib/metanorma/collection_fileparse.rb +1 -1
- data/lib/metanorma/input/asciidoc.rb +1 -2
- data/lib/metanorma/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92a5d64c829606a032547fcdff9d91c0da5961e245174e23d986d1e4d7b66829
|
4
|
+
data.tar.gz: 439aed18b6d51d07e96d929cfa3794374ce0002209ef9f0a7556c6e4393dd433
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b480de019e1ff4356f103cb6ac76f3f185a497901aa5b6a71701c99ae76f598c39bbfba04d9d9c42327ab3433536fa9b3913727d8060073718fb11b9fbc5747
|
7
|
+
data.tar.gz: 6265a0c25f8d727d9489a8a9d7bdadda0c265f724679dbc41ac3d2bd739bd89474b14bd3f32056d7cc4eb3e1f47c89a4352d906bd740a4a787b70377d0de0dfd
|
data/README.adoc
CHANGED
@@ -19,235 +19,26 @@ Metanorma is composed of a number of specifications and software
|
|
19
19
|
implementations. The Metanorma document model is based on the SecureDoc
|
20
20
|
document model.
|
21
21
|
|
22
|
-
Metanorma
|
23
|
-
|
24
|
-
* The https://github.com/metanorma/metanorma-model-standoc[Metanorma Standard Document model]
|
25
|
-
|
26
|
-
* IETF Internet-Drafts and RFCs: the https://datatracker.ietf.org/doc/draft-ribose-asciirfc/[AsciiRFC syntax],
|
27
|
-
the https://github.com/metanorma/asciidoctor-rfc/[asciidoctor-rfc RFC XML v2 and v3 implementations]
|
28
|
-
|
29
|
-
* ISO Standards: the AsciiISO syntax,
|
30
|
-
the https://github.com/metanorma/metanorma-model-iso/[Metanorma ISO model],
|
31
|
-
the https://github.com/metanorma/metanorma-iso/[metanorma-iso IsoDoc implementation]
|
32
|
-
|
33
|
-
* CalConnect Standard Documents (CSD): the AsciiCSD syntax,
|
34
|
-
https://github.com/metanorma/metanorma-model-csd[Metanorma CSD model],
|
35
|
-
the https://github.com/metanorma/metanorma-csd/[metanorma-csd implementation]
|
36
|
-
|
37
|
-
* Chinese GuoBiao (GB) Standards: the AsciiGB syntax,
|
38
|
-
https://github.com/metanorma/metanorma-model-gb[Metanorma GB models, for Chinese standards],
|
39
|
-
the https://github.com/metanorma/metanorma-gb/[metanorma-gb implementation]
|
40
|
-
|
41
|
-
* Cloud Security Alliance Normal Documents (CSAND): the AsciiCSAND syntax,
|
42
|
-
https://github.com/metanorma/metanorma-model-csand[Metanorma CSAND model],
|
43
|
-
the https://github.com/metanorma/metanorma-csand/[metanorma-csand implementation]
|
44
|
-
|
45
|
-
* M3AAWG Documents (M3D): the AsciiM3D syntax,
|
46
|
-
https://github.com/metanorma/metanorma-model-m3d[Metanorma M3D model],
|
47
|
-
the https://github.com/metanorma/metanorma-m3d/[metanorma-m3d implementation]
|
48
|
-
|
49
|
-
* Ribose Specification Documents (RSD): AsciiRSD, RSD XML schema, and the https://github.com/metanorma/metanorma-rsd[metanorma-rsd implementation]
|
50
|
-
|
51
|
-
* Mandatory Provident Fund Schemes Authority of Hong Kong Documents (MPFD): https://github.com/metanorma/metanorma-mpfd[metanorma-mpfd implementation] (still at proof-of-concept stage)
|
52
|
-
|
53
|
-
* United Nations Economic Commision for Europe Documents (UNECE): https://github.com/metanorma/metanorma-unece[metanorma-unece implementation]
|
54
|
-
|
22
|
+
For more on Metanorma and who uses it, refer to https://www.metanorma.org[]
|
55
23
|
|
56
24
|
== Installation on supported platforms
|
57
25
|
|
58
|
-
|
59
|
-
|
60
|
-
We recommend macOS users to directly run the Metanorma setup script
|
61
|
-
located here:
|
62
|
-
https://github.com/metanorma/metanorma-macos-setup
|
63
|
-
|
64
|
-
This is a one-stop installation script that setups Ruby, Node
|
65
|
-
and all necessary parts for running Metanorma.
|
66
|
-
|
67
|
-
Alternatively, you can also use the Metanorma Docker container (see below).
|
68
|
-
|
69
|
-
=== Linux
|
70
|
-
|
71
|
-
Please see: https://github.com/metanorma/metanorma-linux-setup
|
72
|
-
|
73
|
-
Alternatively, you can also use the Metanorma Docker container (see below).
|
74
|
-
|
75
|
-
=== Docker: Windows and other platforms
|
76
|
-
|
77
|
-
Please use the Metanorma Docker container: https://github.com/metanorma/metanorma-docker
|
78
|
-
|
79
|
-
|
80
|
-
////
|
81
|
-
If you want to run Ubuntu on MacOS, you should do the following beforehand:
|
82
|
-
|
83
|
-
[source,sh]
|
84
|
-
----
|
85
|
-
# Setup docker through dinghy on MacOS:
|
86
|
-
brew tap codekitchen/dinghy
|
87
|
-
brew install dinghy
|
88
|
-
brew install docker docker-machine
|
89
|
-
dinghy create --provider virtualbox
|
90
|
-
|
91
|
-
# Run the Ubuntu container:
|
92
|
-
dinghy up
|
93
|
-
eval $(dinghy env)
|
94
|
-
docker run -it ubuntu:18.10 bash
|
95
|
-
----
|
96
|
-
////
|
26
|
+
See https://www.metanorma.org/install/[]
|
97
27
|
|
98
28
|
=== Installing individual components
|
99
29
|
|
100
|
-
The Metanorma workflow can be utilized via the `metanorma` Ruby gem.
|
30
|
+
The Metanorma workflow can be utilized via the `metanorma-cli` Ruby gem.
|
101
31
|
|
102
32
|
[source,sh]
|
103
33
|
----
|
104
34
|
gem install metanorma-cli
|
105
35
|
----
|
106
36
|
|
107
|
-
If you are going to generate PDFs from HTML (which applies to CSD), you will also need to install
|
108
|
-
the node library https://github.com/GoogleChrome/puppeteer:
|
109
|
-
|
110
|
-
* Install Node, with at least version 7.6.0: https://nodejs.org/en/download/,
|
111
|
-
https://nodejs.org/en/download/package-manager/ . (For macOS, `brew install node`)
|
112
|
-
* Install npm: https://docs.npmjs.com/getting-started/installing-node
|
113
|
-
* Install puppeteer: `npm install -g --save --save-exact puppeteer`
|
114
|
-
|
115
|
-
|
116
37
|
== Usage
|
117
38
|
|
118
|
-
|
119
|
-
|
120
|
-
[source,sh]
|
121
|
-
----
|
122
|
-
$ metanorma -h
|
123
|
-
Usage: metanorma [options] <file>
|
124
|
-
-t, --type TYPE Type of standard to generate: rfc2, rfc3, iso, gb, csd, csand, m3d
|
125
|
-
-x, --extensions EXT1,EXT2,... | all Type of extension to generate per type:
|
126
|
-
{
|
127
|
-
:rfc2=>{:xmlrfc=>"v2.xml"},
|
128
|
-
:rfc3=>{:xmlrfc=>"v3.xml"},
|
129
|
-
:iso=>{:html=>"html", :html_alt=>"alt.html", :doc=>"doc"},
|
130
|
-
:gb=>{:html=>"html", :compliant_html => "compliant_html", :doc=>"doc"},
|
131
|
-
:csd=>{:html=>"html", :pdf=>"pdf", :doc => "doc"},
|
132
|
-
:csand=>{:html=>"html"},
|
133
|
-
:m3d=>{:html=>"html", :doc=>"doc", :pdf => "pdf"},
|
134
|
-
:rsd=>{:html=>"html", :doc=>"doc", :pdf => "pdf"}
|
135
|
-
:acme=>{:html=>"html", :doc=>"doc", :pdf => "pdf"}
|
136
|
-
:mpdf=>{:html=>"html", :doc=>"doc", :pdf => "pdf"}
|
137
|
-
:unece=>{:html=>"html", :doc=>"doc"}
|
138
|
-
}
|
139
|
-
In addition, xml (outside of rfc2, rfc3) generates IsoDoc XML. If the argument is "all" or the option is
|
140
|
-
missing, all available extensions are generated.
|
141
|
-
-f, --format FORMAT Format of source file: asciidoc (current default, only format supported)
|
142
|
-
-r, --require LIBRARY Require LIBRARY prior to execution
|
143
|
-
-w, --wrapper Create wrapper folder for HTML output
|
144
|
-
-d, --data-uri-image Encode HTML output images as data URIs
|
145
|
-
-a, --asciimath Preserve AsciiMath in Metanorma XML, instead of transforming it into MathML
|
146
|
-
-R, --relaton FILENAME Export Relaton XML (bibdata) for this document to FILENAME
|
147
|
-
(Also triggered through -x rxl)
|
148
|
-
-e, --extract DIR(,ASSET1,ASSET2...) Extract assets from this document to directory DIR. If ASSET1,ASSET2 are named, only those types of asset are extracted.
|
149
|
-
-h, --help Show this message
|
150
|
-
----
|
151
|
-
|
152
|
-
Basically it is used like this:
|
153
|
-
|
154
|
-
[source,sh]
|
155
|
-
----
|
156
|
-
$ metanorma --type <chosen-type> [--format input-format] [--extensions EXT1,EXT2...] iso-my-standard-document.adoc
|
157
|
-
----
|
158
|
-
|
159
|
-
Options:
|
160
|
-
|
161
|
-
`type`:: (mandatory, specified via `--type` or `-t`) takes one of the following types:
|
162
|
-
`rfc2`, `rfc3`, `iso`, `gb`, `csd`, `csand`, `m3d`, `rsd`. Each of these corresponds to a
|
163
|
-
standards class and a Metanorma gem; the list of standards classes supported by the script
|
164
|
-
by default will grow (see also `require`).
|
165
|
-
|
166
|
-
`extension`:: (optional) specifies the output formats to be generated. If not specified,
|
167
|
-
all possible output formats are generated. The output formats generated are constrained by
|
168
|
-
what has been defined for each standard type. All standards can generate Metanorma XML (`xml`),
|
169
|
-
and at least one of HTML (`html`), DOC (`doc`), PDF (`pdf`). Some standards generate alternative
|
170
|
-
HTML renderings (e.g. `html_alt` for ISO).
|
171
|
-
|
172
|
-
`wrapper`:: create a separate folder for each instance of HTML output generated; the folder is named
|
173
|
-
the same as the output file, without the `.html` suffix. Used to make distribution of HTML outputs
|
174
|
-
more straightforward.
|
175
|
-
|
176
|
-
`datauriimage`:: Encode all images as data URIs.
|
177
|
-
|
178
|
-
`relaton`:: exports the bibdata Relaton XML description of the document (which is part of its Metanorma XML)
|
179
|
-
to the nominated directory. The filename is the document identifier, if present, else the document filename.
|
180
|
-
|
181
|
-
`asciimath`:: Preserve AsciiMath in Metanorma XML, instead of transforming it into MathML (which is the default).
|
182
|
-
|
183
|
-
`extract`:: export assets found in the document to the nominated directory. If no other arguments are given,
|
184
|
-
then all asset classes are exported, each to its own subdirectory. If trailing arguments are given, they
|
185
|
-
are taken as naming which asset classes to extract from the document. Three asset classes are recognised:
|
186
|
-
`sourcecode`, `image`, and `requirement` (which includes `recommendation` and `permission` elements).
|
187
|
-
The assets are given autonumbered names, unless they were given a `filename` attribute in the source
|
188
|
-
Metanorma XML, which is used instead.
|
189
|
-
|
190
|
-
`format`:: (optional, specified via `--format` or `-f`) only accepts `asciidoc` for now,
|
191
|
-
defaults to `asciidoc`
|
192
|
-
|
193
|
-
As the `--format` argument is (currently) optional, so:
|
194
|
-
|
195
|
-
[source,sh]
|
196
|
-
----
|
197
|
-
$ metanorma --type iso -x html iso-my-standard-document.adoc
|
198
|
-
----
|
199
|
-
|
200
|
-
`require`:: If you wish to use metanorma with a document class which has not been included in the types recognised
|
201
|
-
by the metanorma script, you will need to name the corresponding Metnorma gem explicitly with the `-r`
|
202
|
-
option; e.g.
|
203
|
-
|
204
|
-
[source,sh]
|
205
|
-
----
|
206
|
-
$ metanorma -t mpfd mpfd-bpn.adoc
|
207
|
-
|
208
|
-
[metanorma] Error: mpfd is not a supported standard type.
|
209
|
-
|
210
|
-
$ metanorma -t mpfd -r metanorma-mpfd mpfd-bpn.adoc
|
211
|
-
----
|
212
|
-
|
213
|
-
The `asciimath`, `type`, `extension` and `relaton` options can be omitted if the corresponding metanorma directives
|
214
|
-
are included in the document as Metanorma directives; for Asciidoctor input, these take the form
|
215
|
-
of document attributes `mn-keep-asciimath:`, `mn-document-class:`, `:mn-output-extensions:`
|
216
|
-
and `:mn-relaton-output-file:`, e.g.
|
217
|
-
|
218
|
-
[source,asciidoctor]
|
219
|
-
----
|
220
|
-
= My ISO document
|
221
|
-
:mn-keep-asciimath:
|
222
|
-
:mn-document-class: iso
|
223
|
-
:mn-output-extensions: html,xml,pdf
|
224
|
-
:mn-relaton-output-file: test.xml
|
225
|
-
|
226
|
-
.Foreword
|
227
|
-
----
|
228
|
-
|
229
|
-
Metanorma can also be invoked within Ruby, through the metanorma gem:
|
230
|
-
|
231
|
-
[source,asciidoctor]
|
232
|
-
----
|
233
|
-
require "metanorma"
|
234
|
-
|
235
|
-
Metanorma::Compile.new().compile(filename, options)
|
236
|
-
----
|
237
|
-
|
238
|
-
The options hash has the same structure it does when invoked in metanorma-cli:
|
239
|
-
|
240
|
-
`:type`:: one of `"iso"`, `"csd"`, `"rsd"`, etc. (mandatory)
|
241
|
-
`:format`:: `:asciidoc` is only value currently allowed
|
242
|
-
`:extension_keys`:: array of symbols: `:all`, `:xml`:, `:doc` etc.
|
243
|
-
`:wrapper`: true/false
|
244
|
-
`:datauriimage`: true/false
|
245
|
-
`:asciimath`: true/false
|
246
|
-
`:require`: array of libraries to require
|
247
|
-
`:relaton`: exports the bibdata Relaton XML description of the document (which is part of its Metanorma XML)
|
248
|
-
to the nominated directory
|
39
|
+
Refer to https://www.metanorma.org/install/man/[Metanorma man page] and https://www.metanorma.org/install/usage/[Metanorma usage]
|
249
40
|
|
250
|
-
|
41
|
+
=== Threaded execution
|
251
42
|
|
252
43
|
Metanorma has threaded execution, to generate output documents from the same Presentation XML input more quickly.
|
253
44
|
Similar to https://github.com/relaton/relaton[relaton], the `METANORMA_PARALLEL` environment variable
|
@@ -129,7 +129,7 @@ module Metanorma
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def svgmap_resolve(docxml)
|
132
|
-
isodoc = IsoDoc::
|
132
|
+
isodoc = IsoDoc::PresentationXMLConvert.new({})
|
133
133
|
isodoc.bibitem_lookup(docxml)
|
134
134
|
docxml.xpath(ns("//svgmap//eref")).each do |e|
|
135
135
|
svgmap_resolve1(e, isodoc)
|
@@ -7,8 +7,7 @@ module Metanorma
|
|
7
7
|
require "asciidoctor"
|
8
8
|
out_opts = {
|
9
9
|
to_file: false, safe: :safe, backend: type, header_footer: true,
|
10
|
-
attributes: ["nodoc", "stem", "
|
11
|
-
"docfile=#{filename}",
|
10
|
+
attributes: ["nodoc", "stem", "docfile=#{filename}",
|
12
11
|
"output_dir=#{options[:output_dir]}"]
|
13
12
|
}
|
14
13
|
unless asciidoctor_validate(file, filename, out_opts)
|
data/lib/metanorma/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|