Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved parsing of flavor-specific tag 'include_relative' #300

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

pmenhart
Copy link
Contributor

  • In Jekyll style, I found that 'include_relative' is incorrectly represented as token SimpleTag, instead of IncludeRelative (as expected in PR [WIP] include_relative tag support #288). Seems to be caused by Lexer action which should be executed only for Liquid style.
  • As a consequence, filename components were parsed as separate parameters instead of token file_name_or_output. This behaviour got unnoticed only because all parameters were incorrectly concatenated into one string (which is my main concern; to be fixed outside of this PR)
  • In Liquid style, tag 'include_relative' has no default implementation (token InvalidTagId), but can be defined as a custom block (token SimpleBlock) or a tag (SimpleTag). Lexer action works correctly for these checks.
  • To facilitate flavor-specific lexical analysis, I am adding flag isLiquidStyleInclude to LiquidLexer; same flag was added to the LiquidParser in include with with syntax should throw an expection in Jekyll flavour #196.

@msangel Please let me know if you see a better or simpler solution. I do not work with Jekyll, I am submitting this change as a prerequisite for rendering of custom tags with two or more parameters in Liquid.

* In Jekyll style, 'include_relative' was represented as token SimpleTag,
  instead of IncludeRelative, as expected since PR bkiers#288.
* As a consequence, filename components were parsed as separate parameters
  instead of token file_name_or_output. This behaviour got unnoticed only
  because all parameters were incorrectly concatenated into one string
  (to be fixed outside of this commit)
* In Liquid style, tag 'include_relative' is not defined (token InvalidTagId),
  but can be defined as a custom block (token SimpleBlock) or a tag (SimpleTag).
* To facilitate flavor-specific lexical analysis, flag isLiquidStyleInclude was
  was added to LiquidLexer; same code as in the LiquidParser since bkiers#196
@msangel msangel merged commit 085001d into bkiers:master Apr 24, 2024
4 checks passed
@msangel
Copy link
Collaborator

msangel commented Apr 24, 2024

Good point. I added that flag to parser but in fact it should be in lexer.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants