How to use Brail as a stand-alone general purpose templating engine (like NVelocity)?

最后都变了- 提交于 2019-12-21 19:45:16

问题


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.


回答1:


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!



来源:https://stackoverflow.com/questions/619923/how-to-use-brail-as-a-stand-alone-general-purpose-templating-engine-like-nveloc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!