Subversion-Projekte lars-tiefland.ci

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
776 lars 1
<!doctype html>
2
<title>CodeMirror: Handlebars mode</title>
3
<meta charset="utf-8" />
4
<link rel=stylesheet href="../../doc/docs.css">
5
<link rel="stylesheet" href="../../lib/codemirror.css">
6
<script src="../../lib/codemirror.js"></script>
7
<script src="../../addon/mode/simple.js"></script>
8
<script src="../../addon/mode/multiplex.js"></script>
9
<script src="../xml/xml.js"></script>
10
<script src="handlebars.js"></script>
11
<style>
12
    .CodeMirror {
13
        border-top: 1px solid black;
14
        border-bottom: 1px solid black;
15
    }
16
</style>
17
<div id=nav>
18
    <a href="http://codemirror.net">
19
        <h1>CodeMirror</h1>
20
        <img id=logo src="../../doc/logo.png">
21
    </a>
22
    <ul>
23
        <li>
24
            <a href="../../index.html">Home</a>
25
            <li>
26
                <a href="../../doc/manual.html">Manual</a>
27
                <li>
28
                    <a href="https://github.com/codemirror/codemirror">Code</a>
29
    </ul>
30
    <ul>
31
        <li>
32
            <a href="../index.html">Language modes</a>
33
            <li>
34
                <a class=active href="#">HTML mixed</a>
35
    </ul>
36
</div>
37
<article>
38
    <h2>Handlebars</h2>
39
    <form>
40
        <textarea id="code" name="code"> {{!--
41
  You can use the t function to get
42
  content translated to the current locale, es:
43
  {{t 'article_list'}}
44
            --}} <h1>{{t 'article_list'}}</h1> {{! one line comment }}
45
                {{#each articles}} {{~title}}
46
                    <p>{{excerpt body size=120 ellipsis=true}}</p>
47
                    {{#with author}} written by {{first_name}} {{last_name}} from category: {{../category.title}}
48
                        {{#if @../last}}foobar!{{/if}}
49
                        {{/with~}}
50
                        {{#if promoted.latest}}Read this one! {{else}}This is ok! {{/if}}
51
                        {{#if @last}}
52
                            <hr>
53
                        {{/if}}
54
                {{/each}}
55
                {{#form new_comment}}
56
                    <input type="text" name="body"> {{/form}}
57
        </textarea>
58
    </form>
59
    <script>
60
        CodeMirror.defineMode("htmlhandlebars", function(config)
61
        {
62
            return CodeMirror.multiplexingMode(CodeMirror.getMode(config, "text/html"),
63
            {
64
                open: "{{",
65
                close: "}}",
66
                mode: CodeMirror.getMode(config, "handlebars"),
67
                parseDelimiters: true
68
            });
69
        });
70
        var editor = CodeMirror.fromTextArea(document.getElementById("code"),
71
        {
72
            lineNumbers: true,
73
            matchBrackets: true,
74
            mode: "htmlhandlebars"
75
        });
76
    </script>
77
    </script>
78
    <p>Handlebars syntax highlighting for CodeMirror.</p>
79
    <p>
80
        <strong>MIME types defined:</strong> <code>text/x-handlebars-template</code></p>
81
</article>