This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Andrew O'Brien (author)
Wed Mar 19 13:50:59 -0700 2008
commit 5b5c14cc05050327bc0dcfe50846e08a8bc99302
tree 5e75d5ea7098529fb2b8abdb2f17ddec9f06ace1
parent 709124fe3e1e779c3d74d2a31b32f4cdb59c5d3c
tree 5e75d5ea7098529fb2b8abdb2f17ddec9f06ace1
parent 709124fe3e1e779c3d74d2a31b32f4cdb59c5d3c
| name | age | message | |
|---|---|---|---|
| |
README | Wed Mar 19 13:50:59 -0700 2008 | [Andrew O'Brien] |
| |
Rakefile | Wed Mar 19 13:13:54 -0700 2008 | [Andrew O'Brien] |
| |
lib/ | Wed Mar 19 13:50:59 -0700 2008 | [Andrew O'Brien] |
| |
rerender_text_extension.rb | Wed Mar 19 13:13:54 -0700 2008 | [Andrew O'Brien] |
| |
spec/ | Wed Mar 19 13:50:59 -0700 2008 | [Andrew O'Brien] |
README
= Rerender Tags This extension adds two methods to Radiant's Page model that allows you to easily define tags that can render their contents twice. The primary use for this is to add support for tags that occur before the necessary information to render them is available. == Example Say we want to add have a tag that creates a link to every header in a page. This would be simple if the tag occurred at the end of the page. However, most pages want this at the beginning. The solution is to do something like this: <tt> <r:capture_headers> <rr:table_of_contents/> <r:h1>Foo</r:h1> ... <r:h2>Bar</r:h2> ... </r:capture_headers> </tt> (A fuller example of this same tag is laid out in spec/models/page_with_rerender_text_spec.rb.) The <tt><rr:toc/></tt> tag is in a separate namespace than the others and thus won't be evaluated until afterward. In the <tt><r:capture_headers/></tt> tag we call <tt>rerender_text(tag.expand, :headers => headers)</tt> which sets up a new Radius context and parser to expand tags in the "rr" namespace. == Using other namespaces If you need to render more than twice, you can change the namespace used for a particular parser and context using the <tt>rerender_with_namespace(text, namespace, options)</tt> method. == <r:rerender> This extension includes one tag that acts as a basic rerenderer. Sometimes the tag that contains a rerenderable tag doesn't need to do anything but call it with the correct namespace due to the fact that tags may have side-effects. For example, the example above can be <tt> <r:rerender> <rr:table_of_contents/> <r:h1>Foo</r:h1> ... <r:h2>Bar</r:h2> ... </r:rerender> </tt> ...as long as the <r:hx> tags add effect an instance variable of the page that's accessible to tag.globals.page.




