I am not sure how to explain this and not sure if thats the right title. You may edit this post and title to make it more clear.
Here is what I need to do. We have a CMS and would like to simplify creating pages. Instead of using raw C# to create page templates we want to use a simpler language. For example.
Old way:
<span>User name: <%= Model.UserName %></span>
New way:
<span>User name: {Username}</span>
As you can see the new way is much simpler. But I didn’t want to stop there. i would like to include conditionals, loops variables and other very simple scripting concepts to be parsed by C#. Is there a known method to do this or any ready made code I can use to make this possible.
Edit:
The reason I need something like this is to make the page highly dynamic. This template language will not only be used for presenting a webpage. it will be used to fetch data from the database, load information from other webpages, construct dynamic data, create calculated data on the fly. This means I can insert the template code in a post then it will run the custom template (scripting code) on the fly.
You probably want RazorEngine, which uses Microsoft’s new Razor template language.
It’s even lighter than your example.