aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/mode/velocity/index.html
diff options
context:
space:
mode:
authorPushkar Joshi2012-02-24 12:08:49 -0800
committerPushkar Joshi2012-02-24 12:08:49 -0800
commit03ca7a5ed13c25faaa9100bb666e062fd15335e6 (patch)
treec51112223ceb9121cd595a60335eb2795215590f /imports/codemirror/mode/velocity/index.html
parentfcb12cc09eb3cd3b42bd215877ba18f449275b75 (diff)
parent053fc63a2950c7a5ee4ebf98033b64d474a3c46e (diff)
downloadninja-03ca7a5ed13c25faaa9100bb666e062fd15335e6.tar.gz
Merge branch 'pentool' into brushtool
Conflicts: imports/codemirror/mode/scheme/scheme.js js/tools/BrushTool.js
Diffstat (limited to 'imports/codemirror/mode/velocity/index.html')
-rwxr-xr-ximports/codemirror/mode/velocity/index.html103
1 files changed, 103 insertions, 0 deletions
diff --git a/imports/codemirror/mode/velocity/index.html b/imports/codemirror/mode/velocity/index.html
new file mode 100755
index 00000000..49dba382
--- /dev/null
+++ b/imports/codemirror/mode/velocity/index.html
@@ -0,0 +1,103 @@
1<!doctype html>
2<html>
3 <head>
4 <title>CodeMirror: Velocity mode</title>
5 <link rel="stylesheet" href="../../lib/codemirror.css">
6 <script src="../../lib/codemirror.js"></script>
7 <script src="velocity.js"></script>
8 <link rel="stylesheet" href="../../theme/night.css">
9 <style>.CodeMirror {border: 1px solid black;}</style>
10 <link rel="stylesheet" href="../../doc/docs.css">
11 </head>
12 <body>
13 <h1>CodeMirror: Velocity mode</h1>
14 <form><textarea id="code" name="code">
15## Velocity Code Demo
16#*
17 based on PL/SQL mode by Peter Raganitsch, adapted to Velocity by Steve O'Hara ( http://www.pivotal-solutions.co.uk )
18 August 2011
19*#
20
21#*
22 This is a multiline comment.
23 This is the second line
24*#
25
26#[[ hello steve
27 This has invalid syntax that would normally need "poor man's escaping" like:
28
29 #define()
30
31 ${blah
32]]#
33
34#include( "disclaimer.txt" "opinion.txt" )
35#include( $foo $bar )
36
37#parse( "lecorbusier.vm" )
38#parse( $foo )
39
40#evaluate( 'string with VTL #if(true)will be displayed#end' )
41
42#define( $hello ) Hello $who #end #set( $who = "World!") $hello ## displays Hello World!
43
44#foreach( $customer in $customerList )
45
46 $foreach.count $customer.Name
47
48 #if( $foo == ${bar})
49 it's true!
50 #break
51 #{else}
52 it's not!
53 #stop
54 #end
55
56 #if ($foreach.parent.hasNext)
57 $velocityCount
58 #end
59#end
60
61$someObject.getValues("this is a string split
62 across lines")
63
64#macro( tablerows $color $somelist )
65 #foreach( $something in $somelist )
66 <tr><td bgcolor=$color>$something</td></tr>
67 #end
68#end
69
70#tablerows("red" ["dadsdf","dsa"])
71
72 Variable reference: #set( $monkey = $bill )
73 String literal: #set( $monkey.Friend = 'monica' )
74 Property reference: #set( $monkey.Blame = $whitehouse.Leak )
75 Method reference: #set( $monkey.Plan = $spindoctor.weave($web) )
76 Number literal: #set( $monkey.Number = 123 )
77 Range operator: #set( $monkey.Numbers = [1..3] )
78 Object list: #set( $monkey.Say = ["Not", $my, "fault"] )
79 Object map: #set( $monkey.Map = {"banana" : "good", "roast beef" : "bad"})
80
81The RHS can also be a simple arithmetic expression, such as:
82Addition: #set( $value = $foo + 1 )
83 Subtraction: #set( $value = $bar - 1 )
84 Multiplication: #set( $value = $foo * $bar )
85 Division: #set( $value = $foo / $bar )
86 Remainder: #set( $value = $foo % $bar )
87
88</textarea></form>
89 <script>
90 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
91 tabMode: "indent",
92 matchBrackets: true,
93 theme: "night",
94 lineNumbers: true,
95 indentUnit: 4,
96 mode: "text/velocity"
97 });
98 </script>
99
100 <p><strong>MIME types defined:</strong> <code>text/velocity</code>.</p>
101
102 </body>
103</html>