Created
February 26, 2009 15:06
-
-
Save mislav/70895 to your computer and use it in GitHub Desktop.
Haml monkeypatch to strip newline characters between HTML tags
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'haml/engine' | |
module Haml::Precompiler | |
alias original_flush_merged_text flush_merged_text | |
def flush_merged_text | |
@to_merge.each_with_index do |item, i| | |
next_item = @to_merge[i + 1] | |
item[1].chomp!("\n") if item[1][0, 1] == '<' and (!next_item or next_item[1][0, 1] == '<') | |
end | |
original_flush_merged_text | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment