Try DotLiquid Online

This page lets you interactively try out the DotLiquid templating system. It's also proof that it's okay to allow your users to edit their own templates - if we trust it so can you!


Template Code

<p>{{ user.name | upcase }} has to do:</p> <ul> {% for item in user.tasks -%} <li>{{ item.name }}</li> {% endfor -%} </ul>

Result

<p>TIM JONES has to do:</p>

<ul>
  <li>Documentation</li>
  <li>Code comments</li>
</ul>

Instructions

The available objects are structured and created as follows:


public class User : Drop
{
	public string Name { get; set; }
	public List<Task> Tasks { get; set; }
}

public class Task
{
	public string Name { get; set; }
}

user = new User
{
	Name = "Tim Jones",
	Tasks = new List<Task>
	{
		new Task { Name = "Documentation" },
		new Task { Name = "Code comments" }
	}
} 

You can refer to the DotLiquid Syntax Compatibility doc to find out which tags and filters are available.

How does this work?

Why not have a look at the source code of the page you're looking at now?