main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | 'use strict'
|
---|
| 2 |
|
---|
| 3 | module.exports = t4Templating
|
---|
| 4 | t4Templating.displayName = 't4Templating'
|
---|
| 5 | t4Templating.aliases = []
|
---|
| 6 | function t4Templating(Prism) {
|
---|
| 7 | ;(function (Prism) {
|
---|
| 8 | function createBlock(prefix, inside, contentAlias) {
|
---|
| 9 | return {
|
---|
| 10 | pattern: RegExp('<#' + prefix + '[\\s\\S]*?#>'),
|
---|
| 11 | alias: 'block',
|
---|
| 12 | inside: {
|
---|
| 13 | delimiter: {
|
---|
| 14 | pattern: RegExp('^<#' + prefix + '|#>$'),
|
---|
| 15 | alias: 'important'
|
---|
| 16 | },
|
---|
| 17 | content: {
|
---|
| 18 | pattern: /[\s\S]+/,
|
---|
| 19 | inside: inside,
|
---|
| 20 | alias: contentAlias
|
---|
| 21 | }
|
---|
| 22 | }
|
---|
| 23 | }
|
---|
| 24 | }
|
---|
| 25 | function createT4(insideLang) {
|
---|
| 26 | var grammar = Prism.languages[insideLang]
|
---|
| 27 | var className = 'language-' + insideLang
|
---|
| 28 | return {
|
---|
| 29 | block: {
|
---|
| 30 | pattern: /<#[\s\S]+?#>/,
|
---|
| 31 | inside: {
|
---|
| 32 | directive: createBlock('@', {
|
---|
| 33 | 'attr-value': {
|
---|
| 34 | pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/,
|
---|
| 35 | inside: {
|
---|
| 36 | punctuation: /^=|^["']|["']$/
|
---|
| 37 | }
|
---|
| 38 | },
|
---|
| 39 | keyword: /\b\w+(?=\s)/,
|
---|
| 40 | 'attr-name': /\b\w+/
|
---|
| 41 | }),
|
---|
| 42 | expression: createBlock('=', grammar, className),
|
---|
| 43 | 'class-feature': createBlock('\\+', grammar, className),
|
---|
| 44 | standard: createBlock('', grammar, className)
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
| 48 | }
|
---|
| 49 | Prism.languages['t4-templating'] = Object.defineProperty({}, 'createT4', {
|
---|
| 50 | value: createT4
|
---|
| 51 | })
|
---|
| 52 | })(Prism)
|
---|
| 53 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.