metanorma-cli 1.0.7 → 1.0.8
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/exe/metanorma +24 -21
- data/lib/metanorma-cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e411380736fee742c26d90327890a42550014248b05591221cb176dabe401a12
|
|
4
|
+
data.tar.gz: 57ecf918537b0632be30d5b8dc2dfc5cee5e66a3879d519095d97cbd2cd8ef8e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 465dd38bd86b4052bb8b696006cb22d0df13f0b567528ca374c520b523927b118bdca8a597afd526ac34b3122d30f1c31d6d6b63a968ba18030044b375ba3fd7
|
|
7
|
+
data.tar.gz: cbbb08fa9bf2aa18d1221d82cc9534c6c989de532f838cb79d00ebdba7761dd003b3530a58d13ce4e16f42567dd09e379ac906101b8e9251b0a271c67114dd7e
|
data/exe/metanorma
CHANGED
|
@@ -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
|
-
|
|
149
|
-
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
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)
|
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
|
+
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-
|
|
11
|
+
date: 2018-11-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|