-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
11 changed files
with
739 additions
and
3 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
(function (Prism) { | ||
Prism.languages.velocity = Prism.languages.extend('markup', {}); | ||
|
||
var velocity = { | ||
'variable': { | ||
pattern: /(^|[^\\](?:\\\\)*)\$!?(?:[a-z][\w-]*(?:\([^)]*\))?(?:\.[a-z][\w-]*(?:\([^)]*\))?|\[[^\]]+])*|{[^}]+})/i, | ||
lookbehind: true, | ||
inside: {} // See below | ||
}, | ||
'string': { | ||
pattern: /"[^"]*"|'[^']*'/, | ||
greedy: true | ||
}, | ||
'number': /\b\d+\b/, | ||
'boolean': /\b(?:true|false)\b/, | ||
'operator': /[=!<>]=?|[+*/%-]|&&|\|\||\.\.|\b(?:eq|g[et]|l[et]|n(?:e|ot))\b/, | ||
'punctuation': /[(){}[\]:,.]/ | ||
}; | ||
|
||
velocity.variable.inside = { | ||
'string': velocity['string'], | ||
'function': { | ||
pattern: /([^\w-])[a-z][\w-]*(?=\()/, | ||
lookbehind: true | ||
}, | ||
'number': velocity['number'], | ||
'boolean': velocity['boolean'], | ||
'punctuation': velocity['punctuation'] | ||
}; | ||
|
||
Prism.languages.insertBefore('velocity', 'comment', { | ||
'unparsed': { | ||
pattern: /(^|[^\\])#\[\[[\s\S]*?]]#/, | ||
lookbehind: true, | ||
greedy: true, | ||
inside: { | ||
'punctuation': /^#\[\[|]]#$/ | ||
} | ||
}, | ||
'velocity-comment': [ | ||
{ | ||
pattern: /(^|[^\\])#\*[\s\S]*?\*#/, | ||
lookbehind: true, | ||
greedy: true, | ||
alias: 'comment' | ||
}, | ||
{ | ||
pattern: /(^|[^\\])##.*/, | ||
lookbehind: true, | ||
greedy: true, | ||
alias: 'comment' | ||
} | ||
], | ||
'directive': { | ||
pattern: /(^|[^\\](?:\\\\)*)#@?(?:[a-z][\w-]*|{[a-z][\w-]*})(?:\s*\((?:[^()]|\([^()]*\))*\))?/i, | ||
lookbehind: true, | ||
inside: { | ||
keyword: { | ||
pattern: /^#@?(?:[a-z][\w-]*|{[a-z][\w-]*})|\bin\b/, | ||
inside: { | ||
'punctuation': /[{}]/ | ||
} | ||
}, | ||
rest: velocity | ||
} | ||
}, | ||
'variable': velocity['variable'] | ||
}); | ||
|
||
Prism.languages.velocity['tag'].inside['attr-value'].inside.rest = Prism.languages.velocity; | ||
|
||
}(Prism)); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<h2>Comments</h2> | ||
<pre><code>## Single line comment | ||
#* Multi-line | ||
comment *#</code></pre> | ||
|
||
<h2>Unparsed sections</h2> | ||
<pre><code>## Section below is not parsed | ||
#[[ | ||
## This is not a comment | ||
]]#</code></pre> | ||
|
||
<h2>Variables</h2> | ||
<pre><code>$mud | ||
$customer.Name | ||
$flogger.getPromo( $mud ) | ||
$!{mudSlinger_9} | ||
$foo[0] | ||
$foo[$i] | ||
$foo["bar"] | ||
$foo.bar[1].junk | ||
$foo.callMethod()[1]</code></pre> | ||
|
||
<h2>Directives</h2> | ||
<pre><code>#set($foo.bar[1] = 3) | ||
#if($a==1)true enough#{else}no way!#end | ||
#macro( d ) | ||
<tr><td>$!bodyContent</td></tr> | ||
#end | ||
#@d()Hello!#end</code></pre> | ||
|
||
<h2>Integration with HTML</h2> | ||
<pre><code><html> | ||
<body> | ||
Hello $customer.Name! | ||
<table> | ||
#foreach( $mud in $mudsOnSpecial ) | ||
#if ( $customer.hasPurchased($mud) ) | ||
<tr> | ||
<td> | ||
$flogger.getPromo( $mud ) | ||
</td> | ||
</tr> | ||
#end | ||
#end | ||
</table> | ||
</body> | ||
</html></code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.