bin/reverse_adoc in reverse_adoc-0.2.8 vs bin/reverse_adoc in reverse_adoc-0.2.9
- old
+ new
@@ -1,40 +1,40 @@
#!/usr/bin/env ruby
-# Usage: reverse_asciidoctor [FILE]...
-# Usage: cat FILE | reverse_asciidoctor
+# Usage: reverse_adoc [FILE]...
+# Usage: cat FILE | reverse_adoc
require 'rubygems'
require 'bundler/setup'
-require 'reverse_asciidoctor'
+require 'reverse_adoc'
require 'optparse'
require 'fileutils'
OptionParser.new do |opts|
opts.banner = "Usage: reverse_adoc [options] <file>"
opts.on('-m', '--mathml2asciimath', 'Convert MathML to AsciiMath') do |v|
- ReverseAsciidoctor.config.mathml2asciimath = true
+ ReverseAdoc.config.mathml2asciimath = true
end
opts.on('-oFILENAME', '--output=FILENAME', 'Output file to write to') do |v|
- ReverseAsciidoctor.config.destination = File.expand_path(v)
- # puts "output goes to #{ReverseAsciidoctor.config.destination}"
+ ReverseAdoc.config.destination = File.expand_path(v)
+ # puts "output goes to #{ReverseAdoc.config.destination}"
end
opts.on('-e', '--external-images', 'Export images if data URI') do |v|
- ReverseAsciidoctor.config.external_images = true
+ ReverseAdoc.config.external_images = true
end
opts.on('-f', '--input_format [html, smrl_description]', 'Unknown input format (default: html)') do |v|
- ReverseAsciidoctor.config.input_format = v
+ ReverseAdoc.config.input_format = v
end
opts.on('-u', '--unknown_tags [pass_through, drop, bypass, raise]', 'Unknown tag handling (default: pass_through)') do |v|
- ReverseAsciidoctor.config.unknown_tags = v
+ ReverseAdoc.config.unknown_tags = v
end
opts.on('-v', '--version', 'Version information') do |v|
- puts "reverse_adoc: v#{ReverseAsciidoctor::VERSION}"
+ puts "reverse_adoc: v#{ReverseAdoc::VERSION}"
exit
end
opts.on("-h", "--help", "Prints this help") do
puts opts
@@ -43,32 +43,32 @@
end.parse!
if filename = ARGV.pop
input_content = IO.read(filename)
- ReverseAsciidoctor.config.sourcedir = File.dirname(File.expand_path(filename))
+ ReverseAdoc.config.sourcedir = File.dirname(File.expand_path(filename))
else
- if ReverseAsciidoctor.config.external_images
+ if ReverseAdoc.config.external_images
raise "The -e | --external-images feature cannot be used with STDIN input. Exiting."
end
input_content = ARGF.read
end
-if ReverseAsciidoctor.config.external_images && ReverseAsciidoctor.config.destination.nil?
+if ReverseAdoc.config.external_images && ReverseAdoc.config.destination.nil?
raise "The -e | --external-images feature must be used with -o | --output. Exiting."
end
# Read from STDIN
-adoc_content = ReverseAsciidoctor.convert(input_content)
+adoc_content = ReverseAdoc.convert(input_content)
# Print to STDOUT
-unless ReverseAsciidoctor.config.destination
+unless ReverseAdoc.config.destination
puts adoc_content
exit
end
-# Write output to ReverseAsciidoctor.config.destination
-FileUtils.mkdir_p(File.dirname(ReverseAsciidoctor.config.destination))
-File.open(ReverseAsciidoctor.config.destination, "w") do |file|
+# Write output to ReverseAdoc.config.destination
+FileUtils.mkdir_p(File.dirname(ReverseAdoc.config.destination))
+File.open(ReverseAdoc.config.destination, "w") do |file|
file.write(adoc_content)
end