feat: Added dynamic partial blocks by adding support for empty block closing tags#713
Merged
sunng87 merged 5 commits intosunng87:masterfrom Jun 11, 2025
Merged
feat: Added dynamic partial blocks by adding support for empty block closing tags#713sunng87 merged 5 commits intosunng87:masterfrom
sunng87 merged 5 commits intosunng87:masterfrom
Conversation
sunng87
reviewed
Jun 10, 2025
Owner
sunng87
left a comment
There was a problem hiding this comment.
This looks mostly good to me. Just add two small comments
sunng87
reviewed
Jun 11, 2025
sunng87
approved these changes
Jun 11, 2025
Owner
|
@henriquecolini I just reverted the version change by myself. Thank you for the patch! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements a feature that has been historically lacking from the original Handlebars: dynamic partial blocks. handlebars-lang/handlebars-parser#9
Handlebars syntax allows users to create both dynamic partials:
And partial blocks:
In theory, one should be able to use both features at the same time since there's no conflict whatsoever betwen them. In practice though, this turns out to be impossible due to a funny oversight in the syntax:
I have fixed this issue by making the explicit name in the closing tag optional, which I consider the most obvious change to the syntax. So, this is now possible:
And as a bonus, it's also possible in general, for any partial and decorator block: