diff --git a/Liquid-for-Programmers.textile b/Liquid-for-Programmers.textile index 6358376..e1f5ab0 100644 --- a/Liquid-for-Programmers.textile +++ b/Liquid-for-Programmers.textile @@ -1,24 +1,32 @@ h2. First steps -It's very simple to get started with Liquid. A liquid template is rendered in two steps: Parse and Render. -For an overview of the liquid syntax please read [[Liquid for Designers]]. +It's very simple to get started with Liquid. +A Liquid template is rendered in two steps: Parse and Render. +For an overview of the Liquid syntax, please read [[Liquid for Designers]].

   @template = Liquid::Template.parse("hi {{name}}")  # Parses and compiles the template
   @template.render( 'name' => 'tobi' )               # Renders the output => "hi tobi" 
 
-The parse step creates a fully compiled template which can be re-used as often as you like. You can store it in memory or in a cache for faster rendering later. +The parse step creates a fully compiled template which can be re-used as often as you like. +You can store it in memory or in a cache for faster rendering later. -All parameters you want Liquid to work with have to be passed as parameters to the render method. Liquid does not know about your ruby local, instance, and global variables. +All parameters you want Liquid to work with have to be passed as parameters to the render method. +Liquid does not know about your Ruby local, instance, and global variables. -h2. Extending liquid +h2. Extending Liquid -Extending liquid is very easy. However keep in mind that liquid is a young library and requires some outside help. If you create useful filters and tags please consider creating a patch and attaching it to a ticket here on this trac. +Extending Liquid is very easy. +However, keep in mind that Liquid is a young library and requires some outside help. +If you create useful filters and tags, please consider creating a patch and attaching it to a ticket here on this trac. h3. Create your own filters -Creating filters is very easy. Basically they are just methods which take one parameter and return a modified string. You can use your own filters by passing an array of modules to the render call like this @template.render(assigns, [MyTextFilters, MyDateFilters]) +Creating filters is very easy. +Basically, they are just methods which take one parameter and return a modified string. +You can use your own filters by passing an array of modules to the render call like this: +@template.render(assigns, [MyTextFilters, MyDateFilters]).

 module TextFilter
@@ -33,7 +41,7 @@ end
 @template.render({}, :filters => [TextFilter])              # => "hi" 
 
-Alternatively you can also register your filters globally +Alternatively, you can register your filters globally:

 module TextFilter
@@ -45,7 +53,7 @@ end
 Liquid::Template.register_filter(TextFilter)
 
-Once the filter is globally registered you can simply use it: +Once the filter is globally registered, you can simply use it:

 @template = Liquid::Template.parse(" {{ '*hi*' | textilize }} ")
@@ -54,7 +62,7 @@ Once the filter is globally registered you can simply use it:
 
 h3. Create your own tags
 
-To create a new tag, simply inherit from Liquid::Tag and register your block with Liquid::Template
+To create a new tag, simply inherit from Liquid::Tag and register your block with Liquid::Template.
 
 

   class Random < Liquid::Tag                                             
@@ -78,7 +86,9 @@ Liquid::Template.register_tag('random', Random)
 
 h3. Create your own tag blocks
 
-All tag blocks are parsed by liquid. To create a new block you just have to inherit from Liquid::Block and register your block with Liquid::Template
+All tag blocks are parsed by Liquid.
+To create a new block,
+you just have to inherit from Liquid::Block and register your block with Liquid::Template.
 
 

   class Random < Liquid::Block                                             
@@ -100,6 +110,7 @@ Liquid::Template.register_tag('random', Random)
 

-@template = Liquid::Template.parse(" {% random 5 %} wanna hear a joke? {% endrandom %} ")
+text = " {% random 5 %} wanna hear a joke? {% endrandom %} "
+@template = Liquid::Template.parse(text)
 @template.render              # => in 20% of the cases this will output : wanna hear a joke?
 
\ No newline at end of file