Framework agnostic template expression parser
npm install --save @starptech/expression-parser
This example shows how we parse HTML
const parse =const result =
unescape: Indentify a template marker as escaped. This information is useful to understand why a marker was skipped
expressions: A list of template expressions
start: Start position
end: End position
text: The content of the expression
There may be more than one expression as part of one attribute value or text node, or only one replacing the entire value or node.
When used as the whole attribute value, there's no need to enclose the expression inside quotes, even if the expression contains whitespace.
Single and double quotes can be nested inside the expression.
To emit opening (left) brackets as literal text wherever an opening bracket is expected, the bracket must be prefixed with a backslash (the JS escape char ''). This character is preserved in the output, but the parser will add a replace property for the attribute or node containing the escaped bracket, whose value is the bracket itself.
The parser is a modificated version of Riot template expression parser.