Sha256: 60e70254d6f24beeb8cc5f2eb7dade259519ed63d202e5eb58911d85ee1d047f

Contents?: true

Size: 703 Bytes

Versions: 5

Compression:

Stored size: 703 Bytes

Contents

module Rpub
  class Epub
    class Cover < XmlFile
      attr_reader :book

      def initialize(book)
        @book = book
        super()
      end

      def render
        xml.declare! :DOCTYPE, :html, :PUBLIC, '-//W3C//DTD XHTML 1.0 Strict//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'
        xml.html :xmlns => 'http://www.w3.org/1999/xhtml' do
          xml.head do
            xml.title 'Cover'
            xml.style 'img { max-width: 100%; }', :type => 'text/css'
          end
          xml.body do
            xml.div :id => 'cover-image' do
              xml.img :src => book.cover_image, :alt => book.title
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rpub-0.4.0 lib/rpub/epub/cover.rb
rpub-0.3.0 lib/rpub/epub/cover.rb
rpub-0.2.1 lib/rpub/epub/cover.rb
rpub-0.2.0 lib/rpub/epub/cover.rb
rpub-0.1.0 lib/rpub/epub/cover.rb