mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-15 08:50:45 -07:00
Merge pull request #62 from rmetzler/master
code blocks in README.md displayed properly on github (closes #61)
This commit is contained in:
@@ -18,7 +18,7 @@ Liquid is a template engine which I wrote for very specific requirements
|
|||||||
|
|
||||||
## What does it look like?
|
## What does it look like?
|
||||||
|
|
||||||
<code>
|
```html
|
||||||
<ul id="products">
|
<ul id="products">
|
||||||
{% for product in products %}
|
{% for product in products %}
|
||||||
<li>
|
<li>
|
||||||
@@ -29,14 +29,14 @@ Liquid is a template engine which I wrote for very specific requirements
|
|||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</code>
|
```
|
||||||
|
|
||||||
## Howto use Liquid
|
## Howto use Liquid
|
||||||
|
|
||||||
Liquid supports a very simple API based around the Liquid::Template class.
|
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.
|
For standard use you can just pass it the content of a file and call render with a parameters hash.
|
||||||
|
|
||||||
<pre>
|
```ruby
|
||||||
@template = Liquid::Template.parse("hi {{name}}") # Parses and compiles the template
|
@template = Liquid::Template.parse("hi {{name}}") # Parses and compiles the template
|
||||||
@template.render( 'name' => 'tobi' ) # => "hi tobi"
|
@template.render( 'name' => 'tobi' ) # => "hi tobi"
|
||||||
</pre>
|
```
|
||||||
Reference in New Issue
Block a user