Skip to content

Commit

Permalink
fix: concat expression inside html attribute value
Browse files Browse the repository at this point in the history
Close GH-110
  • Loading branch information
zackad committed Jan 4, 2025
1 parent 51f1014 commit 757f7de
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## unreleased

### Bugfix
- [GH-110](https://github.com/zackad/prettier-plugin-twig/issues/90) Fix regression when parsing concatenation expression inside html attribute value

### Internals
- DX: Don't use alias to export print function to make it easier to identify when debugging call stack

Expand Down
3 changes: 3 additions & 0 deletions src/melody/melody-parser/Lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,9 @@ export default class Lexer {
if (c === "\\" && input.la(1) === start) {
input.next();
input.next();
} else if (c === "{" && input.la(1) === "{") {
// interpolation start
break;
} else if (c === start) {
break;
} else {
Expand Down
3 changes: 3 additions & 0 deletions tests/Element/__snapshots__/attributes.snap.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{# https://github.com/zackad/prettier-plugin-twig/issues/110 #}
<section class="sm:p-0 p-0 text-{{ i }}"></section>

<a href="#abcd" target="_blank" lang="en">Link</a>

<fantasy
Expand Down
3 changes: 3 additions & 0 deletions tests/Element/attributes.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{# https://github.com/zackad/prettier-plugin-twig/issues/110 #}
<section class="sm:p-0 p-0 text-{{ i }}"></section>

<a href="#abcd" target="_blank" lang="en" >Link</a>

<fantasy {{ {
Expand Down

0 comments on commit 757f7de

Please sign in to comment.