metanorma-cli 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e411380736fee742c26d90327890a42550014248b05591221cb176dabe401a12
4
- data.tar.gz: 57ecf918537b0632be30d5b8dc2dfc5cee5e66a3879d519095d97cbd2cd8ef8e
3
+ metadata.gz: 25ce6e4380b3fe1815535001fbb516485891df3b9af58cc0a50e9e8738313b2f
4
+ data.tar.gz: 97f5d36918af22e7c3eb08fce6fd2e5d5cc5fe2febf83c0c23e7466f1463ddd3
5
5
  SHA512:
6
- metadata.gz: 465dd38bd86b4052bb8b696006cb22d0df13f0b567528ca374c520b523927b118bdca8a597afd526ac34b3122d30f1c31d6d6b63a968ba18030044b375ba3fd7
7
- data.tar.gz: cbbb08fa9bf2aa18d1221d82cc9534c6c989de532f838cb79d00ebdba7761dd003b3530a58d13ce4e16f42567dd09e379ac906101b8e9251b0a271c67114dd7e
6
+ metadata.gz: d1a274bb3d3734045b77835cb06b3b2c480ba5000e88b168845e1f4b3f5f0f2aa473cc11bf1d7e329908f4a2fa5851f639e81dcacdd2e3932e9d1602e7e52c9b
7
+ data.tar.gz: 2644de8545d160098b858b122c932a5e656cf9f897dfe63e81233652240a8876a0ca0d072c06e2088cb7249c52a0652845822999a6f0dc242104bc7edcbb50f7
data/docs/usage.adoc CHANGED
@@ -1,40 +1,22 @@
1
- = Usage
1
+ = Using the Metanorma CLI
2
2
 
3
- Help command:
3
+ == Usage sample
4
4
 
5
5
  [source,sh]
6
6
  ----
7
- $ metanorma -h
8
- Usage: metanorma [options] <file>
9
- -t, --type TYPE Type of standard to generate: rfc2, rfc3, iso, gb, csd, csand, m3d
10
- -x, --extensions EXT1,EXT2,... | all Type of extension to generate per type:
11
- {
12
- :rfc2=>{:xmlrfc=>"v2.xml"},
13
- :rfc3=>{:xmlrfc=>"v3.xml"},
14
- :iso=>{:html=>"html", :html_alt=>"alt.html", :doc=>"doc"},
15
- :gb=>{:html=>"html", :doc=>"doc"},
16
- :csd=>{:html=>"html", :pdf=>"pdf"},
17
- :csand=>{:html=>"html"},
18
- :m3d=>{:html=>"html", :doc=>"doc"},
19
- :rsd=>{:html=>"html"}
20
- }
21
- In addition, xml (outside of rfc2, rfc3) generates IsoDoc XML. If the argument is "all" or the option is
22
- missing, all available extensions are generated.
23
- -f, --format FORMAT Format of source file: asciidoc (current default, only format supported)
24
- -r, --require LIBRARY Require LIBRARY prior to execution
25
- -w, --wrapper Create wrapper folder for HTML output
26
- -h, --help Show this message
7
+ $ metanorma --type iso -x html iso-my-standard-document.adoc
27
8
  ----
28
9
 
29
- Basically it is used like this:
10
+ == Full syntax & options
30
11
 
31
12
  [source,sh]
32
13
  ----
33
- $ metanorma --type <chosen-type> [--format input-format] [--extensions EXT1,EXT2...] iso-my-standard-document.adoc
14
+ $ metanorma --type <chosen-type> \
15
+ [--format input-format] \
16
+ [--extensions EXT1,EXT2...] \
17
+ iso-my-standard-document.adoc
34
18
  ----
35
19
 
36
- Options:
37
-
38
20
  `type`:: (mandatory, specified via `--type` or `-t`) takes one of the following types:
39
21
  `rfc2`, `rfc3`, `iso`, `gb`, `csd`, `csand`, `m3d`, `rsd`. Each of these corresponds to a
40
22
  standards class and a Metanorma gem; the list of standards classes supported by the script
@@ -50,19 +32,11 @@ HTML renderings (e.g. `html_alt` for ISO).
50
32
  the same as the output file, without the `.html` suffix. Used to make distribution of HTML outputs
