Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1983)

Unified Diff: lib/src/prism/components/prism-twig.js

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/prism/components/prism-textile.min.js ('k') | lib/src/prism/components/prism-twig.min.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
}
};
« no previous file with comments | « lib/src/prism/components/prism-textile.min.js ('k') | lib/src/prism/components/prism-twig.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698