Add keyword arguments for Liquid shortcodes. #1733
Closed
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.
Fixes #1263. This removes
moo
and switches the argument lexer/parser for Liquid shortcodes to liquid-args, to support keyword arguments with output mirroring Nunjucks kwargs.This includes some breaking changes in how Liquid shortcodes handle the whitespace in between arguments. With
liquid-args
, whitespace can be any number of space, tab, newline, or carriage return characters ([ \t\n\r]
), and will allow a comma at the beginning of the whitespace. That means that the following tags will parse correctly:But the following, which was previously supported, will break:
There are also some changes to how shortcodes parse numbers and dot-notation variable names. The previous
moo
parser would accept numbers like10...78
and variable names like..foobar.baz
. These were passed to the Liquid engine, which would throw an error for invalid Liquid. Theliquid-args
parser rejects these before passing to the engine. This shouldn't cause breaking changes but could affect error handling in some cases.Basically the same as #1269, but updated to the latest version of 11ty.