handlebars.java icon indicating copy to clipboard operation
handlebars.java copied to clipboard

Collect variables AND options

Open chrisrueger opened this issue 3 years ago • 0 comments

Assume a template like from here:

{{blog this s="string" b=true n=678}}

Doing

String template = "{{blog this s=\"string\" b=true n=678}}";
Template t = handlebars.compileInline(template);
Collection<String> vars = t.collect(TagType.values());
System.out.println(vars);

Outputs:

[blog]

Question

I would also like to get the passed options and their valuess: s, b, n and "string", "true", "678"

I would want it probably as a Map.

Is this possible?

We want to use the extracted variables and values to build a UI / Form fields. The passed parameters would be configuration e.g. so that we know if we render a textfield or a dropdown, and maybe default values etc.

chrisrueger avatar Dec 11 '21 23:12 chrisrueger