Class: Middleman::Renderers::RedcarpetTemplate
- Inherits:
-
Tilt::RedcarpetTemplate::Redcarpet2
- Object
- Tilt::RedcarpetTemplate::Redcarpet2
- Middleman::Renderers::RedcarpetTemplate
- Defined in:
- lib/middleman-core/renderers/redcarpet.rb
Constant Summary collapse
- ALIASES =
because tilt has decided to convert these in the wrong direction
{ :escape_html => :filter_html }
Instance Method Summary collapse
-
#generate_renderer ⇒ Object
Overwrite built-in Tilt version.
Instance Method Details
#generate_renderer ⇒ Object
Overwrite built-in Tilt version. Don’t overload :renderer option with smartypants Support renderer-level options
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/middleman-core/renderers/redcarpet.rb', line 17 def generate_renderer return .delete(:renderer) if .has_key?(:renderer) # Pick a renderer renderer = MiddlemanRedcarpetHTML # Support SmartyPants if .delete(:smartypants) renderer = Class.new(renderer) do include ::Redcarpet::Render::SmartyPants end end # Renderer Options possible_render_opts = [:filter_html, :no_images, :no_links, :no_styles, :safe_links_only, :with_toc_data, :hard_wrap, :xhtml, :prettify, :link_attributes] = possible_render_opts.inject({}) do |sum, opt| sum[opt] = .delete(opt) if .has_key?(opt) sum end renderer.new() end |