bin/review-epubmaker-ng in review-1.0.0 vs bin/review-epubmaker-ng in review-1.1.0

- old
+ new

@@ -10,31 +10,22 @@ # require 'pathname' bindir = Pathname.new(__FILE__).realpath.dirname $LOAD_PATH.unshift((bindir + '../lib').realpath) +require 'review' require 'epubmaker' include EPUBMaker def main if ARGV.size != 1 puts "Usage: #{$0} configfile" exit 0 end - - @params = { # These parameters can be overridden by YAML file. - "bookname" => "example", # Book file - "title" => "example", # Book title - "params" => "", # specify review2html parameters - "epubversion" => 2,# EPUB version - "toclevel" => 3, # level of toc - "secnolevel" => 2, # level of section # - "posthook" => nil, # command path of post hook - "debug" => nil, # debug flag - } - + yamlfile = ARGV[0] + @params = ReVIEW::Configure.values.merge(YAML.load_file(yamlfile)) @epub = Producer.new(@params) @epub.load(yamlfile) @params = @epub.params bookname = @params["bookname"] @@ -50,17 +41,17 @@ basetmp = Dir.mktmpdir FileUtils.cp(@params["cover"], "#{basetmp}/#{@params["cover"]}") if !@params["cover"].nil? && File.exist?(@params["cover"]) - unless @params["titlepage"].nil? # FIXME + if @params["titlepage"] # FIXME FileUtils.cp(@params["titlepage"], "#{basetmp}/#{@params["titlepage"]}") @epub.contents.push(Content.new("id" => "title", "file" => @params["titlepage"], "title" => @epub.res.v("titlepagetitle"))) end makeBody(basetmp, yamlfile) - unless @params["colophon"].nil? + if @params["colophon"] if @params["colophon"].instance_of?(String) FileUtils.cp(@params["colophon"], "#{basetmp}/colophon.#{@params["htmlext"]}") else File.open("#{basetmp}/colophon.#{@params["htmlext"]}", "w") {|f| @epub.colophon(f) } end