mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-15 08:50:45 -07:00
Preserve separator at start of variable from QuotedFragment skipped chars
This commit is contained in:
@@ -100,7 +100,9 @@ module Liquid
|
|||||||
new_filter_markup = Utils.match_captures_replace(filters_match, 1 => new_filters_markup)
|
new_filter_markup = Utils.match_captures_replace(filters_match, 1 => new_filters_markup)
|
||||||
end
|
end
|
||||||
|
|
||||||
Utils.match_captures_replace(markup_match, 1 => new_name_markup, 2 => new_filter_markup)
|
new_markup = Utils.match_captures_replace(markup_match, 1 => new_name_markup, 2 => new_filter_markup)
|
||||||
|
new_markup.prepend(" ") if markup_match.begin(0) > 0
|
||||||
|
new_markup
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.lax_migrate_filter_argument(unparsed_arg)
|
def self.lax_migrate_filter_argument(unparsed_arg)
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ class MigrateUnitTest < Minitest::Test
|
|||||||
with_error_mode(:lax) do
|
with_error_mode(:lax) do
|
||||||
assert_migration({
|
assert_migration({
|
||||||
%({{ ,|"' }}) => "{{ }}", # no MarkupWithQuotedFragment match, skipping characters
|
%({{ ,|"' }}) => "{{ }}", # no MarkupWithQuotedFragment match, skipping characters
|
||||||
%({{ ,|"' 123 }}) => "{{ 123 }}", # MarkupWithQuotedFragment skipped characters
|
%({{ ,|"' 123 }}) => "{{ 123 }}", # MarkupWithQuotedFragment skipped characters
|
||||||
|
"{{,-2}}" => "{{ -2}}", # preserve separators when removing ignored characters
|
||||||
"{{ 12 34 }}" => "{{ 12 }}", # no FilterMarkupRegex match, skipping characters
|
"{{ 12 34 }}" => "{{ 12 }}", # no FilterMarkupRegex match, skipping characters
|
||||||
"{{ -12 34 | abs }}" => "{{ -12 | abs }}", # FilterMarkupRegex skipped characters
|
"{{ -12 34 | abs }}" => "{{ -12 | abs }}", # FilterMarkupRegex skipped characters
|
||||||
%({{ -12 | '" abs }}) => "{{ -12 | abs }}", # FilterParser skipped characters
|
%({{ -12 | '" abs }}) => "{{ -12 | abs }}", # FilterParser skipped characters
|
||||||
|
|||||||
Reference in New Issue
Block a user