Prevent overwrite of Slim embedded options (#1927)
* Fix middleman/middleman#1925: Slim embedded options overwrite * Remove context_hack from Slim renderer * Remove debugging output
This commit is contained in:
parent
51ccfe1143
commit
0d5c9e4313
4 changed files with 82 additions and 5 deletions
41
middleman-core/features/markdown_redcarpet_in_slim.feature
Normal file
41
middleman-core/features/markdown_redcarpet_in_slim.feature
Normal file
|
@ -0,0 +1,41 @@
|
|||
Feature: Markdown support in Slim
|
||||
In order to test support of the Slim markdown filter
|
||||
|
||||
Scenario: Markdown filter in Slim works
|
||||
Given a fixture app "markdown-in-slim-app"
|
||||
And a file named "config.rb" with:
|
||||
"""
|
||||
set :markdown_engine, :redcarpet
|
||||
activate :directory_indexes
|
||||
"""
|
||||
And a file named "source/markdown_filter.html.slim" with:
|
||||
"""
|
||||
markdown:
|
||||
# H1
|
||||
|
||||
paragraph
|
||||
"""
|
||||
Given the Server is running at "markdown-in-slim-app"
|
||||
When I go to "/markdown_filter/"
|
||||
Then I should see ">H1</h1>"
|
||||
Then I should see "<p>paragraph</p>"
|
||||
|
||||
|
||||
Scenario: Markdown filter in Slim uses our link_to and image_tag helpers
|
||||
Given a fixture app "markdown-in-slim-app"
|
||||
And a file named "config.rb" with:
|
||||
"""
|
||||
set :markdown_engine, :redcarpet
|
||||
activate :directory_indexes
|
||||
"""
|
||||
And a file named "source/link_and_image.html.slim" with:
|
||||
"""
|
||||
markdown:
|
||||
[A link](/link_target.html)
|
||||
|
||||
![image](blank.gif)
|
||||
"""
|
||||
Given the Server is running at "markdown-in-slim-app"
|
||||
When I go to "/link_and_image/"
|
||||
Then I should see "/link_target/"
|
||||
Then I should see 'src="/images/blank.gif"'
|
40
middleman-core/features/sass_in_slim.feature
Normal file
40
middleman-core/features/sass_in_slim.feature
Normal file
|
@ -0,0 +1,40 @@
|
|||
Feature: Sass/SCSS support in Slim
|
||||
In order to test support of the Slim sass and scss filters
|
||||
|
||||
Scenario: Sass filter in Slim works
|
||||
Given a fixture app "sass-in-slim-app"
|
||||
And a file named "config.rb" with:
|
||||
"""
|
||||
activate :directory_indexes
|
||||
"""
|
||||
And a file named "source/sass_filter.html.slim" with:
|
||||
"""
|
||||
sass:
|
||||
.sass
|
||||
margin: 0
|
||||
"""
|
||||
Given the Server is running at "sass-in-slim-app"
|
||||
When I go to "/sass_filter/"
|
||||
Then I should see "text/css"
|
||||
Then I should see ".sass"
|
||||
Then I should see "margin:0"
|
||||
|
||||
|
||||
Scenario: SCSS filter in Slim works
|
||||
Given a fixture app "sass-in-slim-app"
|
||||
And a file named "config.rb" with:
|
||||
"""
|
||||
activate :directory_indexes
|
||||
"""
|
||||
And a file named "source/scss_filter.html.slim" with:
|
||||
"""
|
||||
scss:
|
||||
.scss {
|
||||
margin: 0;
|
||||
}
|
||||
"""
|
||||
Given the Server is running at "sass-in-slim-app"
|
||||
When I go to "/scss_filter/"
|
||||
Then I should see "text/css"
|
||||
Then I should see ".scss"
|
||||
Then I should see "margin:0"
|
0
middleman-core/fixtures/sass-in-slim-app/config.rb
Normal file
0
middleman-core/fixtures/sass-in-slim-app/config.rb
Normal file
|
@ -12,13 +12,9 @@ class ::Slim::Template
|
|||
|
||||
def initialize(file, line, opts, &block)
|
||||
if opts.key?(:context)
|
||||
context_hack = {
|
||||
context: opts[:context]
|
||||
}
|
||||
|
||||
::Slim::Embedded::SassEngine.disable_option_validator!
|
||||
%w(sass scss markdown).each do |engine|
|
||||
::Slim::Embedded.options[engine.to_sym] = context_hack
|
||||
(::Slim::Embedded.options[engine.to_sym] ||= {})[:context] = opts[:context]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue