bin/est in est-0.1 vs bin/est in est-0.2
- old
+ new
@@ -46,11 +46,11 @@
argument: :required
)
on(
't',
'format',
- 'Format to use (xml|html)',
+ 'Format to use (xml|html|text)',
argument: :required
)
end
fail '-f is mandatory when using -v' if opts.verbose? && !opts.file?
@@ -67,18 +67,25 @@
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
file = opts.file? ? File.new(opts[:file], 'w') : STDOUT
output = Est::Base.new(opts).xml
-if opts[:format]
- if opts[:format] == 'html'
- xslt = File.join(
- File.dirname(File.dirname(__FILE__)),
- 'assets', 'est.xsl'
- )
- output = Nokogiri::XSLT(File.read(xslt)).transform(Nokogiri::XML(output))
- else
- fail 'invalid format, use html or xml' if opts[:format] != 'xml'
- end
- output
+if opts[:format].nil? || opts[:format] == 'text'
+ xslt = File.join(
+ File.dirname(File.dirname(__FILE__)),
+ 'assets', 'est-text.xsl'
+ )
+ output = Nokogiri::XSLT(File.read(xslt)).transform(Nokogiri::XML(output))
+elsif opts[:format] == 'html'
+ Est.log.info 'using HTML format'
+ xslt = File.join(
+ File.dirname(File.dirname(__FILE__)),
+ 'assets', 'est.xsl'
+ )
+ output = Nokogiri::XSLT(File.read(xslt)).transform(Nokogiri::XML(output))
+elsif opts[:format] == 'xml'
+ Est.log.info 'using XML format'
+else
+ fail 'invalid format, use html, text, or xml'
end
file << output
+Est.log.info "output saved into #{file}"