css_file = nil
otf_files = []
customization_layer = nil
+output_file = nil
# Set up the OptionParser
opts = OptionParser.new
opts.on("-d", "--debug", "Show debugging output.") {debug = true; verbose = true}
opts.on("-f", "--font [OTF FILE]", "Embed OTF FILE in .epub.") {|f| otf_files << f}
opts.on("-h", "--help", "Display usage info.") {puts opts.to_s; exit 0}
+opts.on("-o", "--output [OUTPUT FILE]", "Output ePub file as OUTPUT FILE.") {|f| output_file = f}
opts.on("-s", "--stylesheet [XSL FILE]", "Use XSL FILE as a customization layer (imports epub/docbook.xsl).") {|f| customization_layer = f}
opts.on("-v", "--verbose", "Make output verbose.") {verbose = true}
db_files.each {|docbook_file|
dir = File.expand_path(File.join(Dir.tmpdir, ".epubtmp#{Time.now.to_f.to_s}"))
e = DocBook::Epub.new(docbook_file, dir, css_file, customization_layer, otf_files)
- epub_file = File.basename(docbook_file, ".xml") + ".epub"
+
+ if output_file
+ epub_file = output_file
+ else
+ epub_file = File.basename(docbook_file, ".xml") + ".epub"
+ end
puts "Rendering DocBook file #{docbook_file} to #{epub_file}" if verbose
e.render_to_file(epub_file)
}