Skip to content

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

@nemossi

Description

@nemossi

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 {{...}}.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions