File modules/editor/codemirror/mode/velocity/index.html

Last commit: Sun Dec 17 01:14:09 2017 +0100	Jan Dankert	Integration eines weiteren Code-Editors: Codemirror. Demnächst müssen wir hier mal aufräumen und andere Editoren rauswerfen.
1 <!doctype html> 2 3 <title>CodeMirror: Velocity mode</title> 4 <meta charset="utf-8"/> 5 <link rel=stylesheet href="../../doc/docs.css"> 6 7 <link rel="stylesheet" href="../../lib/codemirror.css"> 8 <link rel="stylesheet" href="../../theme/night.css"> 9 <script src="../../lib/codemirror.js"></script> 10 <script src="velocity.js"></script> 11 <style>.CodeMirror {border: 1px solid black;}</style> 12 <div id=nav> 13 <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> 14 15 <ul> 16 <li><a href="../../index.html">Home</a> 17 <li><a href="../../doc/manual.html">Manual</a> 18 <li><a href="https://github.com/codemirror/codemirror">Code</a> 19 </ul> 20 <ul> 21 <li><a href="../index.html">Language modes</a> 22 <li><a class=active href="#">Velocity</a> 23 </ul> 24 </div> 25 26 <article> 27 <h2>Velocity mode</h2> 28 <form><textarea id="code" name="code"> 29 ## Velocity Code Demo 30 #* 31 based on PL/SQL mode by Peter Raganitsch, adapted to Velocity by Steve O'Hara ( http://www.pivotal-solutions.co.uk ) 32 August 2011 33 *# 34 35 #* 36 This is a multiline comment. 37 This is the second line 38 *# 39 40 #[[ hello steve 41 This has invalid syntax that would normally need "poor man's escaping" like: 42 43 #define() 44 45 ${blah 46 ]]# 47 48 #include( "disclaimer.txt" "opinion.txt" ) 49 #include( $foo $bar ) 50 51 #parse( "lecorbusier.vm" ) 52 #parse( $foo ) 53 54 #evaluate( 'string with VTL #if(true)will be displayed#end' ) 55 56 #define( $hello ) Hello $who #end #set( $who = "World!") $hello ## displays Hello World! 57 58 #foreach( $customer in $customerList ) 59 60 $foreach.count $customer.Name 61 62 #if( $foo == ${bar}) 63 it's true! 64 #break 65 #{else} 66 it's not! 67 #stop 68 #end 69 70 #if ($foreach.parent.hasNext) 71 $velocityCount 72 #end 73 #end 74 75 $someObject.getValues("this is a string split 76 across lines") 77 78 $someObject("This plus $something in the middle").method(7567).property 79 80 #set($something = "Parseable string with '$quotes'!") 81 82 #macro( tablerows $color $somelist ) 83 #foreach( $something in $somelist ) 84 <tr><td bgcolor=$color>$something</td></tr> 85 <tr><td bgcolor=$color>$bodyContent</td></tr> 86 #end 87 #end 88 89 #tablerows("red" ["dadsdf","dsa"]) 90 #@tablerows("red" ["dadsdf","dsa"]) some body content #end 91 92 Variable reference: #set( $monkey = $bill ) 93 String literal: #set( $monkey.Friend = 'monica' ) 94 Property reference: #set( $monkey.Blame = $whitehouse.Leak ) 95 Method reference: #set( $monkey.Plan = $spindoctor.weave($web) ) 96 Number literal: #set( $monkey.Number = 123 ) 97 Range operator: #set( $monkey.Numbers = [1..3] ) 98 Object list: #set( $monkey.Say = ["Not", $my, "fault"] ) 99 Object map: #set( $monkey.Map = {"banana" : "good", "roast beef" : "bad"}) 100 101 The RHS can also be a simple arithmetic expression, such as: 102 Addition: #set( $value = $foo + 1 ) 103 Subtraction: #set( $value = $bar - 1 ) 104 Multiplication: #set( $value = $foo * $bar ) 105 Division: #set( $value = $foo / $bar ) 106 Remainder: #set( $value = $foo % $bar ) 107 108 </textarea></form> 109 <script> 110 var editor = CodeMirror.fromTextArea(document.getElementById("code"), { 111 theme: "night", 112 lineNumbers: true, 113 indentUnit: 4, 114 mode: "text/velocity" 115 }); 116 </script> 117 118 <p><strong>MIME types defined:</strong> <code>text/velocity</code>.</p> 119 120 </article>
Download modules/editor/codemirror/mode/velocity/index.html
History Sun, 17 Dec 2017 01:14:09 +0100 Jan Dankert Integration eines weiteren Code-Editors: Codemirror. Demnächst müssen wir hier mal aufräumen und andere Editoren rauswerfen.