openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

index.html (1939B)


      1 <!doctype html>
      2 
      3 <title>CodeMirror: Soy (Closure Template) 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 <script src="../../lib/codemirror.js"></script>
      9 <script src="../../addon/edit/matchbrackets.js"></script>
     10 <script src="../htmlmixed/htmlmixed.js"></script>
     11 <script src="../xml/xml.js"></script>
     12 <script src="../javascript/javascript.js"></script>
     13 <script src="../css/css.js"></script>
     14 <script src="soy.js"></script>
     15 <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
     16 <div id=nav>
     17   <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
     18 
     19   <ul>
     20     <li><a href="../../index.html">Home</a>
     21     <li><a href="../../doc/manual.html">Manual</a>
     22     <li><a href="https://github.com/codemirror/codemirror">Code</a>
     23   </ul>
     24   <ul>
     25     <li><a href="../index.html">Language modes</a>
     26     <li><a class=active href="#">Soy (Closure Template)</a>
     27   </ul>
     28 </div>
     29 
     30 <article>
     31 <h2>Soy (Closure Template) mode</h2>
     32 <form><textarea id="code" name="code">
     33 {namespace example}
     34 
     35 /**
     36  * Says hello to the world.
     37  */
     38 {template .helloWorld}
     39   {@param name: string}
     40   {@param? score: number}
     41   Hello <b>{$name}</b>!
     42   <div>
     43     {if $score}
     44       <em>{$score} points</em>
     45     {else}
     46       no score
     47     {/if}
     48   </div>
     49 {/template}
     50 
     51 {template .alertHelloWorld kind="js"}
     52   alert('Hello World');
     53 {/template}
     54 </textarea></form>
     55 
     56     <script>
     57       var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
     58         lineNumbers: true,
     59         matchBrackets: true,
     60         mode: "text/x-soy",
     61         indentUnit: 2,
     62         indentWithTabs: false
     63       });
     64     </script>
     65 
     66     <p>A mode for <a href="https://developers.google.com/closure/templates/">Closure Templates</a> (Soy).</p>
     67     <p><strong>MIME type defined:</strong> <code>text/x-soy</code>.</p>
     68   </article>