Merge pull request #663 from alexpeattie/slim-redcarpet-fix
Fix for embedded Markdown in Slim w/ Redcarpet
This commit is contained in:
commit
434895be0c
|
@ -5,6 +5,14 @@ module Middleman
|
|||
|
||||
class RedcarpetTemplate < ::Tilt::RedcarpetTemplate::Redcarpet2
|
||||
|
||||
def initialize(*args, &block)
|
||||
super
|
||||
|
||||
if @options.has_key?(:context)
|
||||
@context = @options[:context]
|
||||
end
|
||||
end
|
||||
|
||||
# Overwrite built-in Tilt version.
|
||||
# Don't overload :renderer option with smartypants
|
||||
# Support renderer-level options
|
||||
|
@ -32,9 +40,11 @@ module Middleman
|
|||
renderer.new(render_options)
|
||||
end
|
||||
|
||||
def evaluate(scope, locals, &block)
|
||||
def evaluate(context, locals, &block)
|
||||
@context ||= context
|
||||
|
||||
if @engine.renderer.respond_to? :middleman_app=
|
||||
@engine.renderer.middleman_app = scope
|
||||
@engine.renderer.middleman_app = @context
|
||||
end
|
||||
super
|
||||
end
|
||||
|
|
|
@ -23,11 +23,12 @@ module Middleman
|
|||
)
|
||||
|
||||
app.after_configuration do
|
||||
sass_context_hack = {
|
||||
context_hack = {
|
||||
:context => self
|
||||
}
|
||||
::Slim::EmbeddedEngine.default_options[:sass] = sass_context_hack
|
||||
::Slim::EmbeddedEngine.default_options[:scss] = sass_context_hack
|
||||
%w(sass scss markdown).each do |engine|
|
||||
::Slim::EmbeddedEngine.default_options[engine.to_sym] = context_hack
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue