mirror of
https://github.com/Shopify/liquid.git
synced 2025-11-09 00:02:23 -05:00
Render tag styling fixes
This commit is contained in:
parent
ddb45cd658
commit
604d899496
@ -1,13 +1,13 @@
|
|||||||
module Liquid
|
module Liquid
|
||||||
class Render < Tag
|
class Render < Tag
|
||||||
Syntax = /(#{QuotedString})#{QuotedFragment}*/o
|
SYNTAX = /(#{QuotedString})#{QuotedFragment}*/o
|
||||||
|
|
||||||
attr_reader :template_name_expr, :attributes
|
attr_reader :template_name_expr, :attributes
|
||||||
|
|
||||||
def initialize(tag_name, markup, options)
|
def initialize(tag_name, markup, options)
|
||||||
super
|
super
|
||||||
|
|
||||||
raise SyntaxError.new(options[:locale].t("errors.syntax.render".freeze)) unless markup =~ Syntax
|
raise SyntaxError.new(options[:locale].t("errors.syntax.render".freeze)) unless markup =~ SYNTAX
|
||||||
|
|
||||||
template_name = $1
|
template_name = $1
|
||||||
|
|
||||||
|
|||||||
@ -110,7 +110,7 @@ class RenderTagTest < Minitest::Test
|
|||||||
file_system = StubFileSystem.new('snippet' => 'echo')
|
file_system = StubFileSystem.new('snippet' => 'echo')
|
||||||
assert_equal 'echoecho',
|
assert_equal 'echoecho',
|
||||||
Template.parse('{% render "snippet" %}{% render "snippet" %}')
|
Template.parse('{% render "snippet" %}{% render "snippet" %}')
|
||||||
.render!({}, registers: { file_system: file_system })
|
.render!({}, registers: { file_system: file_system })
|
||||||
assert_equal 1, file_system.file_read_count
|
assert_equal 1, file_system.file_read_count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ class PartialCacheUnitTest < Minitest::Test
|
|||||||
def test_uses_the_file_system_register_if_present
|
def test_uses_the_file_system_register_if_present
|
||||||
context = Liquid::Context.build(
|
context = Liquid::Context.build(
|
||||||
registers: {
|
registers: {
|
||||||
file_system: StubFileSystem.new('my_partial' => 'my partial body')
|
file_system: StubFileSystem.new('my_partial' => 'my partial body'),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -41,12 +41,12 @@ class PartialCacheUnitTest < Minitest::Test
|
|||||||
)
|
)
|
||||||
context_one = Liquid::Context.build(
|
context_one = Liquid::Context.build(
|
||||||
registers: {
|
registers: {
|
||||||
file_system: shared_file_system
|
file_system: shared_file_system,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
context_two = Liquid::Context.build(
|
context_two = Liquid::Context.build(
|
||||||
registers: {
|
registers: {
|
||||||
file_system: shared_file_system
|
file_system: shared_file_system,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user