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

Support for {{$guid}} Syntax in Fluid Templates #736

Open
nemossi opened this issue Dec 24, 2024 · 0 comments
Open

Support for {{$guid}} Syntax in Fluid Templates #736

nemossi opened this issue Dec 24, 2024 · 0 comments

Comments

@nemossi
Copy link

nemossi commented Dec 24, 2024

Hi, I have been using Fluid and greatly appreciate its flexibility and performance. However, I came across a limitation when attempting to implement custom dynamic variables or directives using the {{...}} syntax. Specifically, I would like to support cases like: {{$guid}}. where $guid is a dynamic directive that generates a value at render time (e.g., a GUID).

Currently, this syntax is not supported because Fluid interprets the {{...}} syntax as an expression and expects the content to resolve to a context variable. This makes it challenging to define custom dynamic tags or directives without resorting to {% ... %} blocks or other workarounds. I tried implementing this behavior by extending FluidParser and using RegisterTag, but:

  • It seems that RegisterTag is specifically tied to {% ... %} syntax.
  • {{$guid}} is not acceptable by parser as a valid template string.

Request:

Would it be possible to introduce support for custom tags or directives within the {{...}} syntax? For example:

  • Allow parsing and handling custom directives like {{$...}} as an extension point in FluidParser.
  • Provide a hook or registration method for handling such patterns, similar to RegisterParserTag but scoped to {{...}}.
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

No branches or pull requests

1 participant