Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest two template engine from China #37

Open
tiye opened this issue May 19, 2014 · 0 comments
Open

Suggest two template engine from China #37

tiye opened this issue May 19, 2014 · 0 comments

Comments

@tiye
Copy link

tiye commented May 19, 2014

Bad news is they do like to document the stuffs in Chinese,

ArtTemplate

From Tercent

Introduction(Chinese): http://cdc.tencent.com/?p=5723
Home page(Chinese): http://aui.github.io/artTemplate/
GitHub repo(Chinese Readme): https://github.com/aui/artTemplate

Some demos copied:

{{if admin}}
    <p>admin</p>
{{else if code > 0}}
    <p>master</p>
{{else}}
    <p>error!</p>
{{/if}}
{{each list as value index}}
    <li>{{index}} - {{value.user}}</li>
{{/each}}
{{include 'template_name'}}
{{time | dateFormat:'yyyy-MM-dd hh:mm:ss'}}

An image from 2012.6 on performance:

Juicer

From Taobao

Home page(Chinese): http://juicer.name/
Docs(English): http://juicer.name/docs/docs.html
Introduction(Chinese): http://ued.taobao.org/blog/2012/04/juicer-一个javascript模板引擎的实现和优化/
GitHub repo(Chinese): https://github.com/PaulGuo/Juicer/

An image from 2012.4 on performance:

Some demos:

{@each list as item}
    ${item.prop}
{@/each}
{@each list as item,index}
    {@if index===3}
        the index is 3, the value is ${item.prop}
    {@else if index === 4}
        the index is 4, the value is ${item.prop}
    {@else}
        the index is not 3, the value is ${item.prop}
    {@/if}
{@/each}
{@each i in range(5, 10)}
    ${i}; //输出 5;6;7;8;9;
{@/each}
<script id="tpl" type="text/template">
    <ul>
        {@each list as it,index}
            <li>${it.name} (index: ${index})</li>
        {@/each}
        {@each blah as it}
            <li>
                num: ${it.num} <br />
                {@if it.num==3}
                    {@each it.inner as it2}
                        ${it2.time} <br />
                    {@/each}
                {@/if}
            </li>
        {@/each}
    </ul>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant