0.0
No commit activity in last 3 years
No release in over 3 years
A rework of the Hanna generator for RDoc 3.x
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.1.3
~> 1.8.3
~> 0.9.2.2
~> 3.12

Runtime

= 3.0.25
~> 3.12
 Project Readme

Hanna Gudao — a better RDoc template, now for 3.x¶ ↑

Based on the original Hanna by Mislav.

Hanna is an RDoc generator that scales. It’s implemented in Haml, making the sources clean and readable. It’s built with simplicity, beauty and ease of browsing in mind. (See more in the wiki.)

Hanna gem is available from rubygems.org:

gem install hanna_gudao

The template was created by Mislav and since then has seen contributions from:

  1. Tony Strauss, who participated from the early start and made tons of fixes and enhancements to the template;

  2. Hongli Lai with the search filter for methods.

  3. Erik Hollensbe a serious refactoring and up to date with RDoc 2.5.x and 3.x, now named ‘hanna-nouveau’.

  4. James Tucker minor cleanups for Erik.

  5. Gudao Luo hanna-nouveau make the error “Unfortunately, the gem hanna-nouveau (0.2.4) has an invalid gemspec.…” for the command “bundle update”.

Usage¶ ↑

rdoc -o doc -f hanna lib/*.rb

An alternative is to set the ‘RDOCOPT` environment variable:

RDOCOPT="-f hanna"

This will make RDoc always use Hanna unless it is explicitly overridden.

Integrating with RubyGems¶ ↑

Another neat trick is to put the following line in your .gemrc, this will make RubyGems use Hanna for all rdoc generation:

rdoc: -f hanna

This will make RubyGems use Hanna when generating documentation for installed gems. Remember, if you wish to have all your gems be formatted in hanna:

gem rdoc --all --overwrite

The first time. To easily browse your newly created documentation, use:

gem server

Rake task¶ ↑

For repeated generation of API docs, it’s better to set up a Rake task. Simply add the hanna format argument to your RDoc::Task options:

gem 'rdoc'
require 'rdoc/task'
RDoc::Task.new do |rdoc|
  # this only works with RDoc 3.1 or greater
  rdoc.generator = 'hanna'
  # this is what you use pre RDoc 3.1:
  rdoc.options.push '-f', 'hanna'
end

Tip: you can do this in the Rakefile of your Rails project before running ‘rake doc:rails`.

Here is an example of a task for the rdbi library:

gem 'rdoc'
require 'rdoc/task'
RDoc::Task.new do |rdoc|
  version = File.exist?('VERSION') ? File.read('VERSION') : ""

  rdoc.generator = 'hanna'
  rdoc.main = 'README.rdoc'
  rdoc.rdoc_dir = 'rdoc'
  rdoc.title = "RDBI #{version} Documentation"
  rdoc.rdoc_files.include('README*')
  rdoc.rdoc_files.include('lib/**/*.rb')
end