Handlebars-Net / Handlebars.Net

A real .NET Handlebars engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Is it possible to get raw parameters from template?

Cubody opened this issue · comments

Is there any built-in way to get parameters from a template? Something like hb.Create().GetParameters("{{some_parameter}}") with return of string[] { "some_parameter" }.

As I've seen, all the parsing functions are internal. It would be nice to have some kind of option to get the parameters.
I can do a PR for such a thing if you let me know how to do it in the best way.

First, the template turns into tokens, and then expressions are built. As I understand it, the library understands exactly where the parameters are at the moment of the expression build.

Also, I don't see any reason to make it internal, it seems like a useful tool for template analyze.

You can use helperMissing to get somewhat similar behavior. If this is not something you're looking for - this is not the first time such functionality is requested so I'd be happy to merge PR enabling this.