diff --git a/lib/liquid.rb b/lib/liquid.rb index 950ac7e..533bfb4 100644 --- a/lib/liquid.rb +++ b/lib/liquid.rb @@ -45,7 +45,7 @@ module Liquid PartialTemplateParser = /#{TagStart}.*?#{TagEnd}|#{VariableStart}.*?#{VariableIncompleteEnd}/ TemplateParser = /(#{PartialTemplateParser}|#{AnyStartingTag})/ VariableParser = /\[[^\]]+\]|#{VariableSegment}+\??/ - LiteralShorthand = /^(?:{{{\s?)(.*?)(?:\s*}}})$/ + LiteralShorthand = /^(?:\{\{\{\s?)(.*?)(?:\s*\}\}\})$/ end require 'liquid/drop' diff --git a/test/lib/liquid/regexp_test.rb b/test/lib/liquid/regexp_test.rb index 8643e2a..1259d97 100644 --- a/test/lib/liquid/regexp_test.rb +++ b/test/lib/liquid/regexp_test.rb @@ -43,6 +43,7 @@ class RegexpTest < Test::Unit::TestCase end def test_literal_shorthand_regexp - assert_match "{{{ {% if 'gnomeslab' contains 'liquid' %}yes{% endif %} }}}", LiteralShorthand + assert_equal [["{% if 'gnomeslab' contains 'liquid' %}yes{% endif %}"]], + "{{{ {% if 'gnomeslab' contains 'liquid' %}yes{% endif %} }}}".scan(LiteralShorthand) end end # RegexpTest diff --git a/test/test_helper.rb b/test/test_helper.rb index 74118ed..32f96f5 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -2,6 +2,7 @@ extras_path = File.join File.dirname(__FILE__), 'extra' $LOAD_PATH.unshift(extras_path) unless $LOAD_PATH.include? extras_path +require 'rubygems' unless RUBY_VERSION =~ /^(?:1.9.*)$/ require 'test/unit' require 'test/unit/assertions' require 'caller'