handle carriage return in strip_newline, closes #126

This commit is contained in:
Peter Schröder
2013-06-09 10:24:35 -04:00
parent 94ff457744
commit fd263bba0f
2 changed files with 2 additions and 1 deletions

View File

@@ -68,7 +68,7 @@ module Liquid
# Remove all newlines from the string
def strip_newlines(input)
input.to_s.gsub(/\n/, '')
input.to_s.gsub(/\r?\n/, '')
end

View File

@@ -136,6 +136,7 @@ class StandardFiltersTest < Test::Unit::TestCase
def test_strip_newlines
assert_template_result 'abc', "{{ source | strip_newlines }}", 'source' => "a\nb\nc"
assert_template_result 'abc', "{{ source | strip_newlines }}", 'source' => "a\r\nb\nc"
end
def test_newlines_to_br