summaryrefslogtreecommitdiffstats
path: root/posts/demo/demo.md
blob: 1c7f30fe4b9dac6091560792248121ddaa3bfee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!--_PAGEDATA
{
    "title": "深入理解JavaScript-replace",
    "githubissuesid": 2,
    "keywords": "js,replace,javascript",
    "description":"本文详细介绍了 JavaScript 中 replace 的三种使用方法",
    "doc_text":"demo",
    "doc_link":"../index.html",
    "_template": "demo"
}
_PAGEDATA-->

<!-- 模板 -->
<script class="show" id="source" type="text/x-handlebars-template" >
{{#nimo}}
{{.}} {{root.a.b.c}}
{{/nimo}}
</script>

<!-- 数据 -->
<script class="show json-format-error" id="data" type="text/json">
{
    "a":{
        "b":{
            "c":"cccc"
        }
    },
    "nimo": [
        1
        ,
        2
    ]
}
</script>        

<!-- helper实现 -->
<script class="show" id="helper">
Handlebars.registerHelper('helper-name', function(obj) {
    return 'output'
    
});
</script>