Skip to content

Fixed up pipe character support in split#23

Open
amit777 wants to merge 12 commits intosanko:masterfrom
amit777:master
Open

Fixed up pipe character support in split#23
amit777 wants to merge 12 commits intosanko:masterfrom
amit777:master

Conversation

@amit777
Copy link
Contributor

@amit777 amit777 commented Oct 30, 2023

Hi, we found a bug when trying to split on a | character

use Template::Liquid;

my $template = Template::Liquid->parse('{% assign fragments = foo | split: "| |" %}{% for fragment in fragments %}frag={{fragment}} {% endfor %}');

print $template->render(foo => "foo| |bar| |baz")

This patch will do negative lookaheads and look behinds to make sure a pipe is not surrounded by quotation marks. It will also quotemeta the split character sequence.

@amit777
Copy link
Contributor Author

amit777 commented Oct 30, 2023

related to ticket #24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant