Sha256: 5fa8245d2d9e236524745256b8d7c0e35219153083b5608573ca79f52a12069f
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
require 'malt/formats/abstract' require 'malt/formats/html' require 'malt/formats/latex' require 'malt/engines/rdiscount' require 'malt/engines/bluecloth' module Malt::Format # If using the Kramdown engine, then Latex is also a supported output format. class Markdown < Abstract register('markdown', 'md') # def html(*) render_engine.render(:text=>text, :file=>file, :format=>:html) end # def latex(*) render_engine.render(:text=>text, :file=>file, :format=>:latex) end # def markdown(*) text end # alias_method :md, :markdown # Convert to HTML. def to_html(*) opts = options.merge(:text=>html, :file=>refile(:html), :type=>:html) HTML.new(opts) end # Latex is only supported by the Kramdown engine. def to_latex(*) opts = options.merge(:text=>html, :file=>refile(:latex), :type=>:latex) Latex.new(opts) end # def to_markdown(*) self end # alias_method :to_md, :to_markdown # #def render_to(to, *) # case to # when :markdown, :md # text # when :html # malt_engine.render_html(text, file) # when :txt # THINK: Does this make sense? # text # end #end private # def render_engine @render_engine ||= ( case engine when :bluecloth Malt::Engine::BlueCloth.new(options) when :kramdown Malt::Engine::Kramdown.new(options) else Malt::Engine::RDiscount.new(options) end ) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
malt-0.3.0 | lib/malt/formats/markdown.rb |
malt-0.2.0 | lib/malt/formats/markdown.rb |