metanorma-cli 1.0.4 → 1.0.6

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: fc2a14d01f85755f7d20c4bdaaf1e09a6944bf7bc66e7de8607b01f3bfb8bde9
4
- data.tar.gz: 84d7355dd3a44d7a11990f140f9ee019e18b676cfc496f4331b3f382500acd45
3
+ metadata.gz: 869b7e9c0bfa656b994349015adf78547d09fba1661bc5405d775a92c27b1a5e
4
+ data.tar.gz: 24ed25e0c7e2554beb3bf3e701461c54530d2dce52fecc8ee995bd21718c2406
5
5
  SHA512:
6
- metadata.gz: 6967870f9d4a6dd22679af1a2cdeb9109d3ba52646a408543f88428387befbe7e9c0d429041704127a66a57893f2c9bbfeb1b6dc84bac7a6df42c961f5a161c8
7
- data.tar.gz: 7adda1f1ace2a8c49485aea4e40ed3eb51aae96a616ffbbef5df31455cb4b7fc8b64019935dfa3bacb657c9a6e3c05400037fb954694b5ec25d844667997d934
6
+ metadata.gz: a2e375473c24bad5f0c1ecc72adca40918dec83069c05bb94520270cd7545b9a7fc046973ea05e9ff8a730d86037d1914f16f211c68f9e25619b817b4267948d
7
+ data.tar.gz: 3bd6cb886ed1a6e40d7749f5fc3bf5cf8f50001b28c6c9bf5de8a23b070e1551c6dbdfef98a9b02551168fe4cd9a8bca495ad557369add9e6db318771eacf4fa
@@ -0,0 +1,3 @@
1
+ ruby:
2
+ Enabled: true
3
+ config_file: .rubocop.yml
@@ -3,13 +3,8 @@
3
3
  # All project-specific additions and overrides should be specified in this file.
4
4
 
5
5
  inherit_from:
6
- # Thoughtbot's style guide from: https://github.com/thoughtbot/guides
7
- - ".rubocop.tb.yml"
8
- # Overrides from Ribose
9
- - ".rubocop.ribose.yml"
6
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
10
7
  AllCops:
11
- DisplayCopNames: false
12
- StyleGuideCopsOnly: false
13
- TargetRubyVersion: 2.5
8
+ TargetRubyVersion: 2.3
14
9
  Rails:
15
10
  Enabled: true
@@ -148,6 +148,7 @@ unless options[:filename]
148
148
  exit 0
149
149
  end
150
150
 
151
+ filename = options[:filename]
151
152
  options[:extension_keys] = nil if options[:extension_keys] == [:all]
152
153
 
153
154
  case options[:format]
@@ -160,18 +161,32 @@ when :asciidoc
160
161
  if processor.output_formats[e]
161
162
  memo << e
162
163
  else
163
- warn "[metanorma] Error: #{e} format is not supported for this standard"
164
+ warn "[metanorma] Error: #{e} format is not supported for this standard."
164
165
  end
165
166
  memo
166
167
  end
167
168
  exit 0 if extensions.empty?
168
169
 
169
- file = File.read(options[:filename], encoding: "utf-8")
170
- isodoc = processor.input_to_isodoc(file, options[:filename])
170
+ file, isodoc = case extname = File.extname(filename)
171
+ when ".adoc"
172
+ puts "[metanorma] Processing: Asciidoctor input."
173
+ file = File.read(filename, encoding: "utf-8")
174
+ [file, processor.input_to_isodoc(file, filename)]
175
+ when ".xml"
176
+ puts "[metanorma] Processing: Metanorma XML input."
177
+
178
+ # TODO NN: this is a hack -- we should provide/bridge the
179
+ # document attributes in Metanorma XML
180
+
181
+ ["", File.read(filename, encoding: "utf-8")]
182
+ else
183
+ warn "[metanorma] Error: file extension #{extname} is not supported."
184
+ exit 1
185
+ end
171
186
 
172
187
  if options[:relaton]
173
188
  xml = Nokogiri::XML(isodoc)
174
- bibdata = xml.at("//xmlns:bibdata")
189
+ bibdata = xml.at("//bibdata") || xml.at("//xmlns:bibdata")
175
190
  # require "byebug"; byebug
176
191
  #docid = bibdata&.at("./xmlns:docidentifier")&.text || options[:filename]
177
192
  #outname = docid.sub(/^\s+/, "").sub(/\s+$/, "").gsub(/\s+/, "-") + ".xml"
@@ -191,5 +206,8 @@ when :asciidoc
191
206
  FileUtils.mv "#{outfilename}_images", outfilename
192
207
  end
193
208
  end
209
+ else
210
+ warn "[metanorma] Error: output format (#{options[:format]}) not supported."
211
+ exit 1
194
212
  end
195
213
 
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CLI
3
- VERSION = "1.0.4"
3
+ VERSION = "1.0.6"
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.4
4
+ version: 1.0.6
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-10-26 00:00:00.000000000 Z
11
+ date: 2018-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -287,6 +287,7 @@ extra_rdoc_files:
287
287
  - README.adoc
288
288
  - LICENSE
289
289
  files:
290
+ - ".hound.yml"
290
291
  - ".rubocop.ribose.yml"
291
292
  - ".rubocop.tb.yml"
292
293
  - ".rubocop.yml"