Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a failing test for a partial containing a block #573

Closed

Conversation

mmun
Copy link

@mmun mmun commented Apr 13, 2023

Here is a failing test for a partial containing a block. This is in response to @sunng87's request: #504 (comment).

For comparison, here is how handlebars.js handles this situation:

https://handlebarsjs.com/playground.html#format=1&currentExample=%7B%22template%22%3A%22%7B%7B%23*inline%20%5C%22thepartial%5C%22%7D%7D%5Cnpartial%20first%20line%5Cn%7B%7B%23if%20true%7D%7D%5Cn%20%20%20%20partial%20second%20line%5Cn%7B%7B%2Fif%7D%7D%5Cnpartial%20third%20line%5Cn%7B%7B%2Finline%7D%7D%5Cnbefore%20partial%5Cn%20%20%20%20%7B%7B%3E%20thepartial%7D%7D%5Cnafter%20partial%22%2C%22partials%22%3A%5B%5D%2C%22input%22%3A%22%7B%7D%22%2C%22output%22%3A%22before%20partial%5Cn%20%20%20%20partial%20first%20line%5Cn%20%20%20%20%20%20%20%20partial%20second%20line%5Cn%20%20%20%20partial%20third%20line%5Cnafter%20partial%22%2C%22preparationScript%22%3A%22%22%2C%22handlebarsVersion%22%3A%224.7.7%22%7D

It's also worth noting that the bug does not occur if the inline partial is defined with similar indentation but without using a block. It seems to really be an issue about blocks within partials. Some examples:

Indentation is processed correctly:

{{#*inline "thepartial"}}
partial first line
    partial second line
partial third line
{{/inline}}

Indentation is not processed correctly:

{{#*inline "thepartial"}}
partial first line
{{#if true}}
    partial second line
{{/if}}
partial third line
{{/inline}}

Indentation is also not processed correctly:

{{#*inline "thepartial"}}
partial first line
{{#if true}}    partial second line{{/if}}
partial third line
{{/inline}}

@mmun mmun force-pushed the mmun/failing-test-for-partials-with-blocks branch from fb89888 to 6f2ac25 Compare April 13, 2023 15:09
@sunng87
Copy link
Owner

sunng87 commented Apr 14, 2023

@mmun thank you! I will look into this issue during the weekend. If you are interested in fixing issue, let me know and I can offer help

@sunng87 sunng87 added the syntax label Apr 14, 2023
@mmun
Copy link
Author

mmun commented Apr 14, 2023

@sunng87 Thanks! I'm not in urgent need of a fix so feel free to relax on the weekend :) I may fix it one day. I just wanted to make a ticket in case others run into the situation.

@sunng87
Copy link
Owner

sunng87 commented Apr 14, 2023

no problem. let me look into this issue

@sunng87
Copy link
Owner

sunng87 commented Apr 15, 2023

I will be tracking this in #574

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants