Class: BbEPUB::Transform::NCX
- Inherits:
-
Bookbinder::Transform
- Object
- Bookbinder::Transform
- BbEPUB::Transform::NCX
- Defined in:
- lib/bb-epub/transform/ncx.rb
Constant Summary collapse
- DEFAULT_FILE_NAME =
'book.ncx'
Instance Method Summary collapse
Instance Method Details
#dependencies ⇒ Object
6 7 8 |
# File 'lib/bb-epub/transform/ncx.rb', line 6 def dependencies [BbEPUB::Transform::Resources] end |
#from_map(package) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/bb-epub/transform/ncx.rb', line 25 def from_map(package) if package.['ncx_file'] != false stub_ncx(package) add_to_opf_manifest(package) end end |
#to_map(package) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/bb-epub/transform/ncx.rb', line 11 def to_map(package) opf_doc = package.file(:opf).document('r') spine = opf_doc.find('opf|spine') if spine && ncx_id = spine['toc'] ncx_item = opf_doc.find('opf|manifest > opf|item[id="'+ncx_id+'"]') ncx_path = package.make_path(ncx_item['href']) package.file_aliases[:ncx] = ncx_path package.map['resources'].delete_if { |rsrc| package.file_path(rsrc['path']) == ncx_path } end end |