[FEATURE] Improve inline syntax for arguments and passing #399
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 patch improves the inline syntax of Fluid in the
following ways:
pass tag contents, e.g. {variable | f:format.raw()}. This
is done to approach shell syntax and for easier picking
up of Fluid syntax if you come from Twig.
tag attribute syntax. Commas were already optional which
allowed syntax like “{v:h(foo: bar baz: 123)}”. This is now
homogenised completely so you can use expressions like
“{v:h(foo=“{bar}” baz=“123”)}” - which means that you
can now migrate a tag-based usage to inline syntax
without having to touch the arguments you provided as
tag attributes.
All is achieved by adding two characters to the list that is
detected as inline syntax - “|” and “=“ - and by turning
the matching of “->” into a multiple match of either “->”
or the new “|”.
All legacy syntax is untouched. Tag syntax is untouched.
Full disclosure: a similar change was previously rejected
by myself: #343. The
only arguments I can give for accepting this current patch
but rejecting #343, are:
and sticks to adding characters and converting a character
match to a list of options.
lexer to parse Fluid (a project which also tries to include
the ES2015 style array syntax but can do so without any
concerns about bloating of even overflowing the regexp).