✨ Brand New Antlers Engine ✨ by JohnathonKoster · Pull Request #4257 · statamic/cms

added 5 commits

September 13, 2021 16:49

@JohnathonKoster

…ity changes

Removes a few str library methods that are not worth backporting

@JohnathonKoster

@JohnathonKoster

@JohnathonKoster

@JohnathonKoster

@JohnathonKoster

Ensures left part of a condition manifests a collapsible type

@JohnathonKoster

@JohnathonKoster

@JohnathonKoster

@JohnathonKoster

@JohnathonKoster

@JohnathonKoster

@JohnathonKoster

@JohnathonKoster

Co-authored-by: Jack McDade <jack@jackmcdade.com>
… ...

- 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

@jasonvarga

@JohnathonKoster

@JohnathonKoster

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_" }}
```

@JohnathonKoster

When the `void` value is resolved by the Runtime, that parameter is skipped and not sent to the tag.

@JohnathonKoster

@jasonvarga

@jasonvarga

@jasonvarga

@jasonvarga

@jasonvarga

- 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)

@jasonvarga

@jasonvarga

@jasonvarga

@jasonvarga

@jasonvarga

@JohnathonKoster

@JohnathonKoster