3

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.

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
Filip Frącz
  • 5,881
  • 11
  • 45
  • 67

1 Answers1

3

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!

TFD
  • 23,890
  • 2
  • 34
  • 51
  • Yes, but I care more for the ability of defining simple macros within the template. What kind of language do they support? – Filip Frącz Mar 13 '09 at 14:29
  • ? .Net c#, you can't get much easier than that – TFD Mar 14 '09 at 07:40
  • I mean the template engine has its own language for logic. For instance WebForms would use c#/vb, Brail uses Boo, NVelocity uses velocimacros, etc. I want to be able to have some simple code within the view. – Filip Frącz Mar 15 '09 at 03:00
  • Usually best to keep all code out of the view and put it into your controller/presenter Also best to use one language for a project, this avoids coding confusions especialy for "the next guy!" – TFD Mar 15 '09 at 08:20
  • I had trouble with the links for nHaml and Spark: These seem to work: Spark: http://sparkviewengine.com/ nHaml: http://code.google.com/p/nhaml/ – quip Mar 29 '12 at 20:51