mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Remove unnecessary blank? code
This commit is contained in:
+2
-2
@@ -11,7 +11,7 @@ module Liquid
|
|||||||
end
|
end
|
||||||
|
|
||||||
def blank?
|
def blank?
|
||||||
@blank || false
|
@blank
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse(tokens)
|
def parse(tokens)
|
||||||
@@ -49,7 +49,7 @@ module Liquid
|
|||||||
else
|
else
|
||||||
raise SyntaxError.new(options[:locale].t("errors.syntax.tag_termination".freeze, :token => token, :tag_end => TagEnd.inspect))
|
raise SyntaxError.new(options[:locale].t("errors.syntax.tag_termination".freeze, :token => token, :tag_end => TagEnd.inspect))
|
||||||
end
|
end
|
||||||
when token.start_with?(VARSTART)
|
when token.start_with?(VARSTART)
|
||||||
new_var = create_variable(token)
|
new_var = create_variable(token)
|
||||||
@nodelist << new_var
|
@nodelist << new_var
|
||||||
@children << new_var
|
@children << new_var
|
||||||
|
|||||||
+4
-3
@@ -31,7 +31,7 @@ module Liquid
|
|||||||
end
|
end
|
||||||
|
|
||||||
def blank?
|
def blank?
|
||||||
@blank || false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_with_selected_parser(markup)
|
def parse_with_selected_parser(markup)
|
||||||
@@ -50,11 +50,12 @@ module Liquid
|
|||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def strict_parse_with_error_context(markup)
|
def strict_parse_with_error_context(markup)
|
||||||
strict_parse(markup)
|
strict_parse(markup)
|
||||||
rescue SyntaxError => e
|
rescue SyntaxError => e
|
||||||
e.message << " in \"#{markup.strip}\""
|
e.message << " in \"#{markup.strip}\""
|
||||||
raise e
|
raise e
|
||||||
end
|
end
|
||||||
end # Tag
|
end
|
||||||
end # Liquid
|
end
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
module Liquid
|
module Liquid
|
||||||
|
|
||||||
# Capture stores the result of a block into a variable without rendering it inplace.
|
# Capture stores the result of a block into a variable without rendering it inplace.
|
||||||
#
|
#
|
||||||
# {% capture heading %}
|
# {% capture heading %}
|
||||||
|
|||||||
@@ -43,11 +43,8 @@ module Liquid
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def blank?
|
|
||||||
false
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def variables_from_string(markup)
|
def variables_from_string(markup)
|
||||||
markup.split(',').collect do |var|
|
markup.split(',').collect do |var|
|
||||||
var =~ /\s*(#{QuotedFragment})\s*/o
|
var =~ /\s*(#{QuotedFragment})\s*/o
|
||||||
|
|||||||
@@ -38,10 +38,6 @@ module Liquid
|
|||||||
def parse(tokens)
|
def parse(tokens)
|
||||||
end
|
end
|
||||||
|
|
||||||
def blank?
|
|
||||||
false
|
|
||||||
end
|
|
||||||
|
|
||||||
def render(context)
|
def render(context)
|
||||||
partial = load_cached_partial(context)
|
partial = load_cached_partial(context)
|
||||||
variable = context[@variable_name || @template_name[1..-2]]
|
variable = context[@variable_name || @template_name[1..-2]]
|
||||||
|
|||||||
@@ -25,10 +25,6 @@ module Liquid
|
|||||||
context.environments.first[@variable] = value + 1
|
context.environments.first[@variable] = value + 1
|
||||||
value.to_s
|
value.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def blank?
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Template.register_tag('increment'.freeze, Increment)
|
Template.register_tag('increment'.freeze, Increment)
|
||||||
|
|||||||
@@ -60,10 +60,6 @@ class CustomInclude < Liquid::Tag
|
|||||||
def parse(tokens)
|
def parse(tokens)
|
||||||
end
|
end
|
||||||
|
|
||||||
def blank?
|
|
||||||
false
|
|
||||||
end
|
|
||||||
|
|
||||||
def render(context)
|
def render(context)
|
||||||
@template_name[1..-2]
|
@template_name[1..-2]
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user