Class: Bookbinder::Package::EPUB

Inherits:
Bookbinder::Package show all
Defined in:
lib/bookbinder/package/epub.rb

Constant Summary collapse

DEFAULT_TRANSFORMS =
[
  Bookbinder::Transform::EPUB_PackageIdentifier,
  Bookbinder::Transform::EPUB_Title,
  Bookbinder::Transform::EPUB_Creator,
  Bookbinder::Transform::EPUB_Contributor,
  Bookbinder::Transform::EPUB_Language,
  Bookbinder::Transform::EPUB_CoverImage,
  Bookbinder::Transform::EPUB_Description,
  Bookbinder::Transform::EPUB_Version,
  Bookbinder::Transform::EPUB_Spine,
  Bookbinder::Transform::EPUB_Resources,
  Bookbinder::Transform::EPUB_NavToc,
  Bookbinder::Transform::EPUB_CoverPage,
  Bookbinder::Transform::EPUB_Rendition,
  Bookbinder::Transform::EPUB_AudioOverlay,
  Bookbinder::Transform::Organizer,
  Bookbinder::Transform::Generator
]
DEFAULT_CONTENT_ROOT =
'EPUB'

Instance Attribute Summary

Attributes inherited from Bookbinder::Package

#content_root, #file_aliases, #file_system, #map, #options, #warnings

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Bookbinder::Package

#all_book_content, #apply_transform, build, #build, #copy_to, #export, #file, #file_path, #from_map, #if_file, #import, #initialize, #read, read, require_transforms, #reset_transforms, #save_open_files, #to_map, #warn, #write

Constructor Details

This class inherits a constructor from Bookbinder::Package

Class Method Details

.recognize(path) ⇒ Object



27
28
29
30
31
32
# File 'lib/bookbinder/package/epub.rb', line 27

def self.recognize(path)
  return (
    File.extname(path).downcase == '.epub' ||
    File.directory?(File.join(path, 'META-INF'))
  )
end

.transformsObject



35
36
37
# File 'lib/bookbinder/package/epub.rb', line 35

def self.transforms
  @transforms = DEFAULT_TRANSFORMS
end

Instance Method Details

#make_href(path) ⇒ Object



55
56
57
# File 'lib/bookbinder/package/epub.rb', line 55

def make_href(path)
  CGI.escape(path)
end

#make_id(path) ⇒ Object



45
46
47
# File 'lib/bookbinder/package/epub.rb', line 45

def make_id(path)
  path.gsub(/[^\w]/, '-')
end

#make_path(href) ⇒ Object



50
51
52
# File 'lib/bookbinder/package/epub.rb', line 50

def make_path(href)
  CGI.unescape(href)
end

#transformsObject



40
41
42
# File 'lib/bookbinder/package/epub.rb', line 40

def transforms
  self.class.transforms
end