github.com/elliott5/community@v0.14.1-0.20160709191136-823126fb026a/app/public/codemirror/mode/velocity/index.html (about)

     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  #macro( tablerows $color $somelist )
    81      #foreach( $something in $somelist )
    82          <tr><td bgcolor=$color>$something</td></tr>
    83          <tr><td bgcolor=$color>$bodyContent</td></tr>
    84      #end
    85  #end
    86  
    87  #tablerows("red" ["dadsdf","dsa"])
    88  #@tablerows("red" ["dadsdf","dsa"]) some body content #end
    89  
    90     Variable reference: #set( $monkey = $bill )
    91     String literal: #set( $monkey.Friend = 'monica' )
    92     Property reference: #set( $monkey.Blame = $whitehouse.Leak )
    93     Method reference: #set( $monkey.Plan = $spindoctor.weave($web) )
    94     Number literal: #set( $monkey.Number = 123 )
    95     Range operator: #set( $monkey.Numbers = [1..3] )
    96     Object list: #set( $monkey.Say = ["Not", $my, "fault"] )
    97     Object map: #set( $monkey.Map = {"banana" : "good", "roast beef" : "bad"})
    98  
    99  The RHS can also be a simple arithmetic expression, such as:
   100  Addition: #set( $value = $foo + 1 )
   101     Subtraction: #set( $value = $bar - 1 )
   102     Multiplication: #set( $value = $foo * $bar )
   103     Division: #set( $value = $foo / $bar )
   104     Remainder: #set( $value = $foo % $bar )
   105  
   106  </textarea></form>
   107      <script>
   108        var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
   109          theme: "night",
   110          lineNumbers: true,
   111          indentUnit: 4,
   112          mode: "text/velocity"
   113        });
   114      </script>
   115  
   116      <p><strong>MIME types defined:</strong> <code>text/velocity</code>.</p>
   117  
   118    </article>