Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extending Razor View Engine to Handle Rendering

I wonder if there is any way to extend razor view engine capabilities to handle some custom text/tag and parse/proceed before render. Assume that I use some special tag which is ${} as below:

<span>${some word}</span>

Then, I want to parse the view before render and replace 'some world' with localized value. Ofcourse this can be done by other ways, but i wonder if there is any way to get this work.

like image 827
Halil Ibrahim Avatar asked Jan 16 '13 14:01

Halil Ibrahim


1 Answers

You can extend the razor view engine by inhereting from RazorViewEngine class, you can find an example of how to do that here

Also, check out Nancy.Viewengines.Razor which is a view engine built on top of Razor view engine, and has it's own syntax parser

like image 94
Bassam Mehanni Avatar answered Nov 08 '22 03:11

Bassam Mehanni