Module: RDoc::Page
- Defined in:
- lib/rdoc/generators/template/html/old_html.rb,
lib/rdoc/generators/template/chm/chm.rb,
lib/rdoc/generators/template/xml/rdf.rb,
lib/rdoc/generators/template/xml/xml.rb,
lib/rdoc/generators/template/html/html.rb,
lib/rdoc/generators/template/html/hefss.rb,
lib/rdoc/generators/template/html/kilmer.rb,
lib/rdoc/generators/template/html/one_page_html.rb
Overview
This is how you define the HTML that RDoc generates. Simply create
a file in rdoc/generators/html_templates that creates the
module RDoc::Page and populate it as described below. Then invoke
rdoc using the --template
The constants defining pages use a simple templating system:
-
The templating system is passed a hash. Keys in the hash correspond to tags on this page. The tag %abc% is looked up in the hash, and is replaced by the corresponding hash value.
-
Some tags are optional. You can detect this using IF/ENDIF
IF: title The value of title is %title% ENDIF: title -
Some entries in the hash have values that are arrays, where each entry in the array is itself a hash. These are used to generate lists using the START: construct. For example, given a hash containing
{ 'people' => [ { 'name' => 'Fred', 'age' => '12' }, { 'name' => 'Mary', 'age' => '21' } ]You could generate a simple table using
START:people
END:people%name% %age% These lists can be nested to an arbitrary depth
-
the construct HREF:url:name: generates %name% if
urlis defined in the hash, or %name% otherwise.
Your file must contain the following constants
[FONTS] a list of fonts to be used [STYLE] a CSS section (without the