handlebars-lang / handlebars-lang/handlebars.js
Error when using `~` within `{{{...}}}`
Open
Nobody has claimed this yet.
docs-needed
- Dominant language
- JavaScript
- Stars
- 18.7k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
Example 1:
Code:
const Handlebars = require('handlebars');
var tpl = Handlebars.compile("123\n{{{~myvar}}}\n123");
tpl({myvar: '<myvar>'});
Result:
Uncaught Error: Parse error on line 2:
123{{{~myvar}}}123
------^
Expecting 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'INVALID'
Example 2:
Code:
const Handlebars = require('handlebars');
var tpl = Handlebars.compile("123\n{{{myvar~}}}\n123");
tpl({myvar: '<myvar>'});
Result:
Uncaught Error: Parse error on line 2:
123{{{myvar~}}}123
-----------^
Expecting 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'CLOSE'
Node.js: v21.6.2
handlebars: v4.7.8
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing both examples with Node.js and Handlebars.compile, then trace the Handlebars parser entry point for triple-stash expressions containing ~. Done means both leading and trailing ~ forms parse and render the supplied value without errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- handlebars, javascript, node.js
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100