Skip to content

Commit

Permalink
Merge pull request #4063 from claylibrarymarket/main
Browse files Browse the repository at this point in the history
Fix Twig's plain text class expression
  • Loading branch information
hediet authored Jul 7, 2023
2 parents e6c4ace + e1e946a commit 0365f0e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 33 additions & 0 deletions src/basic-languages/twig/twig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,15 @@ testTokenization(
tokens: [{ startIndex: 0, type: 'comment.twig' }]
}
],
[
{
line: 'test {# Hello World! #}',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 5, type: 'comment.twig' }
]
}
],
[
{
line: '{#Hello World!#}',
Expand Down Expand Up @@ -860,6 +869,19 @@ testTokenization(
]
}
],
[
{
line: 'test {{ foo }}',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 5, type: 'delimiter.twig' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'variable.twig' },
{ startIndex: 11, type: '' },
{ startIndex: 12, type: 'delimiter.twig' }
]
}
],
[
{
line: '{{ foo(42) }}',
Expand Down Expand Up @@ -962,6 +984,17 @@ testTokenization(
]
}
],
[
{
line: 'test {% %}',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 5, type: 'delimiter.twig' },
{ startIndex: 7, type: '' },
{ startIndex: 8, type: 'delimiter.twig' }
]
}
],
[
{
line: '{% for item in navigation %}',
Expand Down
2 changes: 1 addition & 1 deletion src/basic-languages/twig/twig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const language = <languages.IMonarchLanguage>{
[/(<)((?:[\w\-]+:)?[\w\-]+)/, ['delimiter.html', { token: 'tag.html', next: '@otherTag' }]],
[/(<\/)((?:[\w\-]+:)?[\w\-]+)/, ['delimiter.html', { token: 'tag.html', next: '@otherTag' }]],
[/</, 'delimiter.html'],
[/[^<]+/] // text
[/[^<{]+/] // text
],

/**
Expand Down

0 comments on commit 0365f0e

Please sign in to comment.