Class: Epuber::Compiler::MetaInfGenerator

Inherits:
Generator
  • Object
show all
Defined in:
lib/epuber/compiler/meta_inf_generator.rb

Instance Attribute Summary

Attributes inherited from Generator

#compilation_context

Instance Method Summary collapse

Methods inherited from Generator

#initialize

Constructor Details

This class inherits a constructor from Epuber::Compiler::Generator

Instance Method Details

#generate_container_xmlNokogiri::XML::Document

Returns:

  • (Nokogiri::XML::Document)


14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/epuber/compiler/meta_inf_generator.rb', line 14

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.is_a?(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

#generate_ibooks_display_options_xmlObject

Returns nil.

Returns:

  • nil



29
30
31
32
33
34
35
36
37
38
# File 'lib/epuber/compiler/meta_inf_generator.rb', line 29

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