mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Merge pull request #203 from phoet/strip_carriage_return
handle carriage return in strip_newline, closes #126
This commit is contained in:
@@ -69,7 +69,7 @@ module Liquid
|
|||||||
|
|
||||||
# Remove all newlines from the string
|
# Remove all newlines from the string
|
||||||
def strip_newlines(input)
|
def strip_newlines(input)
|
||||||
input.to_s.gsub(/\n/, '')
|
input.to_s.gsub(/\r?\n/, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ class StandardFiltersTest < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_strip_newlines
|
def test_strip_newlines
|
||||||
assert_template_result 'abc', "{{ source | strip_newlines }}", 'source' => "a\nb\nc"
|
assert_template_result 'abc', "{{ source | strip_newlines }}", 'source' => "a\nb\nc"
|
||||||
|
assert_template_result 'abc', "{{ source | strip_newlines }}", 'source' => "a\r\nb\nc"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_newlines_to_br
|
def test_newlines_to_br
|
||||||
|
|||||||
Reference in New Issue
Block a user