# encoding: utf-8
# = epubv2.rb -- EPUB version 2 producer.
#
# Copyright (c) 2010-2012 Kenshi Muto and Masayoshi Takahashi
#
# This program is free software.
# You can distribute or modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.
# For details of the GNU LGPL, see the file "COPYING".
#
require 'epubmaker/producer'
require 'cgi'
module EPUBMaker
# EPUBv2 is EPUB version 2 producer.
class EPUBv2
# Construct object with parameter hash +params+ and message resource hash +res+.
def initialize(producer)
@producer = producer
end
# Return mimetype content.
def mimetype
return "application/epub+zip"
end
# Return opf file content.
def opf
s = <
EOT
end
s << <
#{CGI.escapeHTML(@producer.params["title"])}
EOT
if @producer.params["aut"]
s << <
#{CGI.escapeHTML(@producer.params["title"])}
EOT if @producer.params["pubhistory"] s << %Q[#{@producer.params["pubhistory"].gsub(/\n/, "
")}
#{@producer.res.v("c-aut")} | #{CGI.escapeHTML(@producer.params["aut"])} |
---|---|
#{@producer.res.v("c-dsr")} | #{CGI.escapeHTML(@producer.params["dsr"])} |
#{@producer.res.v("c-ill")} | #{CGI.escapeHTML(@producer.params["ill"])} |
#{@producer.res.v("c-edt")} | #{CGI.escapeHTML(@producer.params["edt"])} |
#{@producer.res.v("c-prt")} | #{CGI.escapeHTML(@producer.params["prt"])} |