bin/w2a in reverse_adoc-0.2.8 vs bin/w2a in reverse_adoc-0.2.9
- old
+ new
@@ -4,31 +4,31 @@
require 'rubygems'
require 'bundler/setup'
require 'word-to-markdown'
require 'optparse'
-require 'reverse_asciidoctor'
+require 'reverse_adoc'
ARGV.push('-h') if ARGV.empty?
OptionParser.new do |opts|
opts.banner = "Usage: w2a [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('-v', '--version', 'Version information') do |v|
- puts "reverse_adoc: v#{ReverseAsciidoctor::VERSION}"
+ puts "reverse_adoc: v#{ReverseAdoc::VERSION}"
puts "[dependency] WordToMarkdown: v#{WordToMarkdown::VERSION}"
unless Gem.win_platform?
puts "[dependency] LibreOffice: v#{WordToMarkdown.soffice.version}"
else
puts "[dependency] LibreOffice: version not available on Windows"
@@ -44,30 +44,30 @@
end.parse!
filename = ARGV.pop
raise "Please provide an input file to process. Exiting." unless filename
-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
-ReverseAsciidoctor.config.sourcedir = Dir.mktmpdir
+ReverseAdoc.config.sourcedir = Dir.mktmpdir
-doc = WordToMarkdown.new(filename, ReverseAsciidoctor.config.sourcedir)
+doc = WordToMarkdown.new(filename, ReverseAdoc.config.sourcedir)
#File.open("test.html", "w:UTF-8") { |f| f.write doc.document.html }
-adoc_content = ReverseAsciidoctor.convert(
- ReverseAsciidoctor.cleaner.preprocess_word_html(doc.document.html),
+adoc_content = ReverseAdoc.convert(
+ ReverseAdoc.cleaner.preprocess_word_html(doc.document.html),
WordToMarkdown::REVERSE_MARKDOWN_OPTIONS
)
# puts scrub_whitespace(doc.document.html)
# 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