mirror of
https://github.com/kemko/liquid.git
synced 2026-01-01 15:55:40 +03:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e77b1a09b6 | ||
|
|
73b39beef2 | ||
|
|
fc63219087 |
@@ -1,6 +1,10 @@
|
||||
# Liquid Version History
|
||||
|
||||
## 2.5.3 / branch "2.5-stable"
|
||||
## 2.5.4 / 2013-11-11 / branch "2.5-stable"
|
||||
|
||||
* Fix "can't convert Fixnum into String" for "replace", see #173, [wǒ_is神仙, jsw0528]
|
||||
|
||||
## 2.5.3 / 2013-10-09
|
||||
|
||||
* #232, #234, #237: Fix map filter bugs [Florian Weingarten, fw42]
|
||||
|
||||
|
||||
@@ -107,12 +107,12 @@ module Liquid
|
||||
|
||||
# Replace occurrences of a string with another
|
||||
def replace(input, string, replacement = '')
|
||||
input.to_s.gsub(string, replacement)
|
||||
input.to_s.gsub(string, replacement.to_s)
|
||||
end
|
||||
|
||||
# Replace the first occurrences of a string with another
|
||||
def replace_first(input, string, replacement = '')
|
||||
input.to_s.sub(string, replacement)
|
||||
input.to_s.sub(string, replacement.to_s)
|
||||
end
|
||||
|
||||
# remove a substring
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "liquid"
|
||||
s.version = "2.5.3"
|
||||
s.version = "2.5.4"
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.summary = "A secure, non-evaling end user template engine with aesthetic markup."
|
||||
s.authors = ["Tobias Luetke"]
|
||||
|
||||
@@ -157,9 +157,9 @@ class StandardFiltersTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_replace
|
||||
assert_equal 'b b b b', @filters.replace("a a a a", 'a', 'b')
|
||||
assert_equal 'b a a a', @filters.replace_first("a a a a", 'a', 'b')
|
||||
assert_template_result 'b a a a', "{{ 'a a a a' | replace_first: 'a', 'b' }}"
|
||||
assert_equal '2 2 2 2', @filters.replace('1 1 1 1', '1', 2)
|
||||
assert_equal '2 1 1 1', @filters.replace_first('1 1 1 1', '1', 2)
|
||||
assert_template_result '2 1 1 1', "{{ '1 1 1 1' | replace_first: '1', 2 }}"
|
||||
end
|
||||
|
||||
def test_remove
|
||||
|
||||
Reference in New Issue
Block a user