Top Level Namespace
Instance Method Summary collapse
Instance Method Details
#content_of(filename) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/markdown_presenter.rb', line 14 def content_of filename if filename.end_with? ".md" Kramdown::Document.new(File.read(filename)).to_html elsif filename.end_with? ".html" File.read(filename) else $stderr.puts "Format not supported: #{File.extname(filename)}" exit 1 end end |
#present(title, content) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/markdown_presenter.rb', line 6 def present title, content template = File.read(File.join(File.dirname(__FILE__), "../presenter.html.haml")) haml_engine = Haml::Engine.new(template) haml_engine.render(Object.new, {slides: content.split(/(?=<h1)/), title: title}) do |filename| File.read File.join(File.dirname(__FILE__), "../", filename) end end |
#process(filename) ⇒ Object
27 28 29 |
# File 'lib/markdown_presenter.rb', line 27 def process filename puts present(filename, content_of(filename)) end |