Skip to content
This repository has been archived by the owner on Dec 24, 2019. It is now read-only.

ryiwamoto/chonmage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chonmage

TypeScript template engine for web pages.

sample

interface of rendering context

interface IContext{
    booleanVar: boolean;
    numberVar: number;
    stringVar: string;
    arrayVar: IArrayItem[];
}
 
interface IArrayItem{
    stringVar: string;
}

template file

{{!reference path="../IContext.ts"}}
{{!context:IContext}}
{{numberVar}}
{{stringVar}}
{{#booleanVar}}
        {{#arrayVar}}
        	{{stringVar}}
        {{/arrayVar}}
{{/booleanVar}}

generated TypeScript code

///<reference path="../IContext.ts"/>
 
module Chonmage {
    export interface ITemplateStore {
        get(name: "chonmage_template_sample.mustache"): Chonmage.Compiled<IContext>;
    }
}
 
(<any>window)["ChonmageTemplates"]["templates"]["chonmage_template_sample.mustache"] =
    new Chonmage.Compiled<IContext>(function(context: IContext) {
        var _ = this, __b = "";
        __b += (+context.numberVar);
        __b += "\n";
        __b += _.esc(context.stringVar);
        __b += "\n";
        if (context.booleanVar) {
            context.arrayVar.forEach(function(__item_0) {
                __b += "        	";
                __b += _.esc(__item_0.stringVar);
                __b += "\n"
            })
        };
        return __b;
    });

see Chonmage sample project

About

TypeScript template engine for web pages.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages