Blame view

bower_components/prism/components/prism-aspnet.js 1.27 KB
73bcce88   luigser   COMPONENTS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  Prism.languages.aspnet = Prism.languages.extend('markup', {
  	'page-directive tag': {
  		pattern: /<%\s*@.*%>/i,
  		inside: {
  			'page-directive tag': /<%\s*@\s*(?:Assembly|Control|Implements|Import|Master(?:Type)?|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/i,
  			rest: Prism.languages.markup.tag.inside
  		}
  	},
  	'directive tag': {
  		pattern: /<%.*%>/i,
  		inside: {
  			'directive tag': /<%\s*?[$=%#:]{0,2}|%>/i,
  			rest: Prism.languages.csharp
  		}
  	}
  });
  // Regexp copied from prism-markup, with a negative look-ahead added
  Prism.languages.aspnet.tag.pattern = /<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i;
  
  // match directives of attribute value foo="<% Bar %>"
  Prism.languages.insertBefore('inside', 'punctuation', {
  	'directive tag': Prism.languages.aspnet['directive tag']
  }, Prism.languages.aspnet.tag.inside["attr-value"]);
  
  Prism.languages.insertBefore('aspnet', 'comment', {
  	'asp comment': /<%--[\w\W]*?--%>/
  });
  
  // script runat="server" contains csharp, not javascript
  Prism.languages.insertBefore('aspnet', Prism.languages.javascript ? 'script' : 'tag', {
  	'asp script': {
eb240478   Luigi Serra   public room cards...
32
33
34
  		pattern: /(<script(?=.*runat=['"]?server['"]?)[\w\W]*?>)[\w\W]*?(?=<\/script>)/i,
  		lookbehind: true,
  		inside: Prism.languages.csharp || {}
73bcce88   luigser   COMPONENTS
35
  	}
eb240478   Luigi Serra   public room cards...
36
  });