Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 269
Filip Frącz Avatar asked Feb 01 '26 08:02

Filip Frącz


1 Answers

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!

like image 51
TFD Avatar answered Feb 03 '26 10:02

TFD



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!