Module: Pubgen::NCX
- Defined in:
- lib/pubgen/ncx.rb
Defined Under Namespace
Classes: NavPointImpl
Class Method Summary collapse
-
.generate(title, toc, uuid) ⇒ Object
Generates the NCX XML.
Class Method Details
.generate(title, toc, uuid) ⇒ Object
Generates the NCX XML.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pubgen/ncx.rb', line 4 def self.generate(title, toc, uuid) # header toc_xml = <<EOF <?xml version='1.0' encoding='utf-8'?> <ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1" \ xml:lang="en"> <head> <meta content="#{uuid}" name="dtb:uid"/> <meta content="2" name="dtb:depth"/> <meta content="pubgen" name="dtb:generator"/> <meta content="0" name="dtb:totalPageCount"/> <meta content="0" name="dtb:maxPageNumber"/> </head> <docTitle> <text>#{CGI.escapeHTML(title || '')}</text> </docTitle> <navMap> EOF # NavPoint traces indentation, so we need class and instantiation of it nav_point = NavPointImpl.new toc.each do |name_and_path| toc_xml << nav_point.generate(name_and_path) end # footer toc_xml << " </navMap>\n</ncx>" end |