51
33
  more straightforward.
52
34
 
53
- `format`:: (optional, specified via `--format` or `-f`) only accepts `asciidoc` for now,
54
- defaults to `asciidoc`
55
-
56
- As the `--format` argument is (currently) optional, so:
57
-
58
- [source,sh]
59
- ----
60
- $ metanorma --type iso -x html iso-my-standard-document.adoc
61
- ----
35
+ `format`:: (optional, defaults to `asciidoc`, specified via `--format` or `-f`) only accepts `asciidoc` for now
62
36
 
63
37
  `require`:: If you wish to use metanorma with a document class which has not been included in the types recognised
64
38
  by the metanorma script, you will need to name the corresponding Metnorma gem explicitly with the `-r`
65
- option; e.g.
39
+ option. For example:
66
40
 
67
41
  [source,sh]
68
42
  ----
@@ -72,3 +46,29 @@ $ metanorma -t mpfd mpfd-bpn.adoc
72
46
 
73
47
  $ metanorma -t mpfd -r metanorma-mpfd mpfd-bpn.adoc
74
48
  ----
49
+
50
+ == Command-line help
51
+
52
+ [source,sh]
53
+ ----
54
+ $ metanorma -h
55
+ Usage: metanorma [options] <file>
56
+ -t, --type TYPE Type of standard to generate: rfc2, rfc3, iso, gb, csd, csand, m3d
57
+ -x, --extensions EXT1,EXT2,... | all Type of extension to generate per type:
58
+ {
59
+ :rfc2=>{:xmlrfc=>"v2.xml"},
60
+ :rfc3=>{:xmlrfc=>"v3.xml"},
61
+ :iso=>{:html=>"html", :html_alt=>"alt.html", :doc=>"doc"},
62
+ :gb=>{:html=>"html", :doc=>"doc"},
63
+ :csd=>{:html=>"html", :pdf=>"pdf"},
64
+ :csand=>{:html=>"html"},
65
+ :m3d=>{:html=>"html", :doc=>"doc"},
66
+ :rsd=>{:html=>"html"}
67
+ }
68
+ In addition, xml (outside of rfc2, rfc3) generates IsoDoc XML. If the argument is "all" or the option is
69
+ missing, all available extensions are generated.
70
+ -f, --format FORMAT Format of source file: asciidoc (current default, only format supported)
71
+ -r, --require LIBRARY Require LIBRARY prior to execution
72
+ -w, --wrapper Create wrapper folder for HTML output
73
+ -h, --help Show this message
74
+ ----
data/exe/metanorma CHANGED
@@ -4,25 +4,12 @@ require "optparse"
4
4
  require "metanorma"
5
5
  require "fileutils"
6
6
  require "nokogiri"
7
+ require "metanorma-cli"
7
8
 
8
9
  registry = Metanorma::Registry.instance
9
10
 
10
- supported_gem_paths = [
11
- "asciidoctor-rfc",
12
- "metanorma-iso",
13
- "metanorma-gb",
14
- "metanorma-csd",
15
- "metanorma-csand",
16
- "metanorma-m3d",
17
- "metanorma-rsd",
18
- "metanorma-acme",
19
- "metanorma-standoc",
20
- "metanorma-unece",
21
- "metanorma-mpfd",
22
- ]
23
-
24
11
  puts "[metanorma] detecting backends:"
25
- supported_gem_paths.each do |backend|
12
+ Metanorma::CLI::SUPPORTED_GEMS.each do |backend|
26
13
  begin
27
14
  # puts backend
28
15
  require backend
@@ -40,20 +27,36 @@ opt_parser = OptionParser.new do |opts|
40
27
  opts.on(
41
28
  '-t',
42
29
  '--type TYPE',
43
- "Type of standard to generate: #{registry.supported_backends.join(", ")}"
30
+ String,
31
+ "Type of standard to generate",
32
+ "#{registry.supported_backends}"
44
33
  ) { |v| options[:type] = v.to_sym }
45
34
 
