Skip to content

Expose parse/parseWithoutProcessing in the IHandlebars interface #369

@oformaniuk

Description

@oformaniuk

Original issue: oformaniuk/issues/27

This would be very useful to allow a user to extract the tokens from a template and then be able to extract the variables required for a particular template. The feature of extracting the variables was requested long ago here in the native handlebars.js and ultimately is what I would love to see implemented as well.

handlebars-lang/handlebars.js#1207

Currently there is no way to have the compiler parse the template for tokens and simply return the results in the interface. The compiler and applicable helpers are internal classes / methods so there is no good way to extract this information now.

Alternatively, simply exposing all the variable names required by a template would be the best but this is not currently available in the handlerbars lang.

The handlebars api has methods to parse and parseWithoutProcessing returning the ast/tokens.

https://github.com/handlebars-lang/handlebars.js/blob/master/docs/compiler-api.md

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions