diff --git a/lib/review/epub2html.rb b/lib/review/epub2html.rb index 74e0896c9..4fcc41692 100644 --- a/lib/review/epub2html.rb +++ b/lib/review/epub2html.rb @@ -23,7 +23,12 @@ def self.execute(*args) new.execute(*args) end - def execute(*args) + def initialize + @opfxml = nil + @inline_footnote = nil + end + + def parse_options!(*args) opts = OptionParser.new opts.banner = <).*/m, '\1') - @tail = html.sub(%r{.*()}m, '\1') + head = html.sub(/().*/m, '\1') + tail = html.sub(%r{.*()}m, '\1') + + [head, tail] end def sanitize(s) @@ -142,16 +151,18 @@ def modify_html(fname, html) sub(%r{().*}m, '') end - def join_html(reffile) + def join_html(reffile, htmls) + head = tail = nil body = [] - make_list.each do |fname| - if @head.nil? && (reffile.nil? || reffile == fname) - take_headtail(@htmls[fname]) + make_list.each do |href_value| + fname = File.basename(href_value) + if head.nil? && (reffile.nil? || reffile == fname) + head, tail = take_headtail(htmls[fname]) end - body << modify_html(fname, @htmls[fname]) + body << modify_html(fname, htmls[fname]) end - "#{@head}\n#{body.join("\n")}\n#{@tail}" + "#{head}\n#{body.join("\n")}\n#{tail}" end def make_list