mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-17 01:40:42 -07:00
working with default parsing for args
This commit is contained in:
@@ -68,7 +68,13 @@ module Liquid
|
||||
|
||||
# Inline snippets take precedence over external snippets
|
||||
if (inline_snippet = context.registers[:inline_snippet][template_name])
|
||||
return output << inline_snippet.render(context)
|
||||
inner_context = context.new_isolated_subcontext
|
||||
|
||||
@attributes.each do |key, value|
|
||||
inner_context[key] = context.evaluate(value)
|
||||
end
|
||||
|
||||
return output << inline_snippet.render(inner_context)
|
||||
end
|
||||
|
||||
partial = PartialCache.load(
|
||||
|
||||
@@ -14,12 +14,17 @@ module Liquid
|
||||
# value
|
||||
# {% endsnippet %}
|
||||
class Snippet < Block
|
||||
# SYNTAX = /(#{QuotedString}+) +\|(#{VariableSegment}*)\|/o
|
||||
SYNTAX = /(#{QuotedString}+)/o
|
||||
|
||||
def initialize(tag_name, markup, options)
|
||||
super
|
||||
if markup =~ SYNTAX
|
||||
# binding.irb
|
||||
@to = Regexp.last_match(1)
|
||||
# arg = Regexp.last_match(2)
|
||||
|
||||
# @args = []
|
||||
# @args << arg if arg
|
||||
else
|
||||
raise SyntaxError, options[:locale].t("errors.syntax.snippet")
|
||||
end
|
||||
@@ -38,7 +43,8 @@ module Liquid
|
||||
end
|
||||
|
||||
def snippet_body
|
||||
@body
|
||||
body = @body
|
||||
body
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user