Sha256: 0c17463cd51de6c8f6c2c3f7b22d8661c2c4192f020464477f9c6ee56c6351e7
Contents?: true
Size: 1.06 KB
Versions: 9
Compression:
Stored size: 1.06 KB
Contents
require 'epub/content_document' module EPUB module ContentDocument class Navigation def to_xml(options={:encoding => 'UTF-8'}) Nokogiri::XML::Builder.new(options) {|xml| xml.html('xmlns' => EPUB::NAMESPACES['xhtml'], 'xmlns:epub' => EPUB::NAMESPACES['epub']) { xml.head { xml.title_ 'Table of Contents' } xml.body { navigations.each do |navigation| xml.nav_('epub:type' => navigation.type) { unless navigation.items.empty? xml.ol { navigation.items.each do |item| xml.li { if item.href xml.a item.text, 'href' => item.href else xml.span_ item.text end } end } end } end } } }.to_xml end end end end
Version data entries
9 entries across 9 versions & 1 rubygems