如何使用Brail作为独立的通用模板引擎(如NVelocity)?(How to use Brail as a stand

编程入门 行业动态 更新时间:2024-10-09 07:28:02
如何使用Brail作为独立的通用模板引擎(如NVelocity)?(How to use Brail as a stand-alone general purpose templating engine (like NVelocity)?)

我一直在我的文本文件生成器中使用NVelocity作为独立的模板引擎。 NVelocity的问题在于宏非常不稳定; 我得到的所有错误都来自错误的宏实现。

如果我可以使用其他模板引擎,比如Brail,那将会很酷。 这样我就会编写输出字符串的函数。

什么是嵌入Brail发动机的最佳方式? 我想传递一个包含模板的字符串(不是从磁盘读取),我想尽量减少外部依赖项的数量。

编辑:我自己找到了答案。 看看Castle的这个源文件 。

I've been using NVelocity as a stand-alone templating engine in my text file generator. The problem with NVelocity is that the macros are quite shaky; pretty much all errors I get are from faulty macro implementation.

It would be cool if I could just use some other templating engine, such as Brail. That way I would just write functions that output strings.

What's the best way of embedding Brail engine? I would like to just pass it a string containing the template (not reading from disk), and I would like to minimize the number of external dependencies.

EDIT: I found the answer myself. Take a look at this source file from Castle.

最满意答案

尝试使用nHaml或Spark,因为它们都支持完全独立或直接使用

它们都支持返回字符串等的标准c#函数

Spark是真正的HTML,nHaml是DRY HTML

两者都很酷!

Try nHaml or Spark as they both support full standalone or direct usage

They both support standard c# functions that return strings etc

Spark is real HTML, nHaml is DRY HTML

Both very cool!

更多推荐

本文发布于:2023-08-07 11:43:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464037.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   独立   模板   引擎   stand

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!