Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Handlebars Parser: Unexpected parsing result #7

Open
jamesrwilliams opened this issue Feb 19, 2021 · 1 comment
Open

Handlebars Parser: Unexpected parsing result #7

jamesrwilliams opened this issue Feb 19, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@jamesrwilliams
Copy link
Owner

handlebarsParser() returns an unexpected result for the following test case:

Description Data
Test Case {quantity, plural, one {%lp.currency.name%} other{%lp.currency.name.plural%}}
Expected 11111111111111111111111111111111111111111111111111111111111111111111111111111
Actual 11111111111111111111111111111111111111111110000001111111111111111111111111111
@jamesrwilliams jamesrwilliams added the bug Something isn't working label Feb 19, 2021
jamesrwilliams added a commit that referenced this issue Feb 26, 2021
@jamesrwilliams jamesrwilliams self-assigned this Feb 26, 2021
@jamesrwilliams
Copy link
Owner Author

jamesrwilliams commented Feb 28, 2021

Progress update: One idea I've had is to remove the lazy quantifier from the regex but we get the following results:

- const filterExpression = /{+.*?}+/g;
+ const filterExpression = /{+.*}+/g;

Results

Test Case {+.*?}+ {+.*}+
<p>Hello world! Your balance is {limitRemaining, number}</p>
{quantity, plural, one {%lp.currency.name%} other{%lp.currency.name.plural%}} 🛑
{{foobar} example} hello world 🛑
Hello { firstName } { lastname } 🛑
Hello { firstName } of the house { lastname } 🛑

We've resolved the issues with nesting expressions at the expense of the single bracket values.

N.B: We can simplify the current regex to {.*} from {+.*?}+

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant