aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/mode/velocity/index.html
diff options
context:
space:
mode:
authorEric Guzman2012-02-16 00:22:43 -0800
committerEric Guzman2012-02-16 00:22:43 -0800
commit82b1a273219f0ae3d119e156c7acccdbe478f441 (patch)
tree74c45e5e3afc6706b2f7a7918807f72c54cdcfc5 /imports/codemirror/mode/velocity/index.html
parentaf20ca9b11133dd5cefb9275dbe8fb101c3380d0 (diff)
parent966f0adaf1d4b7f2dd5a6e31643df58bff713884 (diff)
downloadninja-82b1a273219f0ae3d119e156c7acccdbe478f441.tar.gz
Merge branch 'refs/heads/TreeComponents' into PresetsPanel
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>