metanorma 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +16 -11
- data/README.adoc +52 -22
- data/exe/metanorma +6 -12
- data/lib/metanorma/processor.rb +4 -2
- data/lib/metanorma/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e035adbe0198188b313c2b91ea58ec320e056e5f9b0b34a56cebbe782531cc03
|
4
|
+
data.tar.gz: e328e75abb7ea5d0d10582f9459d8e843b5f9b205dafe59447475945671d171e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65fe8520fc1e1e8e8d5855cf977809b9eb1998dd5050b9c0f9432c544d1534d68d9830bf7c68e9260f41474392c607e437dfe31e9a84b2fe7874339aeca42ec4
|
7
|
+
data.tar.gz: ca6f446651de13513fb8d710b816fcb8f9257883b3de2faac54e5d396232ac60f2bc95ed0cfdf84bfb85a3eec392298bd651429ee07f20c77367fb3733276ee6
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
metanorma (0.2.
|
4
|
+
metanorma (0.2.5)
|
5
5
|
asciidoctor-csand (>= 0.3.0)
|
6
6
|
asciidoctor-csd (>= 0.4.0)
|
7
7
|
asciidoctor-gb (>= 0.3.0)
|
@@ -18,7 +18,7 @@ GEM
|
|
18
18
|
httpclient (~> 2.8, >= 2.8.3)
|
19
19
|
json (>= 1.5.1)
|
20
20
|
asciidoctor (1.5.7.1)
|
21
|
-
asciidoctor-csand (0.3.
|
21
|
+
asciidoctor-csand (0.3.1)
|
22
22
|
asciidoctor (~> 1.5.7)
|
23
23
|
asciidoctor-iso (>= 0.9.0)
|
24
24
|
asciimath
|
@@ -31,20 +31,21 @@ GEM
|
|
31
31
|
ruby-xslt
|
32
32
|
thread_safe
|
33
33
|
uuidtools
|
34
|
-
asciidoctor-csd (0.4.
|
34
|
+
asciidoctor-csd (0.4.1)
|
35
35
|
asciidoctor-iso (>= 0.9.0)
|
36
36
|
isodoc (>= 0.8.0)
|
37
|
-
asciidoctor-gb (0.3.
|
37
|
+
asciidoctor-gb (0.3.1)
|
38
38
|
asciidoctor-iso (>= 0.9.0)
|
39
|
+
gbbib
|
39
40
|
isodoc (>= 0.8.0)
|
40
41
|
twitter_cldr
|
41
|
-
asciidoctor-iso (0.9.
|
42
|
+
asciidoctor-iso (0.9.3)
|
42
43
|
asciidoctor (~> 1.5.7)
|
43
44
|
iso-bib-item (~> 0.1.6)
|
44
|
-
isobib (~> 0.1.
|
45
|
+
isobib (~> 0.1.8)
|
45
46
|
isodoc (>= 0.8)
|
46
47
|
ruby-jing
|
47
|
-
asciidoctor-m3d (0.3.
|
48
|
+
asciidoctor-m3d (0.3.2)
|
48
49
|
asciidoctor (~> 1.5.7)
|
49
50
|
asciidoctor-iso (>= 0.9.0)
|
50
51
|
asciimath
|
@@ -80,11 +81,15 @@ GEM
|
|
80
81
|
byebug (10.0.2)
|
81
82
|
camertron-eprun (1.1.1)
|
82
83
|
cldr-plurals-runtime-rb (1.0.1)
|
84
|
+
cnccs (0.1.1)
|
83
85
|
diff-lcs (1.3)
|
84
86
|
duplicate (1.1.1)
|
85
87
|
equivalent-xml (0.6.0)
|
86
88
|
nokogiri (>= 1.4.3)
|
87
89
|
ffi (1.9.25)
|
90
|
+
gbbib (0.1.2)
|
91
|
+
cnccs
|
92
|
+
iso-bib-item
|
88
93
|
html2doc (0.8.0)
|
89
94
|
asciimath
|
90
95
|
htmlentities (~> 4.3.4)
|
@@ -97,14 +102,14 @@ GEM
|
|
97
102
|
htmlentities (4.3.4)
|
98
103
|
httpclient (2.8.3)
|
99
104
|
image_size (2.0.0)
|
100
|
-
iso-bib-item (0.1.
|
105
|
+
iso-bib-item (0.1.10)
|
101
106
|
duplicate
|
102
107
|
isoics (~> 0.1.6)
|
103
108
|
nokogiri
|
104
|
-
isobib (0.1.
|
109
|
+
isobib (0.1.9)
|
105
110
|
algoliasearch
|
106
|
-
iso-bib-item (~> 0.1.
|
107
|
-
isodoc (0.8)
|
111
|
+
iso-bib-item (~> 0.1.10)
|
112
|
+
isodoc (0.8.1)
|
108
113
|
asciimath
|
109
114
|
html2doc (>= 0.7.1)
|
110
115
|
htmlentities (~> 4.3.4)
|
data/README.adoc
CHANGED
@@ -16,17 +16,46 @@ document model.
|
|
16
16
|
Metanorma includes the following sub-projects:
|
17
17
|
|
18
18
|
* The https://github.com/riboseinc/standoc-models[Metanorma document model (previously called StanDoc)]
|
19
|
-
|
20
|
-
*
|
21
|
-
|
22
|
-
|
23
|
-
*
|
24
|
-
|
19
|
+
|
20
|
+
* IETF Internet-Drafts and RFCs: the https://datatracker.ietf.org/doc/draft-ribose-asciirfc/[AsciiRFC syntax],
|
21
|
+
the https://github.com/riboseinc/asciidoctor-rfc/[asciidoctor-rfc RFC XML v2 and v3 implementations]
|
22
|
+
|
23
|
+
* ISO Standards: the AsciiISO syntax,
|
24
|
+
the https://github.com/riboseinc/isodoc-models/[IsoDoc Models],
|
25
|
+
the https://github.com/riboseinc/asciidoctor-iso/[asciidoctor-iso IsoDoc implementation]
|
26
|
+
|
27
|
+
* CalConnect Standard Documents (CSD): the AsciiCSD syntax,
|
28
|
+
https://github.com/riboseinc/csd[CSD Models],
|
29
|
+
the https://github.com/riboseinc/asciidoctor-csd/[asciidoctor-csd implementation]
|
30
|
+
|
31
|
+
* Chinese GuoBiao (GB) Standards: the AsciiGB syntax,
|
32
|
+
https://github.com/riboseinc/gbdoc[GbDoc Models],
|
33
|
+
the https://github.com/riboseinc/asciidoctor-gb/[asciidoctor-gb implementation]
|
34
|
+
|
35
|
+
* Cloud Security Alliance Normal Documents (CSAND): the AsciiCSAND syntax,
|
36
|
+
https://github.com/riboseinc/csand[CSAND Models],
|
37
|
+
the https://github.com/riboseinc/asciidoctor-csand/[asciidoctor-csand implementation]
|
38
|
+
|
39
|
+
* M3AAWG Documents (M3D): the AsciiM3D syntax,
|
40
|
+
https://github.com/riboseinc/m3d[M3D Models],
|
41
|
+
the https://github.com/riboseinc/asciidoctor-m3d/[asciidoctor-m3d implementation]
|
42
|
+
|
25
43
|
//* Ribose Specification Documents (RSD): AsciiRSD, RSD XML schema, and the https://github.com/riboseinc/asciidoctor-rsd[asciidoctor-rsd implementation]
|
26
44
|
|
27
45
|
|
28
46
|
== Installation
|
29
47
|
|
48
|
+
=== All-in-one install
|
49
|
+
|
50
|
+
macOS users can directly run the Metanorma setup script located here:
|
51
|
+
https://github.com/riboseinc/metanorma-macos-setup
|
52
|
+
|
53
|
+
This is a one-stop installation script that setups Ruby, Node
|
54
|
+
and all necessary parts for running Metanorma.
|
55
|
+
|
56
|
+
|
57
|
+
=== Installing individual components
|
58
|
+
|
30
59
|
The Metanorma workflow can be utilized via the `metanorma` Ruby gem.
|
31
60
|
|
32
61
|
[source,sh]
|
@@ -42,6 +71,7 @@ https://nodejs.org/en/download/package-manager/ . (For Mac, `brew install node`)
|
|
42
71
|
* Install npm: https://docs.npmjs.com/getting-started/installing-node
|
43
72
|
* Install puppeteer: `npm install -g --save --save-exact puppeteer`
|
44
73
|
|
74
|
+
|
45
75
|
== Usage
|
46
76
|
|
47
77
|
Help command:
|
@@ -50,22 +80,22 @@ Help command:
|
|
50
80
|
----
|
51
81
|
$ metanorma -h
|
52
82
|
Usage: metanorma [options] <file>
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
83
|
+
-t, --type TYPE Type of standard to generate: rfc2, rfc3, iso, gb, csd, csand, m3d
|
84
|
+
-x, --extensions EXT1,EXT2,... Type of extension to generate per type:
|
85
|
+
{
|
86
|
+
:rfc2=>{:xmlrfc=>"v2.xml"},
|
87
|
+
:rfc3=>{:xmlrfc=>"v3.xml"},
|
88
|
+
:iso=>{:html=>"html", :html_alt=>"alt.html", :doc=>"doc"},
|
89
|
+
:gb=>{:html=>"html", :doc=>"doc"},
|
90
|
+
:csd=>{:html=>"html", :pdf=>"pdf"},
|
91
|
+
:csand=>{:html=>"html"},
|
92
|
+
:m3d=>{:html=>"html", :doc=>"doc"},
|
93
|
+
:rsd=>{:html=>"html"}
|
94
|
+
}
|
95
|
+
In addition, xml (outside of rfc2, rfc3) generates IsoDoc XML
|
96
|
+
-f, --format FORMAT Format of source file: asciidoc (current default, only format supported)
|
97
|
+
-r, --require LIBRARY Require LIBRARY prior to execution
|
98
|
+
-h, --help Show this message
|
69
99
|
----
|
70
100
|
|
71
101
|
Basically it is used like this:
|
data/exe/metanorma
CHANGED
@@ -41,8 +41,7 @@ opt_parser = OptionParser.new do |opts|
|
|
41
41
|
'-x',
|
42
42
|
'--extensions EXT1,EXT2,...',
|
43
43
|
Array,
|
44
|
-
"Type of extension to generate per type: #{registry.output_formats}\n"
|
45
|
-
"In addition, xml (outside of rfc2, rfc3) generates IsoDoc XML"
|
44
|
+
"Type of extension to generate per type: #{registry.output_formats}\n"
|
46
45
|
) { |v| options[:extension_keys] = v.map(&:to_sym) }
|
47
46
|
|
48
47
|
opts.on(
|
@@ -116,31 +115,26 @@ end
|
|
116
115
|
case options[:format]
|
117
116
|
when :asciidoc
|
118
117
|
processor = registry.find_processor(options[:type].to_sym)
|
119
|
-
|
120
118
|
options[:extension_keys] ||= processor.output_formats.inject([]) do |memo, (k, _)|
|
121
119
|
memo << k; memo
|
122
120
|
end
|
123
121
|
extensions = options[:extension_keys].inject([]) do |memo, e|
|
124
|
-
if processor.output_formats[e]
|
122
|
+
if processor.output_formats[e]
|
123
|
+
memo << e
|
125
124
|
else
|
126
125
|
warn "[metanorma] Error: #{e} format is not supported for this standard"
|
127
126
|
end
|
128
|
-
memo
|
127
|
+
memo
|
129
128
|
end
|
130
129
|
exit 0 if extensions.empty?
|
131
130
|
|
132
131
|
file = File.read(options[:filename], encoding: "utf-8")
|
133
132
|
isodoc = processor.input_to_isodoc(file)
|
134
133
|
isodoc_options = processor.extract_options(file)
|
135
|
-
|
136
134
|
extensions.each do |ext|
|
137
|
-
file_extension =
|
135
|
+
file_extension = processor.output_formats[ext]
|
138
136
|
outfilename = options[:filename].sub(/\.[^.]+$/, ".#{file_extension}")
|
139
|
-
|
140
|
-
File.open(outfilename, "w:UTF-8") { |f| f.write(isodoc) }
|
141
|
-
else
|
142
|
-
processor.output(isodoc, outfilename, ext, isodoc_options)
|
143
|
-
end
|
137
|
+
processor.output(isodoc, outfilename, ext, isodoc_options)
|
144
138
|
end
|
145
139
|
end
|
146
140
|
|
data/lib/metanorma/processor.rb
CHANGED
@@ -12,7 +12,9 @@ module Metanorma
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def output_formats
|
15
|
-
|
15
|
+
{
|
16
|
+
xml: "xml"
|
17
|
+
}
|
16
18
|
end
|
17
19
|
|
18
20
|
def input_to_isodoc(file)
|
@@ -20,7 +22,7 @@ module Metanorma
|
|
20
22
|
end
|
21
23
|
|
22
24
|
def output(isodoc_node, outname, format, options={})
|
23
|
-
|
25
|
+
File.open(outname, "w:UTF-8") { |f| f.write(isodoc_node) }
|
24
26
|
end
|
25
27
|
|
26
28
|
def extract_options(file)
|
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: 0.2.
|
4
|
+
version: 0.2.5
|
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-07-
|
11
|
+
date: 2018-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -264,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
264
264
|
version: '0'
|
265
265
|
requirements: []
|
266
266
|
rubyforge_project:
|
267
|
-
rubygems_version: 2.7.
|
267
|
+
rubygems_version: 2.7.6
|
268
268
|
signing_key:
|
269
269
|
specification_version: 4
|
270
270
|
summary: Metanorma is the standard of standards; the metanorma gem allows you to create
|