Add keyword arguments for Liquid shortcodes.#1733
Closed
dawaltconley wants to merge 2 commits into11ty:masterfrom
Closed
Add keyword arguments for Liquid shortcodes.#1733dawaltconley wants to merge 2 commits into11ty:masterfrom
dawaltconley wants to merge 2 commits into11ty:masterfrom
Conversation
|
@zachleat has there been any thought about merging this change or perhaps additional work to make the args lexer a configurable template engine option? |
Member
|
Closing this one per the comment left over at #1263. #1263 (comment) Again, I’m sorry this didn’t make it! |
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.
Fixes #1263. This removes
mooand 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
mooparser would accept numbers like10...78and variable names like..foobar.baz. These were passed to the Liquid engine, which would throw an error for invalid Liquid. Theliquid-argsparser 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.