Fix spacing

This commit is contained in:
Mike Angell
2019-09-20 02:25:35 +10:00
parent 05c0bcf609
commit 26eb27f79f
78 changed files with 508 additions and 500 deletions
+3
View File
@@ -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:
+1
View File
@@ -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 = /"[^\"]*"/
+3
View File
@@ -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
+2 -1
View File
@@ -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)