Class: Bookie::Emitters::EPUB
Instance Attribute Summary
Attributes inherited from HTML
Instance Method Summary collapse
Methods inherited from HTML
#build_list, #build_paragraph, #build_raw_text, #build_section_heading, #initialize
Constructor Details
This class inherits a constructor from Bookie::Emitters::HTML
Instance Method Details
#render(params) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/bookie/emitters.rb', line 55 def render(params) t = Tempfile.new(params[:file]) t << %{<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <style type="text/css"> pre { font-size: 1.1em } </style> </head> <body><h1>#{params[:title]}</h1>#{@body}</body> </html> } t.close FileUtils.mv(t.path, "#{t.path}.html") epub = EeePub.make do title params[:title] identifier '', :scheme => 'URL' uid '' files [File.("#{t.path}.html")] end epub.save(params[:file]) end |