35
+ output_formats = registry.output_formats.inject([]) do |acc, (processor, formats)|
36
+ str = "* #{processor.to_s}: "
37
+
38
+ formats.each_pair do |type, ext|
39
+ str << "['#{type.to_s}': #{ext.to_s}] "
40
+ end
41
+
42
+ acc << str
43
+ end
44
+
46
45
  opts.on(
47
46
  '-x',
48
- '--extensions EXT1,EXT2,... | all',
47
+ "--extensions all | EXT,...",
49
48
  Array,
50
- "Type of extension to generate per type: #{registry.output_formats}\n"
49
+ "Document extensions available per type (type, ['filetype': ext])",
50
+ *output_formats
51
51
  ) { |v| options[:extension_keys] = v.map(&:to_sym) }
52
52
 
53
+ input_formats = [:asciidoc]
53
54
  opts.on(
54
55
  '-f',
55
56
  '--format FORMAT',
56
- 'Format of source file: asciidoc (current default, only format supported)'
57
+ String,
58
+ 'Format of source file',
59
+ "#{input_formats}",
57
60
  ) { |v| options[:format] = v.to_sym }
58
61
 
59
62
  opts.on(
@@ -7,20 +7,9 @@ require "uuidtools"
7
7
  require "uri"
8
8
 
9
9
  registry = Metanorma::Registry.instance
10
- supported_gem_paths = [
11
- "asciidoctor-rfc",
12
- "metanorma-iso",
13
- "metanorma-gb",
14
- "metanorma-csd",
15
- "metanorma-csand",
16
- "metanorma-m3d",
17
- "metanorma-rsd",
18
- "metanorma-acme",
19
- "metanorma-standoc",
20
- ]
21
10
 
22
11
  puts "[metanorma] detecting backends:"
23
- supported_gem_paths.each do |backend|
12
+ Metanorma::CLI::SUPPORTED_GEMS.each do |backend|
24
13
  begin
25
14
  puts backend
26
15
  require backend
@@ -170,7 +159,7 @@ File.open(outfilename, "w") { |f| f.write out }
170
159
 
171
160
  processor = registry.find_processor(options[:type].to_sym)
172
161
  ext = :html
173
- file_extension = "html" || processor.output_formats[ext]
162
+ file_extension = "html" || processor.output_formats[ext]
174
163
  outfilename = options[:filename].sub(/\.[^.]+$/, ".#{file_extension}")
175
164
  isodoc_options = { suppressheadingnumbers: true }
176
165
  isodoc_options[:htmlstylesheet] = manifest["htmlstylesheet"] if manifest["htmlstylesheet"]
data/lib/metanorma-cli.rb CHANGED
@@ -2,5 +2,20 @@ require "metanorma-cli/version"
2
2
 
3
3
  module Metanorma
4
4
  module CLI
5
+
6
+ SUPPORTED_GEMS = [
7
+ "metanorma-iso",
8
+ "metanorma-ietf",
9
+ "metanorma-gb",
10
+ "metanorma-csd",
11
+ "metanorma-csand",
12
+ "metanorma-m3d",
13
+ "metanorma-rsd",
14
+ "metanorma-acme",
15
+ "metanorma-standoc",
16
+ "metanorma-unece",
17
+ "metanorma-mpfd"
18
+ ]
19
+
5
20
  end
6
21
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CLI
3
- VERSION = "1.0.8"
4
- end
3
+ VERSION = "1.0.9"
4
+ end
5
5
  end
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
34
34
 
35
35
 
36
36
  spec.add_runtime_dependency 'metanorma-iso', "~> 1.0.6"
37
- spec.add_runtime_dependency 'asciidoctor-rfc', "~> 0.9.0"
37
+ spec.add_runtime_dependency 'metanorma-ietf', "~> 1.0"
38
38
  spec.add_runtime_dependency 'metanorma-gb', "~> 1.0.5"
39
39
  spec.add_runtime_dependency 'metanorma-csd', "~> 1.0.5"
40
40
  spec.add_runtime_dependency 'metanorma-csand', "~> 1.0.5"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
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-27 00:00:00.000000000 Z
11
+ date: 2018-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -123,19 +123,19 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: 1.0.6
125
125
  - !ruby/object:Gem::Dependency
126
- name: asciidoctor-rfc
126
+ name: metanorma-ietf
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 0.9.0
131
+ version: '1.0'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 0.9.0
138
+ version: '1.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: metanorma-gb
141
141
  requirement: !ruby/object:Gem::Requirement