metanorma-cli 1.4.0 → 1.4.1pre2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/README.adoc +26 -0
- data/lib/metanorma/cli/command.rb +37 -3
- data/lib/metanorma/cli/commands/site.rb +1 -1
- data/lib/metanorma/cli/site_generator.rb +8 -4
- data/lib/metanorma/cli/ui.rb +4 -0
- data/lib/metanorma/cli/version.rb +1 -1
- data/metanorma-cli.gemspec +4 -4
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a910e2812c1da05b08d76dc9bd6fda1859ef59052c8c902ce11f367bf9fd137
|
4
|
+
data.tar.gz: 32070afaf5c7b460635ae2eb9dc1343259793df5cc6e4e3bebf285310456006f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c54fa10cf2f4131490ad9e6b030c236a4df6d91972be12ad7a0ed99d49693afc49ee14b7f91f2068655e120c38c54dc699887def94d9b9223cc2ed50ef2f299
|
7
|
+
data.tar.gz: 9330606dcef7ee362afea8218244edc79d33820e3416d04a1b7b1b02ef9f3e3dddfcdc7eab62dffe422ac03fcb57e4df86da0910f027bc00b75a43cd718db41b
|
data/Gemfile
CHANGED
data/README.adoc
CHANGED
@@ -228,6 +228,32 @@ Options:
|
|
228
228
|
-c, [--coverpage=COVERPAGE] # Cover page as Liquid template for collection (currently HTML only)
|
229
229
|
----
|
230
230
|
|
231
|
+
=== List supported doctypes (`metanorma list-doctypes`)
|
232
|
+
|
233
|
+
You want to know what are the supported doctypes and what do they support for
|
234
|
+
input and output format? Well, the `metanorma list-doctypes` can help.
|
235
|
+
|
236
|
+
|
237
|
+
[source,sh]
|
238
|
+
----
|
239
|
+
metanorma list-doctypes
|
240
|
+
----
|
241
|
+
|
242
|
+
|
243
|
+
To list out the details for a specific flavor run the following command:
|
244
|
+
|
245
|
+
[source,sh]
|
246
|
+
----
|
247
|
+
metanorma list-doctypes <flavor>
|
248
|
+
----
|
249
|
+
|
250
|
+
e.g.,
|
251
|
+
|
252
|
+
[source,sh]
|
253
|
+
----
|
254
|
+
metanorma list-doctypes iso
|
255
|
+
----
|
256
|
+
|
231
257
|
=== List supported output formats (`metanorma list-extensions`)
|
232
258
|
|
233
259
|
Need to know what output formats are supported for a given flavor?
|
@@ -32,9 +32,9 @@ module Metanorma
|
|
32
32
|
option :version, aliases: "-v", desc: "Print version of code (accompanied with -t)"
|
33
33
|
option "output-dir", aliases: "-o", desc: "Directory to save compiled files"
|
34
34
|
|
35
|
-
option :
|
36
|
-
option :
|
37
|
-
option :
|
35
|
+
option :"agree-to-terms", type: :boolean, desc: "Agree / Disagree with all third-party licensing terms presented (WARNING: do know what you are agreeing with!)"
|
36
|
+
option :"no-install-fonts", type: :boolean, desc: "Skip the font installation process"
|
37
|
+
option :"continue-without-fonts", type: :boolean, desc: "Continue processing even when fonts are missing"
|
38
38
|
|
39
39
|
def compile(file_name = nil)
|
40
40
|
if file_name && !options[:version]
|
@@ -58,12 +58,16 @@ module Metanorma
|
|
58
58
|
option :format, aliases: "-x", type: :string, desc: "Formats to generate"
|
59
59
|
option "output-folder", aliases: "-w", required: true, desc: "Directory to save compiled files"
|
60
60
|
option :coverpage, aliases: "-c", desc: "Liquid template"
|
61
|
+
option :"agree-to-terms", type: :boolean, desc: "Agree / Disagree with all third-party licensing terms presented (WARNING: do know what you are agreeing with!)"
|
62
|
+
option :"no-install-fonts", type: :boolean, desc: "Skip the font installation process"
|
63
|
+
option :"continue-without-fonts", type: :boolean, desc: "Continue processing even when fonts are missing"
|
61
64
|
|
62
65
|
def collection(filename = nil)
|
63
66
|
if filename
|
64
67
|
opts = options.dup
|
65
68
|
opts[:format] &&= opts[:format].split(",").map &:to_sym
|
66
69
|
opts[:output_folder] = opts.delete :"output-folder"
|
70
|
+
opts[:compile] = opts.slice("agree-to-terms", "no-install-fonts", "continue-without-fonts").map { |k, v| [k.to_sym, v] }.to_h
|
67
71
|
coll = Metanorma::Collection.parse filename
|
68
72
|
coll.render opts
|
69
73
|
else UI.say("Need to specify a file to process")
|
@@ -90,6 +94,17 @@ module Metanorma
|
|
90
94
|
UI.say("Couldn't load #{type}, please provide a valid type!")
|
91
95
|
end
|
92
96
|
|
97
|
+
desc "list-doctypes", "List supported doctypes"
|
98
|
+
def list_doctypes(type = nil)
|
99
|
+
processors = backend_processors
|
100
|
+
|
101
|
+
if type && processors[type.to_sym]
|
102
|
+
processors = { type.to_sym => processors[type.to_sym] }
|
103
|
+
end
|
104
|
+
|
105
|
+
print_doctypes_table(processors)
|
106
|
+
end
|
107
|
+
|
93
108
|
desc "template-repo", "Manage metanorma templates repository"
|
94
109
|
subcommand :template_repo, Metanorma::Cli::Commands::TemplateRepo
|
95
110
|
|
@@ -124,6 +139,13 @@ module Metanorma
|
|
124
139
|
end
|
125
140
|
end
|
126
141
|
|
142
|
+
def backend_processors
|
143
|
+
@backend_processors ||= (
|
144
|
+
Metanorma::Cli.load_flavors
|
145
|
+
Metanorma::Registry.instance.processors
|
146
|
+
)
|
147
|
+
end
|
148
|
+
|
127
149
|
def find_backend(type)
|
128
150
|
load_flavours(type)
|
129
151
|
Metanorma::Registry.instance.find_processor(type&.to_sym)
|
@@ -160,6 +182,18 @@ module Metanorma
|
|
160
182
|
require "metanorma-#{type}"
|
161
183
|
end
|
162
184
|
end
|
185
|
+
|
186
|
+
def print_doctypes_table(processors)
|
187
|
+
table_data = processors.map do |type_sym, processor|
|
188
|
+
[
|
189
|
+
type_sym.to_s,
|
190
|
+
processor.input_format,
|
191
|
+
join_keys(processor.output_formats.keys),
|
192
|
+
]
|
193
|
+
end
|
194
|
+
|
195
|
+
UI.table(["Type", "Input", "Supported output format"], table_data)
|
196
|
+
end
|
163
197
|
end
|
164
198
|
end
|
165
199
|
end
|
@@ -5,7 +5,7 @@ module Metanorma
|
|
5
5
|
module Cli
|
6
6
|
module Commands
|
7
7
|
class Site < Thor
|
8
|
-
desc "
|
8
|
+
desc "generate SOURCE_PATH", "Geneate site from collection"
|
9
9
|
option :config, aliases: "-c", desc: "The metanorma configuration file"
|
10
10
|
option(
|
11
11
|
:output_dir,
|
@@ -8,9 +8,9 @@ module Metanorma
|
|
8
8
|
def initialize(source, options = {})
|
9
9
|
@source = find_realpath(source)
|
10
10
|
@site_path = options.fetch(:output_dir, "site").to_s
|
11
|
-
@manifest_file = find_realpath(options.fetch(:config, nil))
|
12
11
|
@asset_folder = options.fetch(:asset_folder, "documents").to_s
|
13
12
|
@collection_name = options.fetch(:collection_name, "documents.xml")
|
13
|
+
@manifest_file = find_realpath(options.fetch(:config, default_config))
|
14
14
|
|
15
15
|
ensure_site_asset_directory!
|
16
16
|
end
|
@@ -21,10 +21,9 @@ module Metanorma
|
|
21
21
|
|
22
22
|
def generate
|
23
23
|
site_directory = asset_directory.join("..")
|
24
|
+
select_source_files.each { |source| compile(source) }
|
24
25
|
|
25
26
|
Dir.chdir(site_directory) do
|
26
|
-
select_source_files.each { |source| compile(source) }
|
27
|
-
|
28
27
|
build_collection_file(collection_name)
|
29
28
|
convert_to_html_page(collection_name, "index.html")
|
30
29
|
end
|
@@ -41,6 +40,11 @@ module Metanorma
|
|
41
40
|
source_path
|
42
41
|
end
|
43
42
|
|
43
|
+
def default_config
|
44
|
+
default_file = Pathname.new(Dir.pwd).join("metanorma.yml")
|
45
|
+
default_file if File.exist?(default_file)
|
46
|
+
end
|
47
|
+
|
44
48
|
def select_source_files
|
45
49
|
files = source_from_manifest
|
46
50
|
|
@@ -67,7 +71,7 @@ module Metanorma
|
|
67
71
|
UI.info("Compiling #{source} ...")
|
68
72
|
|
69
73
|
Metanorma::Cli::Compiler.compile(
|
70
|
-
source.to_s, format: :asciidoc, "output-dir" =>
|
74
|
+
source.to_s, format: :asciidoc, "output-dir" => asset_directory
|
71
75
|
)
|
72
76
|
end
|
73
77
|
|
data/lib/metanorma/cli/ui.rb
CHANGED
data/metanorma-cli.gemspec
CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_development_dependency "sassc"
|
38
38
|
|
39
39
|
spec.add_runtime_dependency "thor", "~> 1.0"
|
40
|
-
spec.add_runtime_dependency "metanorma-iso", "~> 1.
|
40
|
+
spec.add_runtime_dependency "metanorma-iso", "~> 1.6.0"
|
41
41
|
spec.add_runtime_dependency "metanorma-ietf", "~> 2.2.0"
|
42
42
|
#spec.add_runtime_dependency "metanorma-gb", "~> 1.5.0"
|
43
43
|
spec.add_runtime_dependency "metanorma-iec", "~> 1.2.0"
|
@@ -46,15 +46,15 @@ Gem::Specification.new do |spec|
|
|
46
46
|
#spec.add_runtime_dependency 'metanorma-ribose', "~> 1.6.0"
|
47
47
|
spec.add_runtime_dependency "metanorma-m3aawg", "~> 1.6.0"
|
48
48
|
spec.add_runtime_dependency "metanorma-bipm", "~> 1.0.0"
|
49
|
-
spec.add_runtime_dependency "metanorma-generic", "~> 1.8.
|
50
|
-
spec.add_runtime_dependency "metanorma-standoc", "~> 1.
|
49
|
+
spec.add_runtime_dependency "metanorma-generic", "~> 1.8.2"
|
50
|
+
spec.add_runtime_dependency "metanorma-standoc", "~> 1.7.0"
|
51
51
|
#spec.add_runtime_dependency 'metanorma-mpfa', "~> 0.5.0"
|
52
52
|
spec.add_runtime_dependency "metanorma-un", "~> 0.5.0"
|
53
53
|
spec.add_runtime_dependency "metanorma-ogc", "~> 1.2.0"
|
54
54
|
spec.add_runtime_dependency "metanorma-nist", "~> 1.2.0"
|
55
55
|
spec.add_runtime_dependency "metanorma-itu", "~> 1.2.0"
|
56
56
|
spec.add_runtime_dependency "metanorma-iho", "~> 0.2.0"
|
57
|
-
spec.add_runtime_dependency "isodoc", ">= 1.
|
57
|
+
spec.add_runtime_dependency "isodoc", ">= 1.4.2"
|
58
58
|
spec.add_runtime_dependency "metanorma", "~> 1.2.0"
|
59
59
|
spec.add_runtime_dependency "git", "~> 1.5"
|
60
60
|
spec.add_runtime_dependency "relaton-cli", ">= 0.8.2"
|
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.4.
|
4
|
+
version: 1.4.1pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 1.
|
173
|
+
version: 1.6.0
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 1.
|
180
|
+
version: 1.6.0
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: metanorma-ietf
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -268,28 +268,28 @@ dependencies:
|
|
268
268
|
requirements:
|
269
269
|
- - "~>"
|
270
270
|
- !ruby/object:Gem::Version
|
271
|
-
version: 1.8.
|
271
|
+
version: 1.8.2
|
272
272
|
type: :runtime
|
273
273
|
prerelease: false
|
274
274
|
version_requirements: !ruby/object:Gem::Requirement
|
275
275
|
requirements:
|
276
276
|
- - "~>"
|
277
277
|
- !ruby/object:Gem::Version
|
278
|
-
version: 1.8.
|
278
|
+
version: 1.8.2
|
279
279
|
- !ruby/object:Gem::Dependency
|
280
280
|
name: metanorma-standoc
|
281
281
|
requirement: !ruby/object:Gem::Requirement
|
282
282
|
requirements:
|
283
283
|
- - "~>"
|
284
284
|
- !ruby/object:Gem::Version
|
285
|
-
version: 1.
|
285
|
+
version: 1.7.0
|
286
286
|
type: :runtime
|
287
287
|
prerelease: false
|
288
288
|
version_requirements: !ruby/object:Gem::Requirement
|
289
289
|
requirements:
|
290
290
|
- - "~>"
|
291
291
|
- !ruby/object:Gem::Version
|
292
|
-
version: 1.
|
292
|
+
version: 1.7.0
|
293
293
|
- !ruby/object:Gem::Dependency
|
294
294
|
name: metanorma-un
|
295
295
|
requirement: !ruby/object:Gem::Requirement
|
@@ -366,14 +366,14 @@ dependencies:
|
|
366
366
|
requirements:
|
367
367
|
- - ">="
|
368
368
|
- !ruby/object:Gem::Version
|
369
|
-
version: 1.
|
369
|
+
version: 1.4.2
|
370
370
|
type: :runtime
|
371
371
|
prerelease: false
|
372
372
|
version_requirements: !ruby/object:Gem::Requirement
|
373
373
|
requirements:
|
374
374
|
- - ">="
|
375
375
|
- !ruby/object:Gem::Version
|
376
|
-
version: 1.
|
376
|
+
version: 1.4.2
|
377
377
|
- !ruby/object:Gem::Dependency
|
378
378
|
name: metanorma
|
379
379
|
requirement: !ruby/object:Gem::Requirement
|
@@ -491,9 +491,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
491
491
|
version: 2.4.0
|
492
492
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
493
493
|
requirements:
|
494
|
-
- - "
|
494
|
+
- - ">"
|
495
495
|
- !ruby/object:Gem::Version
|
496
|
-
version:
|
496
|
+
version: 1.3.1
|
497
497
|
requirements: []
|
498
498
|
rubygems_version: 3.0.3
|
499
499
|
signing_key:
|