Class: Bookie::Emitters::MOBI
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
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/bookie/emitters.rb', line 85 def render(params) t = Tempfile.new(params[:file]) t << %{ <html> <head> <style type="text/css"> h1 { margin-bottom: 3em; font-size: xx-large } h2 { font-size: large } p { margin-bottom: 1.1em; text-indent: 0 } pre { font-size: xx-small } li { margin-bottom: 1.1em } ul { margin-top: 0em; margin-bottom: 0em;} </style> </head> <body><h1>#{params[:title]}</h1>#{@body}</body> </html> } t.close FileUtils.mv(t.path, "#{t.path}.html") `kindlegen #{t.path+'.html'} -o #{params[:file]}` FileUtils.mv("#{Dir.tmpdir}/#{params[:file]}", ".") end |