高效的纯文本模板引擎 [英] Efficient plain text template engine

查看:209
本文介绍了高效的纯文本模板引擎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有抓住在网络上号码一个简单的警报系统,具有预先定义的文本模板它们混合以获得一个警报,并将其发送给客户端。警报是相当简单的纯文本,所以我不希望比普通的文字,数字,简单的功能(如ifthenelse)多等,越快越好。那么,有没有这方面的任何现有的开源解决方案?谢谢!

I have a simple alert system that grabs number on the web, mix them with pre-defined text template to get an alert, and send it to clients. The alert is quite simple plain text, so I would not expect much other than plain text, numbers, simple functions(such as ifthenelse), the quicker the better. So are there any existing open source solutions for this? Thanks!

推荐答案

我会用剃刀引擎这一点。

在微软的剃刀解析技术构建的模板引擎。该RazorEngine允许您使用剃刀语法来构建健壮的模板

A templating engine built upon Microsoft's Razor parsing technology. The RazorEngine allows you to use Razor syntax to build robust templates

从网页一个简单的例子:

A simple example from its page:

string template = "Hello @Model.Name! Welcome to Razor!";
string result = Razor.Parse(template, new { Name = "World" });

结果你好世界!欢迎到剃刀!

这篇关于高效的纯文本模板引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