Right now, it is not easy for rdoc templates to include javascript. The only way for them to do so is to paste the
javascript at the top of each file that rdoc generates. The built-in html and kilmer templates do this. While this
is not so bad when there is very little javascript (as in the html and kilmer templates), it does not scale to templates
that want to use javascript more heavily. Pasting lots of javascript into each template is nasty because:
1.) The javascript is duplicated in each page that is generated, increasing the size of the HTML pages.
2.) Embedding javascript into Ruby files generally means that the javascript code will not be syntax-highlighted, which
makes editing difficult.
RDoc does give the ability to templates to create arbitrary files with write_extra_pages, which theoretically could
copy a javascript file into an output file. I think, however, that a neater solution would be to allow templates to
define a constant containing a hash, mapping input file => output file, that rdoc's html generator automatically
would process. This would make including extra "static" files in rdoc output trivially easy. The HTML templates
then could refer to the files with a "root_url" element in the values array that would provide the relative
path to the root of the document directory from the page being processed (this probably would be a good idea anyway).
|