forked from Shopify/liquid
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- updated (2.2.0 & 2.2.1) Manifest - updated readme reference Readme - Converted to markdown - cleaned up Gemspec - updated to 2.2.1
- Loading branch information
DBA
authored and
Tobias Lütke
committed
Aug 24, 2010
1 parent
c00a650
commit 90d1bc2
Showing
5 changed files
with
56 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Liquid template engine | ||
|
||
## Introduction | ||
|
||
Liquid is a template engine which I wrote for very specific requirements | ||
|
||
* It has to have beautiful and simple markup. Template engines which don't produce good looking markup are no fun to use. | ||
* It needs to be non evaling and secure. Liquid templates are made so that users can edit them. You don't want to run code on your server which your users wrote. | ||
* It has to be stateless. Compile and render steps have to be seperate so that the expensive parsing and compiling can be done once and later on you can just render it passing in a hash with local variables and objects. | ||
|
||
## Why should I use Liquid | ||
|
||
* You want to allow your users to edit the appearance of your application but don't want them to run **insecure code on your server**. | ||
* You want to render templates directly from the database | ||
* You like smarty (PHP) style template engines | ||
* You need a template engine which does HTML just as well as emails | ||
* You don't like the markup of your current templating engine | ||
|
||
## What does it look like? | ||
|
||
<pre> | ||
<ul id="products"> | ||
{% for product in products %} | ||
<li> | ||
<h2>{{product.name}}</h2> | ||
Only {{product.price | price }} | ||
|
||
{{product.description | prettyprint | paragraph }} | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
</pre> | ||
|
||
## Howto use Liquid | ||
|
||
Liquid supports a very simple API based around the Liquid::Template class. | ||
For standard use you can just pass it the content of a file and call render with a parameters hash. | ||
|
||
<pre> | ||
@template = Liquid::Template.parse("hi {{name}}") # Parses and compiles the template | ||
@template.render( 'name' => 'tobi' ) # => "hi tobi" | ||
</pre> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters