• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript handlebars.registerPartial函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中handlebars.registerPartial函数的典型用法代码示例。如果您正苦于以下问题:TypeScript registerPartial函数的具体用法?TypeScript registerPartial怎么用?TypeScript registerPartial使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了registerPartial函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: constructor

    constructor(commitMessages: string[]) {
        super();

        this.commitMessages = commitMessages;

        handlebars.registerPartial('workitem', WorkItemTemplateBase);
        this.jenkinsClient = new JenkinsRestClient();
    }
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:8,代码来源:WorkItemsDownloader.ts


示例2: registerPartials

function registerPartials(partialsGlob: string) {
    const partialTemplateFileNames = globSync(partialsGlob);
    logUtils.log(`Found ${chalk.green(`${partialTemplateFileNames.length}`)} ${chalk.bold('partial')} templates`);
    for (const partialTemplateFileName of partialTemplateFileNames) {
        const namedContent = utils.getNamedContent(partialTemplateFileName);
        Handlebars.registerPartial(namedContent.name, namedContent.content);
    }
    return partialsGlob;
}
开发者ID:ewingrj,项目名称:0x-monorepo,代码行数:9,代码来源:index.ts


示例3: buildWebAppHtml

function buildWebAppHtml() {

    process.stdout.write("buliding web app index...\n");

    // build cache busted file name maps
    const cacheMap: any = {};

    cacheMap.stylesheets = getCacheMapping("stylesheets");
    cacheMap.scripts = getCacheMapping("scripts");

    // get the content for the critical css
    const encoding = "utf-8";
    const loadingCss = FileSystem.readFileSync("./public/dist/styles/" + cacheMap.stylesheets.loading, encoding);
    Handlebars.registerPartial("loading.css", loadingCss);

    // get the template index page
    const file = FileSystem.readFileSync("./public/src/index.html", encoding);
    const template = Handlebars.compile(file);

    // apply the cache busted file names and contents to the index page
    FileSystem.writeFileSync("./public/dist/index.html", template(cacheMap));

    process.stdout.write("web app index built\n");
}
开发者ID:alsatian-test,项目名称:alsatian-website,代码行数:24,代码来源:build-html.ts


示例4: constructor

    constructor() {
        super();

        handlebars.registerPartial('commit', CommitTemplateBase);
        this.jenkinsClient = new JenkinsRestClient();
    }
开发者ID:grawcho,项目名称:vso-agent-tasks,代码行数:6,代码来源:CommitsDownloader.ts


示例5: template3

const template3 = Handlebars.compile<typeof context3>(source3);
template3(context3);

const source4 = '<ul>{{#people}}<li>{{#link}}{{name}}{{/link}}</li>{{/people}}</ul>';
Handlebars.registerHelper('link', function(context: any) {
    return '<a href="/people/' + this.id + '">' + context.fn(this) + '</a>';
});
const template4 = Handlebars.compile<{ people: { name: string, id: number }[] }>(source4);
const data2 = { 'people': [
    { 'name': 'Alan', 'id': 1 },
    { 'name': 'Yehuda', 'id': 2 }
]};
template4(data2);

const source5 = '<ul>{{#people}}<li>{{> link}}</li>{{/people}}</ul>';
Handlebars.registerPartial('link', '<a href="/people/{{id}}">{{name}}</a>');
const template5 = Handlebars.compile(source5);
const data3 = { 'people': [
    { 'name': 'Alan', 'id': 1 },
    { 'name': 'Yehuda', 'id': 2 }
]};
template5(data3);

const source6 = '{{#list nav}}<a href="{{url}}">{{title}}</a>{{/list}}';
const template6 = Handlebars.compile(source6);
Handlebars.registerHelper('list', (context, options: Handlebars.HelperOptions) => {
  let ret = "<ul>";
  for(let i=0, j=context.length; i<j; i++) {
    ret = ret + "<li>" + options.fn(context[i]) + "</li>";
  }
  return ret + "</ul>";
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:31,代码来源:handlebars-tests.ts


示例6:

    urlText: Handlebars.compile($('#tmpl-urltext').html()),
    detail: Handlebars.compile($('#tmpl-detail').html()),
    credentialForm: Handlebars.compile($('#tmpl-credentialform').html()),
    deleteConfirmationDialog: Handlebars.compile($('#tmpl-deleteconfirmationdialog').html()),
    optionsDialog: Handlebars.compile($('#tmpl-optionsdialog').html()),
    exportedDataWindow: Handlebars.compile($('#tmpl-exporteddatawindow').html()),
    credentialTable: Handlebars.compile($('#tmpl-credentialtable').html()),
    credentialTableRow: Handlebars.compile($('#tmpl-credentialtablerow').html()),
    validationMessage: Handlebars.compile($('#tmpl-validationmessage').html()),
    modalHeader: Handlebars.compile($('#tmpl-modalheader').html()),
    modalBody: Handlebars.compile($('#tmpl-modalbody').html()),
    modalFooter: Handlebars.compile($('#tmpl-modalfooter').html()),
    copyLink: Handlebars.compile($('#tmpl-copylink').html())
};

Handlebars.registerPartial('credentialtablerow', templates.credentialTableRow);

Handlebars.registerPartial('copylink', templates.copyLink);

Handlebars.registerHelper('breaklines', (text: string) => {
    const escapedText = Handlebars.Utils.escapeExpression(text);
    return new Handlebars.SafeString(escapedText.replace(/(\r\n|\n|\r)/gm, '<br />'));
});

Handlebars.registerHelper('truncate', (text: string, size: number) => {
    const escapedText = Handlebars.Utils.escapeExpression(truncate(text, size));
    return new Handlebars.SafeString(escapedText);
});

let currentSession: any = null;
开发者ID:markashleybell,项目名称:vault,代码行数:30,代码来源:index.ts



注:本文中的handlebars.registerPartial函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript handlebars.Utils类代码示例发布时间:2022-05-25
下一篇:
TypeScript handlebars.registerHelper函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap