Class: BbEPUB::Transform::Nav

Inherits:
Bookbinder::Transform
  • Object
show all
Defined in:
lib/bb-epub/transform/nav.rb

Constant Summary collapse

DEFAULT_FILE_NAME =
'book-nav.xhtml'

Instance Method Summary collapse

Instance Method Details

#dependenciesObject



5
6
7
# File 'lib/bb-epub/transform/nav.rb', line 5

def dependencies
  [BbEPUB::Transform::Resources]
end

#from_map(package) ⇒ Object



22
23
24
25
26
27
# File 'lib/bb-epub/transform/nav.rb', line 22

def from_map(package)
  if package.options['nav_file'] != false
    stub_nav(package)
    add_to_opf_manifest(package)
  end
end

#to_map(package) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/bb-epub/transform/nav.rb', line 10

def to_map(package)
  opf_doc = package.file(:opf).document('r')
  if nav_item = opf_doc.find('opf|manifest > opf|item[properties~="nav"]')
    nav_path = package.make_path(nav_item['href'])
    package.file_aliases[:nav] = nav_path
    package.map['resources'].delete_if { |rsrc|
      package.file_path(rsrc['path']) == nav_path
    }
  end
end