# Partials
Partials allows defining templating sections in external variables, such as the `hobby_entry_partial` variable above. The greater tag allows you to instantiate those partials:
* greater (>) renders the partial denotes by an expression in the current scope
For instance,
will generate the hobby list with a link for each of my hobbies. As the scope inside the iteration is based on the currently iterated element, the hobby label and url are accessible inside the partial itself.
# Advanced scoping example
Suppose that, in the example above, you dont statically know what are the keys of an hobby hash. For instance, for each hobby you want to display an HTML table with every (key,value) pair. You could try something like this:
key |
value |
label |
Programming |
url |
http://reddit.com/r/programming |
key |
value |
label |
Music |
url |
http://www.music.me/ |
The `hobby_entry_table` partial above iterates the hobby hash through `self`. Following ruby's `Hash#each` The scope inside that iteration is therefore an array of two elements, accessible under `first` and `last`.
Another way, that uses wlang higher-level constructions, could be as follows:
label |
Programming |
url |
http://reddit.com/r/programming |
label |
Music |
url |
http://www.music.me/ |