I am looking to find a librray that emulates part of the capabilities of Ruby's ERB library. ie substitute text for variables between <% and %>. I dont need the code execution part that ERB provides but if you know of something that has this I would be super appreciative.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Updated the post
the links which were of help are not longer available. I have left the titles so you can google them.
also look for "C# Razor" (this is the template engine which MS use with MVC)
there are a couple more out there.
Visual Studio ships with T4, which is a templating engine (that is vs 2008, 2005 requires a free add on)
Free T4 Editor - DEAD LINK
T4 Screen Cast- DEAD LINK
There is an open sourse project called Nvolicity, which was taken over by Castle Project
Nvolictiy Castle project upgrades - DEAD LINK
HTH Bones
Have a look at TemplateMachine, I haven't tested it, but it seems to be a bit ERB-like.
I just released a very simple library for substituting slightly like ERB.
You cannot evaluate in
<%%>
braces, you can only use these braces:<%= key_value %>
.key_value
will be the key for the Hashtable you pass as substituting arguments and with the braces being replaced by the value in the Hashtable. That's all.https://github.com/Joern/C-Sharp-Substituting
Yours,
Joern
I modified a class I used to test some things a while ago. It's not even nearly as good as ERB but it gets the job done substituting text. It only works with properties though, so you might want to fix that.
Usage:
Code: