Sha256: 00939e5a4c1052bf8ca231291b1ca7fa80cc2ac977b883a4a22111b04fe949df

Contents?: true

Size: 542 Bytes

Versions: 5

Compression:

Stored size: 542 Bytes

Contents

class Navigation
  def initialize(table_of_contents)
    @table_of_contents = table_of_contents
  end

  def path
    @table_of_contents.path
  end

  def nav_map
    ncx_doc = Nokogiri::XML(@table_of_contents.parser.zip_file.read(path))
    ncx_doc.remove_namespaces!

    if ncx_doc
      #map = ncx_doc.xpath('//navMap/navPoint').map do |navpoint|
      map = ncx_doc.xpath('//navPoint').map do |navpoint|
        {'label' =>(navpoint % 'navLabel/text').content , 'path' => (navpoint % 'content').attr('src')}
      end
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
epubinfo_with_toc-0.5.7 lib/epubinfo/models/table_of_contents/navigation.rb
epubinfo_with_toc-0.5.6 lib/epubinfo/models/table_of_contents/navigation.rb
epubinfo_with_toc-0.5.5 lib/epubinfo/models/table_of_contents/navigation.rb
epubinfo_with_toc-0.5.4 lib/epubinfo/models/table_of_contents/navigation.rb
epubinfo_with_toc-0.5.2 lib/epubinfo/models/table_of_contents/navigation.rb