Merge pull request #4063 from claylibrarymarket/main

Fix Twig's plain text class expression
This commit is contained in:
Henning Dieterichs 2023-07-07 17:42:03 +02:00 committed by GitHub
commit 0365f0ed20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 1 deletions

View file

@ -734,6 +734,15 @@ testTokenization(
tokens: [{ startIndex: 0, type: 'comment.twig' }] tokens: [{ startIndex: 0, type: 'comment.twig' }]
} }
], ],
[
{
line: 'test {# Hello World! #}',
tokens: [
{ startIndex: 0, type: '' },
{ startIndex: 5, type: 'comment.twig' }
]
}
],
[ [
{ {
line: '{#Hello World!#}', line: '{#Hello World!#}',
@ -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) }}', line: '{{ foo(42) }}',
@ -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 %}', line: '{% for item in navigation %}',

View file

@ -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' }]],
[/(<\/)((?:[\w\-]+:)?[\w\-]+)/, ['delimiter.html', { token: 'tag.html', next: '@otherTag' }]], [/(<\/)((?:[\w\-]+:)?[\w\-]+)/, ['delimiter.html', { token: 'tag.html', next: '@otherTag' }]],
[/</, 'delimiter.html'], [/</, 'delimiter.html'],
[/[^<]+/] // text [/[^<{]+/] // text
], ],
/** /**