Class: Verku::TOC::Epub
- Inherits:
-
Object
- Object
- Verku::TOC::Epub
- Defined in:
- lib/verku/toc/epub.rb
Instance Attribute Summary collapse
-
#navigation ⇒ Object
Returns the value of attribute navigation.
Instance Method Summary collapse
-
#initialize(navigation) ⇒ Epub
constructor
A new instance of Epub.
- #template ⇒ Object
- #to_html ⇒ Object
Constructor Details
#initialize(navigation) ⇒ Epub
Returns a new instance of Epub.
6 7 8 |
# File 'lib/verku/toc/epub.rb', line 6 def initialize() = end |
Instance Attribute Details
#navigation ⇒ Object
Returns the value of attribute navigation.
4 5 6 |
# File 'lib/verku/toc/epub.rb', line 4 def end |
Instance Method Details
#template ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/verku/toc/epub.rb', line 14 def template " <?xml version=\"1.0\" encoding=\"utf-8\" ?>\n <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n <html xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"epub.css\"/>\n <meta http-equiv=\"Content-Type\" content=\"application/xhtml+xml; charset=utf-8\" />\n <title>Table of Contents</title>\n </head>\n <body>\n <div id=\"toc\">\n <ul>\n <% navigation.each do |nav| %>\n <li>\n <a href=\"<%= nav[:content] %>\"><%= nav[:label] %></a>\n </li>\n <% end %>\n </ul>\n </div>\n </body>\n </html>\n HTML\nend\n".strip_heredoc.force_encoding("utf-8") |
#to_html ⇒ Object
10 11 12 |
# File 'lib/verku/toc/epub.rb', line 10 def to_html ERB.new(template).result OpenStruct.new(:navigation => ).instance_eval{ binding } end |