12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- Prism.languages.aspnet = Prism.languages.extend('markup', {
- 'page-directive tag': {
- pattern: /<%\s*@.*%>/i,
- inside: {
- 'page-directive tag': /<%\s*@\s*(?:Assembly|Control|Implements|Import|Master|MasterType|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
- }
- }
- });
- // 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': {
- pattern: /<script(?=.*runat=['"]?server['"]?)[\w\W]*?>[\w\W]*?<\/script>/i,
- inside: {
- tag: {
- pattern: /<\/?script\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/i,
- inside: Prism.languages.aspnet.tag.inside
- },
- rest: Prism.languages.csharp || {}
- }
- }
- });
- // Hacks to fix eager tag matching finishing too early: <script src="<% Foo.Bar %>"> => <script src="<% Foo.Bar %>
- if ( Prism.languages.aspnet.style ) {
- Prism.languages.aspnet.style.inside.tag.pattern = /<\/?style\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/i;
- Prism.languages.aspnet.style.inside.tag.inside = Prism.languages.aspnet.tag.inside;
- }
- if ( Prism.languages.aspnet.script ) {
- Prism.languages.aspnet.script.inside.tag.pattern = Prism.languages.aspnet['asp script'].inside.tag.pattern;
- Prism.languages.aspnet.script.inside.tag.inside = Prism.languages.aspnet.tag.inside;
- }
|