Darkfish Rdoc Generator

This is a complete replacement for the default HTML generator for Rdoc 2.

I created it with a few goals in mind:

  • Replace the four-frame layout with three different indexes with a single-page, class/module-focused view.

  • I helped write what became the default look and feel for Rdoc, but it’s starting to show its age. I wanted to update it with new CSS and Javascript for modern browsers.

  • Add some of the nifty searching and index-on-the-side stuff I liked from the modified Allison template (www.superalloy.nl/blog/?p=7) Eloy Duran came up with.

  • Implemented using separate ERB template files instead of Rdoc’s constants-in-a-module style templating.

I think I mostly succeeded, and it’s nice enough that I wanted to use it for all my documentation, and I thought you might want to, too. Or at least be able to tweak it to generate your own spiffy docs.

It looks like this:

Getting Started

If you haven’t installed it yet, you can install it via RubyGems:

$ sudo gem install darkfish-rdoc

Or download the source and do:

$ sudo rake install

Usage

Because of the way Rdoc and Rubygems work, there’s currently no way to make the Darkfish generator available to Rdoc from the command line ‘rdoc’ tool if you have it installed as a gem, but if you install it as a regular Ruby library (via ‘rake install’), you can do this:

$ rdoc -w 4 -SHN -f darkfish -m README README lib

I’m trying to figure out how to resolve this for the gem. Suggestions welcomed.

You can, however, load the formatter as a gem from a Rakefile before you define the RDocTask:

### Task: rdoc
require 'rake/rdoctask'
gem 'darkfish-rdoc' # Omit this if it's installed as a regular library
require 'darkfish-rdoc'

Rake::RDocTask.new do |rdoc|
  rdoc.title    = "My Awesome SnoCone Library"

  rdoc.options += [
      '-w', '4',
      '-SHN',
      '-f', 'darkfish', # This bit
      '-m', 'README',
    ]

  rdoc.rdoc_files.include 'README'
  rdoc.rdoc_files.include 'lib/snocone.rb'
end

That’s it.

Feedback

I’d be happy to have feedback via email (ged at FaerieMUD dot org) or a ticket on the project’s Trac:

http://deveiate.org/projects/Darkfish-Rdoc/

License

Copyright (c) 2007, 2008, The FaerieMUD Consortium
All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.