Remove {% local %} tag

This commit is contained in:
Justin Li
2019-04-08 18:34:39 -04:00
parent 8d1cd41453
commit 951abb67ee
3 changed files with 3 additions and 47 deletions

View File

@@ -1,30 +0,0 @@
require_relative 'assign'
module Liquid
# Local sets a variable in the current scope.
#
# {% local foo = 'monkey' %}
#
# You can then use the variable later in the scope.
#
# {% if true %}
# {% local foo = 'monkey' %}
# {{ foo }} outputs monkey
# {% endif %}
# {{ foo }} outputs nothing
#
class Local < Assign
def self.syntax_error_translation_key
"errors.syntax.local".freeze
end
def render(context)
val = @from.render(context)
context[@to] = val
context.resource_limits.assign_score += assign_score_of(val)
''.freeze
end
end
Template.register_tag('local'.freeze, Local)
end