mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-03 09:05:13 -07:00
Fix spacing
This commit is contained in:
@@ -7,6 +7,9 @@ require: rubocop-performance
|
|||||||
Performance:
|
Performance:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/ExtraSpacing:
|
||||||
|
ForceEqualSignAlignment: true
|
||||||
|
|
||||||
AllCops:
|
AllCops:
|
||||||
TargetRubyVersion: 2.4
|
TargetRubyVersion: 2.4
|
||||||
Exclude:
|
Exclude:
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ module Liquid
|
|||||||
'?' => :question,
|
'?' => :question,
|
||||||
'-' => :dash,
|
'-' => :dash,
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
IDENTIFIER = /[a-zA-Z_][\w-]*\??/
|
IDENTIFIER = /[a-zA-Z_][\w-]*\??/
|
||||||
SINGLE_STRING_LITERAL = /'[^\']*'/
|
SINGLE_STRING_LITERAL = /'[^\']*'/
|
||||||
DOUBLE_STRING_LITERAL = /"[^\"]*"/
|
DOUBLE_STRING_LITERAL = /"[^\"]*"/
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ module Liquid
|
|||||||
|
|
||||||
def consume(type = nil)
|
def consume(type = nil)
|
||||||
token = @tokens[@p]
|
token = @tokens[@p]
|
||||||
|
|
||||||
if type && token[0] != type
|
if type && token[0] != type
|
||||||
raise SyntaxError, "Expected #{type} but found #{@tokens[@p].first}"
|
raise SyntaxError, "Expected #{type} but found #{@tokens[@p].first}"
|
||||||
end
|
end
|
||||||
@@ -26,6 +27,7 @@ module Liquid
|
|||||||
# or false otherwise.
|
# or false otherwise.
|
||||||
def consume?(type)
|
def consume?(type)
|
||||||
token = @tokens[@p]
|
token = @tokens[@p]
|
||||||
|
|
||||||
return false unless token && token[0] == type
|
return false unless token && token[0] == type
|
||||||
@p += 1
|
@p += 1
|
||||||
token[1]
|
token[1]
|
||||||
@@ -34,6 +36,7 @@ module Liquid
|
|||||||
# Like consume? Except for an :id token of a certain name
|
# Like consume? Except for an :id token of a certain name
|
||||||
def id?(str)
|
def id?(str)
|
||||||
token = @tokens[@p]
|
token = @tokens[@p]
|
||||||
|
|
||||||
return false unless token && token[0] == :id
|
return false unless token && token[0] == :id
|
||||||
return false unless token[1] == str
|
return false unless token[1] == str
|
||||||
@p += 1
|
@p += 1
|
||||||
|
|||||||
@@ -12,13 +12,14 @@ module Liquid
|
|||||||
'"' => '"',
|
'"' => '"',
|
||||||
"'" => ''',
|
"'" => ''',
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
HTML_ESCAPE_ONCE_REGEXP = /["><']|&(?!([a-zA-Z]+|(#\d+));)/
|
HTML_ESCAPE_ONCE_REGEXP = /["><']|&(?!([a-zA-Z]+|(#\d+));)/
|
||||||
|
STRIP_HTML_TAGS = /<.*?>/m
|
||||||
STRIP_HTML_BLOCKS = Regexp.union(
|
STRIP_HTML_BLOCKS = Regexp.union(
|
||||||
%r{<script.*?</script>}m,
|
%r{<script.*?</script>}m,
|
||||||
/<!--.*?-->/m,
|
/<!--.*?-->/m,
|
||||||
%r{<style.*?</style>}m
|
%r{<style.*?</style>}m
|
||||||
)
|
)
|
||||||
STRIP_HTML_TAGS = /<.*?>/m
|
|
||||||
|
|
||||||
# Return the size of an array or of an string
|
# Return the size of an array or of an string
|
||||||
def size(input)
|
def size(input)
|
||||||
|
|||||||
Reference in New Issue
Block a user