Skip to content

Commit

Permalink
allow in-tag mustaches to precede multi-line start
Browse files Browse the repository at this point in the history
  • Loading branch information
jakesjews committed Oct 24, 2019
1 parent 219d893 commit aed6d9a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/pegjs/html/tag-html.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ start = tagHtml
This also needs to absorb comments for when using brackets
*/
tagHtml
= h:htmlStart __ '[' TERM* inTagMustaches:inTagMustache* fullAttributes:bracketedAttribute+ (_ inlineComment _ TERM)*
= h:htmlStart startingInTagMustaches:inTagMustache* __ '[' TERM* inTagMustaches:inTagMustache* fullAttributes:bracketedAttribute+ (_ inlineComment _ TERM)*
{
return parseInHtml(h, inTagMustaches, fullAttributes);
return parseInHtml(h, startingInTagMustaches.concat(inTagMustaches), fullAttributes);
}
/ h:htmlStart inTagMustaches:inTagMustache* fullAttributes:attribute*
{
Expand Down
10 changes: 10 additions & 0 deletions tests/integration/mustache/html-attributes-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,14 @@ module('mustache: html attributes', function (hooks) {
test("with doublestache", function (assert) {
assert.compilesTo('p{{insertClass foo}} Hello', '<p {{insertClass foo}}>Hello</p>');
});

test("with multi-line", function (assert) {
const emblem = w(
"div{did-insert this.handler} [",
" class='test'",
"]",
);

assert.compilesTo(emblem, '<div {{did-insert this.handler}} class="test"></div>');
});
});

0 comments on commit aed6d9a

Please sign in to comment.