Revert "Merge pull request #185 from ISSIntel/liquid-utf8"

This reverts commit c5dfcd29b0, reversing
changes made to f7d1e1d0c1.
This commit is contained in:
Tom Burns
2013-05-20 19:53:13 -04:00
parent 690b3ff27f
commit 8913a5615a
13 changed files with 9 additions and 50 deletions
+3 -4
View File
@@ -20,15 +20,14 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
module Liquid
WordRegex = RUBY_VERSION < "1.9" ? '\w' : '[[:word:]]'
FilterSeparator = /\|/
ArgumentSeparator = ','
FilterArgumentSeparator = ':'
VariableAttributeSeparator = '.'
TagStart = /\{\%/
TagEnd = /\%\}/
VariableSignature = /\(?[#{WordRegex}\-\.\[\]]\)?/o
VariableSegment = /[#{WordRegex}\-]/o
VariableSignature = /\(?[\w\-\.\[\]]\)?/
VariableSegment = /[\w\-]/
VariableStart = /\{\{/
VariableEnd = /\}\}/
VariableIncompleteEnd = /\}\}?/
@@ -39,7 +38,7 @@ module Liquid
OtherFilterArgument = /#{ArgumentSeparator}(?:#{StrictQuotedFragment})/o
SpacelessFilter = /^(?:'[^']+'|"[^"]+"|[^'"])*#{FilterSeparator}(?:#{StrictQuotedFragment})(?:#{FirstFilterArgument}(?:#{OtherFilterArgument})*)?/o
Expression = /(?:#{QuotedFragment}(?:#{SpacelessFilter})*)/o
TagAttributes = /(#{WordRegex}+)\s*\:\s*(#{QuotedFragment})/o
TagAttributes = /(\w+)\s*\:\s*(#{QuotedFragment})/o
AnyStartingTag = /\{\{|\{\%/
PartialTemplateParser = /#{TagStart}.*?#{TagEnd}|#{VariableStart}.*?#{VariableIncompleteEnd}/o
TemplateParser = /(#{PartialTemplateParser}|#{AnyStartingTag})/o
+1 -1
View File
@@ -3,7 +3,7 @@ module Liquid
class Block < Tag
IsTag = /^#{TagStart}/o
IsVariable = /^#{VariableStart}/o
FullToken = /^#{TagStart}\s*(#{WordRegex}+)\s*(.*)?#{TagEnd}$/o
FullToken = /^#{TagStart}\s*(\w+)\s*(.*)?#{TagEnd}$/o
ContentOfVariable = /^#{VariableStart}(.*)#{VariableEnd}$/o
def parse(tokens)
+1 -1
View File
@@ -1,6 +1,6 @@
module Liquid
class TableRow < Block
Syntax = /(#{WordRegex}+)\s+in\s+(#{QuotedFragment}+)/o
Syntax = /(\w+)\s+in\s+(#{QuotedFragment}+)/o
def initialize(tag_name, markup, tokens)
if markup =~ Syntax
+1 -1
View File
@@ -12,7 +12,7 @@ module Liquid
# in a sidebar or footer.
#
class Capture < Block
Syntax = /(#{WordRegex}+)/o
Syntax = /(\w+)/
def initialize(tag_name, markup, tokens)
if markup =~ Syntax
+1 -1
View File
@@ -44,7 +44,7 @@ module Liquid
# forloop.last:: Returns true if the item is the last item.
#
class For < Block
Syntax = /(#{WordRegex}+)\s+in\s+(#{QuotedFragment}+)\s*(reversed)?/ou
Syntax = /(\w+)\s+in\s+(#{QuotedFragment}+)\s*(reversed)?/o
def initialize(tag_name, markup, tokens)
if markup =~ Syntax
+1 -1
View File
@@ -23,7 +23,7 @@ module Liquid
if match[2].match(/#{FilterSeparator}\s*(.*)/o)
filters = Regexp.last_match(1).scan(FilterParser)
filters.each do |f|
if matches = f.match(/\s*(#{WordRegex}+)(?:\s*#{FilterArgumentSeparator}(.*))?/)
if matches = f.match(/\s*(\w+)(?:\s*#{FilterArgumentSeparator}(.*))?/)
filtername = matches[1]
filterargs = matches[2].to_s.scan(/(?:\A|#{ArgumentSeparator})\s*((?:\w+\s*\:\s*)?#{QuotedFragment})/o).flatten
@filters << [filtername, filterargs]