class RDoc::Servlet

def documentation_page store, generator, path, req, res

def documentation_page store, generator, path, req, res
  text_name = path.chomp '.html'
  name = text_name.gsub '/', '::'
  if klass = store.find_class_or_module(name) then
    res.body = generator.generate_class klass
  elsif page = store.find_text_page(name.sub(/_([^_]*)\z/, '.\1')) then
    res.body = generator.generate_page page
  elsif page = store.find_text_page(text_name.sub(/_([^_]*)\z/, '.\1')) then
    res.body = generator.generate_page page
  else
    not_found generator, req, res
  end
end