关闭

RazorEngine

814人阅读 评论(0) 收藏 举报

http://razorengine.codeplex.com/

 

 

RazorEngine has been moved to Github

http://github.com/Antaris/RazorEngine

Update - An early look at RazorEngine v3
New blog post - http://www.fidelitydesign.net/?p=473

Project Description
A templating engine built upon Microsoft's Razor parsing technology. The RazorEngine allows you to use Razor syntax to build robust templates. Currently we have integrated the vanilla Html + Code support, but we hope to support other markup languages in future.

Using the templating engine couldn't be easier, using a simple syntax, we can do the following:

  string template = "Hello @Model.Name! Welcome to Razor!";
  string result = Razor.Parse(template, new { Name = "World" });


The templating engine supports strict and anonymous types, as well as customised base templates, for instance:

  Razor.SetTemplateBase(typeof(HtmlTemplateBase<>));
  
  string template = 
  @"<html>
      <head>
        <title>Hello @Model.Name</title>
      </head>
      <body>
        Email: @Html.TextBoxFor(m => m.Email)
      </body>
    </html>";
    
  var model = new PageModel { Name = "World", Email = "someone@somewhere.com" };
  string result = Razor.Parse(template, model);

NuGet Distribution

The Razor Templating Engine is available through Nuget (http://nuget.codeplex.com/) in Visual Studio. Simply search for RazorEngine in the package manager, or:

    Install-Package RazorEngine

Support Us

Donations are always welcome and very appreciated :-), please send donations via Paypal


Hope you enjoy, feedback is welcome!

 

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1373549次
    • 积分:19864
    • 等级:
    • 排名:第411名
    • 原创:448篇
    • 转载:1067篇
    • 译文:4篇
    • 评论:143条
    文章存档
    最新评论