| Index: lib/src/prism/components/prism-twig.js
|
| diff --git a/lib/src/prism/components/prism-twig.js b/lib/src/prism/components/prism-twig.js
|
| index b2fc48fb58f652a512f4e03adffb1597331e2aee..09208b7c5c96046b7ef8b4316cb4a6a2b81a2b7e 100644
|
| --- a/lib/src/prism/components/prism-twig.js
|
| +++ b/lib/src/prism/components/prism-twig.js
|
| @@ -1,46 +1,46 @@
|
| Prism.languages.twig = {
|
| 'comment': /\{#[\s\S]*?#\}/,
|
| 'tag': {
|
| - pattern: /(\{\{[\s\S]*?\}\}|\{%[\s\S]*?%\})/,
|
| + pattern: /\{\{[\s\S]*?\}\}|\{%[\s\S]*?%\}/,
|
| inside: {
|
| 'ld': {
|
| - pattern: /^(\{\{\-?|\{%\-?\s*\w+)/,
|
| + pattern: /^(?:\{\{\-?|\{%\-?\s*\w+)/,
|
| inside: {
|
| - 'punctuation': /^(\{\{|\{%)\-?/,
|
| + 'punctuation': /^(?:\{\{|\{%)\-?/,
|
| 'keyword': /\w+/
|
| }
|
| },
|
| 'rd': {
|
| - pattern: /\-?(%\}|\}\})$/,
|
| + pattern: /\-?(?:%\}|\}\})$/,
|
| inside: {
|
| 'punctuation': /.*/
|
| }
|
| },
|
| 'string': {
|
| - pattern: /("|')(\\?.)*?\1/,
|
| + pattern: /("|')(?:\\?.)*?\1/,
|
| inside: {
|
| - 'punctuation': /^('|")|('|")$/
|
| - }
|
| - },
|
| - 'keyword': /\b(if)\b/,
|
| - 'boolean': /\b(true|false|null)\b/,
|
| - 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,
|
| - 'operator': /==|=|!=|<|>|>=|<=|\+|\-|~|\*|\/|\/\/|%|\*\*|\|/,
|
| - 'space-operator': {
|
| - pattern: /(\s)(\b(not|b\-and|b\-xor|b\-or|and|or|in|matches|starts with|ends with|is)\b|\?|:|\?:)(?=\s)/,
|
| - lookbehind: true,
|
| - inside: {
|
| - 'operator': /.*/
|
| + 'punctuation': /^['"]|['"]$/
|
| }
|
| },
|
| + 'keyword': /\b(?:even|if|odd)\b/,
|
| + 'boolean': /\b(?:true|false|null)\b/,
|
| + 'number': /\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+([Ee][-+]?\d+)?)\b/,
|
| + 'operator': [
|
| + {
|
| + pattern: /(\s)(?:and|b\-and|b\-xor|b\-or|ends with|in|is|matches|not|or|same as|starts with)(?=\s)/,
|
| + lookbehind: true
|
| + },
|
| + /[=<>]=?|!=|\*\*?|\/\/?|\?:?|[-+~%|]/
|
| + ],
|
| 'property': /\b[a-zA-Z_][a-zA-Z0-9_]*\b/,
|
| - 'punctuation': /\(|\)|\[\]|\[|\]|\{|\}|:|\.|,/
|
| + 'punctuation': /[()\[\]{}:.,]/
|
| }
|
| },
|
|
|
| // The rest can be parsed as HTML
|
| 'other': {
|
| - pattern: /[\s\S]*/,
|
| + // We want non-blank matches
|
| + pattern: /\S(?:[\s\S]*\S)?/,
|
| inside: Prism.languages.markup
|
| }
|
| };
|
|
|