✨ Brand New Antlers Engine ✨ by JohnathonKoster · Pull Request #4257 · statamic/cms
added 5 commits
September 13, 2021 16:49… ... - Changed method names to the /** @test */ with snake case syntax - Inconsistencies regardling extra newlines in one parser vs the other are resolved by creating an assertion that collapses multiple newlines into single ones. We don't really care about the exact whitespace. - New parser uses renderString() instead of Antlers::parse(). Just went with that. - Added some missing tests that were added to the old parser but not applied to the new parser - Fixed some typos
Provides a new handle_prefix parameter that will be applied to all variable lookups within the scope tag and the partial tag. These calls can be nested, and the first one that matches a variable is what is returned.
If no prefixed match is found, normal/default variable handling behavior is then used, and then the normal Cascade logic is used. 🎉
```
{{# Dynamically adding a trailing _ #}}
{{ scope :handle_prefix="prefix ?= prefix + '_'" }}
{{ title }}
{{ /scope }}
{{# Hardcoded prefix in a partial tag #}}
{{ partial:partial-name handle_prefix="prefix_" }}
```
When the `void` value is resolved by the Runtime, that parameter is skipped and not sent to the tag.
- register both parsers regardless of which one is configured. they're not instantiated until called anyway. - work out which one to use for the Parser contract within the binding closure - the config will be ready by then. e.g. for within tests. - add tests, especially to check that injecting the old Parser class still works. (like the comment in ViewServiceProvider mentioned)
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