Build status here: https://ci.appveyor.com/project/haf/dotliquid
Have you sent a PR to this repository? In that case, would you consider getting in touch with me so I can give you commit access to this repository? Please ping me at gitter/dotliquid or here on github.
DotLiquid is a .Net port of the popular Ruby Liquid templating language. It is a separate project that aims to retain the same template syntax as the original, while using .NET coding conventions where possible.
For more information about the original Liquid project, see http://www.liquidmarkup.org.
- Download the latest release from the downloads page. The zip file contains DotLiquid.dll, which is the only one you need.
- Read the wiki for information on writing and using DotLiquid templates.
- You want to leave business logic in your compiled controllers and out of your templates.
- You're looking for a logic-less template language that also exists for other platforms (ie: node, python).
- You want to allow your users to edit their own page templates, but want to ensure they don't run insecure code.
- You want to render templates directly from the database.
- You want a template engine for emails.
<ul id="products">
{% for product in products %}
<li>
<h2>{{product.name}}</h2>
Only {{product.price | price }}
{{product.description | prettyprint | paragraph }}
</li>
{% endfor %}
</ul>
DotLiquid supports a very simple API based around the DotLiquid.Template class.
Generally, you can read the contents of a file into a template, and then render
the template by passing it parameters in the form of a Hash
object. There are
several ways you can construct a Hash
object, including from a Dictionary, or
using the Hash.FromAnonymousObject
method.
Template template = Template.Parse("hi {{name}}"); // Parses and compiles the template template.Render(Hash.FromAnonymousObject(new { name = "tobi" })); // => "hi tobi"
Are you using DotLiquid in an open source project? Tell us with a PR!