Sha256: 5adb64e9b32c18f58f5f4f85ac7fbe52113c0b12b065cc2c43c04b41ed2df696

Contents?: true

Size: 483 Bytes

Versions: 1

Compression:

Stored size: 483 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|
        {'label' =>(navpoint % 'navLabel/text').content , 'path' => (navpoint % 'content').attr('src')}
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
epubinfo_with_toc-0.5.0 lib/epubinfo/models/table_of_contents/navigation.rb