metanorma-cli 1.0.7 → 1.0.8

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: b8362b593a3fa5d9ae32fa4fde6895d3c6fba7db68baf66a2155da96b5852fd8
4
- data.tar.gz: c82f7076d2281e73327ad4f846f66bdf4f92658f2428811df5d1ffed682b3d21
3
+ metadata.gz: e411380736fee742c26d90327890a42550014248b05591221cb176dabe401a12
4
+ data.tar.gz: 57ecf918537b0632be30d5b8dc2dfc5cee5e66a3879d519095d97cbd2cd8ef8e
5
5
  SHA512:
6
- metadata.gz: e76c42bc586d880a65c05d9a288ffec11d507ec92adb46920581916449574df860a3c3375bec0429d33f5b8c906c41269fb01d8269d386f641053b6627824490
7
- data.tar.gz: b7760bad2badd9bfc558f67033c728b79986ed77f18c2ef8ae0bb51a4b3bb64761fd2234529109c74046753c2e506b2149fc0b9cf109083935e51001bd0bab30
6
+ metadata.gz: 465dd38bd86b4052bb8b696006cb22d0df13f0b567528ca374c520b523927b118bdca8a597afd526ac34b3122d30f1c31d6d6b63a968ba18030044b375ba3fd7
7
+ data.tar.gz: cbbb08fa9bf2aa18d1221d82cc9534c6c989de532f838cb79d00ebdba7761dd003b3530a58d13ce4e16f42567dd09e379ac906101b8e9251b0a271c67114dd7e
@@ -115,6 +115,13 @@ end
115
115
 
116
116
  options[:filename] = ARGV.pop
117
117
 
118
+ unless options[:filename]
119
+ puts "[metanorma] Error: Need to specify a file to process."
120
+ exit 0
121
+ end
122
+
123
+ filename = options[:filename]
124
+ options[:type] ||= registry&.find_processor(:iso)&.extract_metanorma_options(File.read(filename, encoding: "utf-8"))[:type]&.to_sym
118
125
  standard_type = options[:type]
119
126
  unless standard_type
120
127
  puts "[metanorma] Error: Please specify a standard type."
@@ -145,12 +152,8 @@ unless options[:format] == :asciidoc
145
152
  exit 0
146
153
  end
147
154
 
148
- unless options[:filename]
149
- puts "[metanorma] Error: Need to specify a file to process."
150
- exit 0
151
- end
152
-
153
- filename = options[:filename]
155
+ options[:extension_keys] ||= registry&.find_processor(:iso)&.
156
+ extract_metanorma_options(File.read(filename, encoding: "utf-8"))[:extensions]&.split(/,[ ]*/)&.map(&:to_sym)
154
157
  options[:extension_keys] = nil if options[:extension_keys] == [:all]
155
158
 
156
159
  case options[:format]
@@ -170,21 +173,21 @@ when :asciidoc
170
173
  exit 0 if extensions.empty?
171
174
 
172
175
  file, isodoc = case extname = File.extname(filename)
173
- when ".adoc"
174
- puts "[metanorma] Processing: Asciidoctor input."
175
- file = File.read(filename, encoding: "utf-8")
176
- [file, processor.input_to_isodoc(file, filename)]
177
- when ".xml"
178
- puts "[metanorma] Processing: Metanorma XML input."
179
-
180
- # TODO NN: this is a hack -- we should provide/bridge the
181
- # document attributes in Metanorma XML
182
-
183
- ["", File.read(filename, encoding: "utf-8")]
184
- else
185
- warn "[metanorma] Error: file extension #{extname} is not supported."
186
- exit 1
187
- end
176
+ when ".adoc"
177
+ puts "[metanorma] Processing: Asciidoctor input."
178
+ file = File.read(filename, encoding: "utf-8")
179
+ [file, processor.input_to_isodoc(file, filename)]
180
+ when ".xml"
181
+ puts "[metanorma] Processing: Metanorma XML input."
182
+
183
+ # TODO NN: this is a hack -- we should provide/bridge the
184
+ # document attributes in Metanorma XML
185
+
186
+ ["", File.read(filename, encoding: "utf-8")]
187
+ else
188
+ warn "[metanorma] Error: file extension #{extname} is not supported."
189
+ exit 1
190
+ end
188
191
 
189
192
  if options[:relaton]
190
193
  xml = Nokogiri::XML(isodoc)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CLI
3
- VERSION = "1.0.7"
3
+ VERSION = "1.0.8"
4
4
  end
5
5
  end
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.7
4
+ version: 1.0.8
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-13 00:00:00.000000000 Z
11
+ date: 2018-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler