5 <title>CodeMirror: Velocity mode</title>
6 <link rel="stylesheet" href="../../lib/codemirror.css">
7 <script src="../../lib/codemirror.js"></script>
8 <script src="velocity.js"></script>
9 <link rel="stylesheet" href="../../theme/night.css">
10 <style>.CodeMirror {border: 1px solid black;}</style>
11 <link rel="stylesheet" href="../../doc/docs.css">
14 <h1>CodeMirror: Velocity mode</h1>
15 <form><textarea id="code" name="code">
18 based on PL/SQL mode by Peter Raganitsch, adapted to Velocity by Steve O'Hara ( http://www.pivotal-solutions.co.uk )
23 This is a multiline comment.
24 This is the second line
28 This has invalid syntax that would normally need "poor man's escaping" like:
35 #include( "disclaimer.txt" "opinion.txt" )
38 #parse( "lecorbusier.vm" )
41 #evaluate( 'string with VTL #if(true)will be displayed#end' )
43 #define( $hello ) Hello $who #end #set( $who = "World!") $hello ## displays Hello World!
45 #foreach( $customer in $customerList )
47 $foreach.count $customer.Name
57 #if ($foreach.parent.hasNext)
62 $someObject.getValues("this is a string split
65 #macro( tablerows $color $somelist )
66 #foreach( $something in $somelist )
67 <tr><td bgcolor=$color>$something</td></tr>
71 #tablerows("red" ["dadsdf","dsa"])
73 Variable reference: #set( $monkey = $bill )
74 String literal: #set( $monkey.Friend = 'monica' )
75 Property reference: #set( $monkey.Blame = $whitehouse.Leak )
76 Method reference: #set( $monkey.Plan = $spindoctor.weave($web) )
77 Number literal: #set( $monkey.Number = 123 )
78 Range operator: #set( $monkey.Numbers = [1..3] )
79 Object list: #set( $monkey.Say = ["Not", $my, "fault"] )
80 Object map: #set( $monkey.Map = {"banana" : "good", "roast beef" : "bad"})
82 The RHS can also be a simple arithmetic expression, such as:
83 Addition: #set( $value = $foo + 1 )
84 Subtraction: #set( $value = $bar - 1 )
85 Multiplication: #set( $value = $foo * $bar )
86 Division: #set( $value = $foo / $bar )
87 Remainder: #set( $value = $foo % $bar )
91 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
100 <p><strong>MIME types defined:</strong> <code>text/velocity</code>.</p>