From 5ac91e08373c166960d95b9596264dc205342691 Mon Sep 17 00:00:00 2001 From: Daniel Schierbeck Date: Thu, 3 May 2012 14:16:06 +0300 Subject: [PATCH 1/3] Fix typo and add punctuation --- lib/liquid/drop.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/liquid/drop.rb b/lib/liquid/drop.rb index 869b203..c1914dc 100644 --- a/lib/liquid/drop.rb +++ b/lib/liquid/drop.rb @@ -2,9 +2,9 @@ module Liquid # A drop in liquid is a class which allows you to export DOM like things to liquid. # Methods of drops are callable. - # The main use for liquid drops is the implement lazy loaded objects. + # The main use for liquid drops is to implement lazy loaded objects. # If you would like to make data available to the web designers which you don't want loaded unless needed then - # a drop is a great way to do that + # a drop is a great way to do that. # # Example: # @@ -18,7 +18,7 @@ module Liquid # tmpl.render('product' => ProductDrop.new ) # will invoke top_sales query. # # Your drop can either implement the methods sans any parameters or implement the before_method(name) method which is a - # catch all + # catch all. class Drop attr_writer :context From 40cc799f3db67f3b8d392550ffba142bf0a97dfd Mon Sep 17 00:00:00 2001 From: 7rans Date: Fri, 10 Feb 2012 13:45:35 -0500 Subject: [PATCH 2/3] Add example to split filter. --- lib/liquid/standardfilters.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/liquid/standardfilters.rb b/lib/liquid/standardfilters.rb index 99bfa33..d1a87ee 100644 --- a/lib/liquid/standardfilters.rb +++ b/lib/liquid/standardfilters.rb @@ -54,6 +54,10 @@ module Liquid end # Split input string into an array of substrings separated by given pattern. + # + # Example: + #
{{ post | split '//' | first }}
+ # def split(input, pattern) input.split(pattern) end From 515b31158ef094e04e0d9f832b04a4cfc3e3b542 Mon Sep 17 00:00:00 2001 From: Jason Normore Date: Wed, 6 Jun 2012 11:36:47 -0400 Subject: [PATCH 3/3] strip_html to ignore comments with html tags. fixes #1650 --- lib/liquid/standardfilters.rb | 2 +- test/liquid/filter_test.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/liquid/standardfilters.rb b/lib/liquid/standardfilters.rb index d1a87ee..651216a 100644 --- a/lib/liquid/standardfilters.rb +++ b/lib/liquid/standardfilters.rb @@ -63,7 +63,7 @@ module Liquid end def strip_html(input) - input.to_s.gsub(//, '').gsub(/<.*?>/, '') + input.to_s.gsub(//, '').gsub(//, '').gsub(/<.*?>/, '') end # Remove all newlines from the string diff --git a/test/liquid/filter_test.rb b/test/liquid/filter_test.rb index 3c81aa6..f24a70c 100644 --- a/test/liquid/filter_test.rb +++ b/test/liquid/filter_test.rb @@ -75,6 +75,12 @@ class FiltersTest < Test::Unit::TestCase assert_equal "bla blub", Variable.new("var | strip_html").render(@context) end + def test_strip_html_ignore_comments_with_html + @context['var'] = "bla blub" + + assert_equal "bla blub", Variable.new("var | strip_html").render(@context) + end + def test_capitalize @context['var'] = "blub"