Blame view

bower_components/prism/components/prism-twig.js 1.03 KB
73bcce88   luigser   COMPONENTS
1
2
3
  Prism.languages.twig = {
  	'comment': /\{#[\s\S]*?#\}/,
  	'tag': {
eb240478   Luigi Serra   public room cards...
4
  		pattern: /\{\{[\s\S]*?\}\}|\{%[\s\S]*?%\}/,
73bcce88   luigser   COMPONENTS
5
6
  		inside: {
  			'ld': {
eb240478   Luigi Serra   public room cards...
7
  				pattern: /^(?:\{\{\-?|\{%\-?\s*\w+)/,
73bcce88   luigser   COMPONENTS
8
  				inside: {
eb240478   Luigi Serra   public room cards...
9
  					'punctuation': /^(?:\{\{|\{%)\-?/,
73bcce88   luigser   COMPONENTS
10
11
12
13
  					'keyword': /\w+/
  				}
  			},
  			'rd': {
eb240478   Luigi Serra   public room cards...
14
  				pattern: /\-?(?:%\}|\}\})$/,
73bcce88   luigser   COMPONENTS
15
16
17
18
19
  				inside: {
  					'punctuation': /.*/
  				}
  			},
  			'string': {
eb240478   Luigi Serra   public room cards...
20
  				pattern: /("|')(?:\\?.)*?\1/,
73bcce88   luigser   COMPONENTS
21
  				inside: {
eb240478   Luigi Serra   public room cards...
22
  					'punctuation': /^['"]|['"]$/
73bcce88   luigser   COMPONENTS
23
24
  				}
  			},
eb240478   Luigi Serra   public room cards...
25
26
27
28
29
30
31
32
33
34
  			'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
  				},
  				/[=<>]=?|!=|\*\*?|\/\/?|\?:?|[-+~%|]/
  			],
73bcce88   luigser   COMPONENTS
35
  			'property': /\b[a-zA-Z_][a-zA-Z0-9_]*\b/,
eb240478   Luigi Serra   public room cards...
36
  			'punctuation': /[()\[\]{}:.,]/
73bcce88   luigser   COMPONENTS
37
38
39
40
41
  		}
  	},
  
  	// The rest can be parsed as HTML
  	'other': {
eb240478   Luigi Serra   public room cards...
42
43
  		// We want non-blank matches
  		pattern: /\S(?:[\s\S]*\S)?/,
73bcce88   luigser   COMPONENTS
44
45
46
  		inside: Prism.languages.markup
  	}
  };