Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove trailing blank lines from HAML's :code filter #79

Merged
merged 1 commit into from
Aug 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- Fixed HAML :code filter to remove trailing blank lines

# 3.2.0

- Prep for Middleman v5
Expand Down
12 changes: 12 additions & 0 deletions features/haml_filter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,15 @@ Feature: Haml :code filter.
When I go to "/code_haml_filter.html"
Then I should see '<span class="k">def</span>'
Then I should see '<pre class="highlight plaintext"><code>This is some code'

Scenario: Filter doesn't keep trailing blank lines
Given a fixture app "test-app"
And a file named "config.rb" with:
"""
set :haml, { :ugly => false }
activate :syntax
"""
Given the Server is running at "test-app"
When I go to "/code_haml_filter.html"
Then I should see '<span class="k">def</span>'
Then I should see '<pre class="highlight plaintext"><code>This is some code</code></pre>'
1 change: 1 addition & 0 deletions lib/middleman-syntax/haml_monkey_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module Code
include Base

def render(code)
code = code.rstrip
code = code.encode(Encoding::UTF_8)

# Allow language to be specified via a special comment like:
Expand Down