Sha256: ba38ef099985eab19d5cb8e3024dcfda07728e856edbb90ce923f7f75d5d3a0f

Contents?: true

Size: 1.15 KB

Versions: 22

Compression:

Stored size: 1.15 KB

Contents

# encoding: utf-8

require 'mime-types'

require_relative 'generator'
require_relative '../book/file_request'


module Epuber
  class Compiler
    class MetaInfGenerator < Generator
      # @return [Nokogiri::XML::Document]
      #
      def generate_container_xml
        generate_xml do |xml|
          xml.container(version: 1.0, xmlns: 'urn:oasis:names:tc:opendocument:xmlns:container') do
            xml.rootfiles do
              @file_resolver.package_files.select { |file| file.kind_of?(FileTypes::OPFFile) }.each do |file|
                path = file.pkg_destination_path
                xml.rootfile('full-path' => path, 'media-type' => MIME::Types.of(path).first.content_type)
              end
            end
          end
        end
      end

      # @return nil
      #
      def generate_ibooks_display_options_xml
        generate_xml do |xml|
          xml.display_options do
            xml.platform(name: '*') do
              xml.option(true.to_s, name: 'specified-fonts') if @target.custom_fonts
              xml.option(true.to_s, name: 'fixed-layout') if @target.fixed_layout
            end
          end
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
epuber-0.6.0 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.5.7 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.5.6 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.5.5 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.5.4 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.5.3 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.5.2 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.5.1 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.5.0 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.5.0.beta.5 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.5.0.beta.4 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.5.0.beta.3 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.5.0.beta.2 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.5.0.beta lib/epuber/compiler/meta_inf_generator.rb
epuber-0.4.0 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.3.12 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.3.11 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.3.10 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.3.9 lib/epuber/compiler/meta_inf_generator.rb
epuber-0.3.7 lib/epuber/compiler/meta_inf_generator.rb