Skip to content

Commit

Permalink
Merge pull request #79 from MaxLap/patch_code_filter
Browse files Browse the repository at this point in the history
Remove trailing blank lines from HAML's :code filter
  • Loading branch information
tdreyno authored Aug 6, 2022
2 parents ad7bcde + 92f20f1 commit 3295894
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
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

0 comments on commit 3295894

Please sign in to comment.