diff options
Diffstat (limited to 'ruwiki/tags/release-0.6.1/Ruwiki/RuwikiTemplatingLibrary')
-rw-r--r-- | ruwiki/tags/release-0.6.1/Ruwiki/RuwikiTemplatingLibrary | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/ruwiki/tags/release-0.6.1/Ruwiki/RuwikiTemplatingLibrary b/ruwiki/tags/release-0.6.1/Ruwiki/RuwikiTemplatingLibrary deleted file mode 100644 index d39cb9a..0000000 --- a/ruwiki/tags/release-0.6.1/Ruwiki/RuwikiTemplatingLibrary +++ /dev/null @@ -1,82 +0,0 @@ -id: 0 -topic: RuwikiTemplatingLibrary -version: 1 -#EHDR -= Ruwiki 0.6.1 Templating - -Ruwiki uses the RDoc templating system, described by its creator as: - - RDoc's cheap-n-cheerful HTML page template system. - -== Templates - -Templates in the templating system are essentially plain strings with -particular references to templating keys or an include directive. - -=== Templating Keys - -The template interacts with a value hash provided by ruwiki. The keys known to -the templates expected by Ruwiki are detailed in Configuring_Ruwiki. Nested -key references are found from the inside-out. That is, the closest resolving -key to the current level is found, not the furthest resolving key. - -==== Simple Templating Keys -Ruwiki only uses the simplest form of RDoc templating at this point, which is -the enclosing of variable names between percent signs (e.g., -<tt>%wiki_title%</tt>). - -==== Repeating Block Keys -The RDoc templating library supports a block format: - - START:key - ... stuff ... - END:key - -The block between <tt>START:key</tt> and <tt>END:key</tt> will be repeated -once for each hash entry found in the array at <tt>key</tt> in the main value -hash. Blocks may be nested arbitrarily deeply. - -==== Conditional Block Keys - - IF:key - ... stuff ... - ENDIF:key - -The block between <tt>IF:key</tt> and <tt>ENDIF:key</tt> will be included in -the output only if the corresponding key is set in the value hash. - -=== Including Other Templates - -Templates may include other templates to any arbitrary level by using the -!INCLUDE! directive. - -== Example - -Given the set of templates T1, T2, and T3 (shown below), here's how we would -use the templating system. - - values = { "name" => "Dave", "state" => "TX" } - t = TemplatePage.new(T1, T2, T3) - File.open(name, w) { |f| t.write_html_on(f, values) } - -or: - - values = { "name" => "Dave" } - res = "" - t.write_html_on(res, values) - -=== T1 - - Templates can subsitute a wide variety of values. - !INCLUDE! - -=== T2 - - Name: %name% !INCLUDE! - -=== T3 - - IF:state - State: %state% - ENDIF:state - |