Collapse namespaces and refactor requires in RDoc

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2008-01-07 01:36:33 +00:00
Родитель b0f13cfebe
Коммит b543ed3ac8
6 изменённых файлов: 389 добавлений и 403 удалений

8
lib/rdoc/generators.rb Normal file
Просмотреть файл

@ -0,0 +1,8 @@
require 'cgi'
require 'rdoc/options'
require 'rdoc/markup/simple_markup'
require 'rdoc/template'
module Generators
end

Просмотреть файл

@ -1,16 +1,14 @@
require 'rdoc/generators/html_generator' require 'rdoc/generators/html_generator'
module Generators class Generators::CHMGenerator < Generators::HTMLGenerator
class CHMGenerator < HTMLGenerator
HHC_PATH = "c:/Program Files/HTML Help Workshop/hhc.exe" HHC_PATH = "c:/Program Files/HTML Help Workshop/hhc.exe"
## ##
# Standard generator factory # Standard generator factory
def CHMGenerator.for(options) def self.for(options)
CHMGenerator.new(options) new(options)
end end
def initialize(*args) def initialize(*args)
@ -115,5 +113,3 @@ module Generators
end end
end

Просмотреть файл

@ -1,10 +1,7 @@
require 'fileutils' require 'fileutils'
require 'rdoc/options' require 'rdoc/generators'
require 'rdoc/template'
require 'rdoc/markup/simple_markup'
require 'rdoc/markup/simple_markup/to_html' require 'rdoc/markup/simple_markup/to_html'
require 'cgi'
module Generators module Generators
@ -780,7 +777,9 @@ module Generators
end end
def filename_to_label def filename_to_label
@context.file_relative_name.gsub(/%|\/|\?|\#/) {|s| '%' + ("%x" % s[0]) } @context.file_relative_name.gsub(/%|\/|\?|\#/) do |s|
'%%%x' % s[0].unpack('C')
end
end end
def index_name def index_name
@ -1177,7 +1176,7 @@ module Generators
# Generators may need to return specific subclasses depending on the # Generators may need to return specific subclasses depending on the
# options they are passed. Because of this we create them using a factory # options they are passed. Because of this we create them using a factory
def HTMLGenerator.for(options) def self.for(options)
AllReferences::reset AllReferences::reset
HtmlMethod::reset HtmlMethod::reset

Просмотреть файл

@ -1,23 +1,18 @@
require 'rdoc/options' require 'rdoc/generators'
require 'rdoc/template'
require 'rdoc/markup/simple_markup'
require 'rdoc/markup/simple_markup/to_flow' require 'rdoc/markup/simple_markup/to_flow'
require 'cgi'
require 'rdoc/ri/ri_cache' require 'rdoc/ri/ri_cache'
require 'rdoc/ri/ri_reader' require 'rdoc/ri/ri_reader'
require 'rdoc/ri/ri_writer' require 'rdoc/ri/ri_writer'
require 'rdoc/ri/ri_descriptions' require 'rdoc/ri/ri_descriptions'
module Generators class Generators::RIGenerator
class RIGenerator
## ##
# Generators may need to return specific subclasses depending on the # Generators may need to return specific subclasses depending on the
# options they are passed. Because of this we create them using a factory # options they are passed. Because of this we create them using a factory
def RIGenerator.for(options) def self.for(options)
new(options) new(options)
end end
@ -26,8 +21,7 @@ module Generators
end end
## ##
# Set up a new HTML generator. Basically all we do here is load up the # Set up a new RIGenerator.
# correct output temlate
def initialize(options) #:not-new: def initialize(options) #:not-new:
@options = options @options = options
@ -226,5 +220,3 @@ module Generators
end end
end

Просмотреть файл

@ -1,20 +1,15 @@
require 'rdoc/options'
require 'rdoc/markup/simple_markup'
require 'rdoc/markup/simple_markup/to_html'
require 'rdoc/generators/html_generator' require 'rdoc/generators/html_generator'
module Generators
## ##
# Generate XML output as one big file # Generate XML output as one big file
class XMLGenerator < HTMLGenerator class Generators::XMLGenerator < Generators::HTMLGenerator
## ##
# Standard generator factory # Standard generator factory
def XMLGenerator.for(options) def self.for(options)
XMLGenerator.new(options) new(options)
end end
def initialize(*args) def initialize(*args)
@ -46,18 +41,17 @@ module Generators
# class, module, and method names) # class, module, and method names)
def build_indices def build_indices
@info.each do |toplevel| @info.each do |toplevel|
@files << HtmlFile.new(toplevel, @options, FILE_DIR) @files << Generators::HtmlFile.new(toplevel, @options, Generators::FILE_DIR)
end end
RDoc::TopLevel.all_classes_and_modules.each do |cls| RDoc::TopLevel.all_classes_and_modules.each do |cls|
build_class_list(cls, @files[0], CLASS_DIR) build_class_list(cls, @files[0], Generators::CLASS_DIR)
end end
end end
def build_class_list(from, html_file, class_dir) def build_class_list(from, html_file, class_dir)
@classes << HtmlClass.new(from, html_file, class_dir, @options) @classes << Generators::HtmlClass.new(from, html_file, class_dir, @options)
from.each_classmodule do |mod| from.each_classmodule do |mod|
build_class_list(mod, html_file, class_dir) build_class_list(mod, html_file, class_dir)
end end
@ -104,7 +98,7 @@ module Generators
end end
def gen_method_index def gen_method_index
gen_an_index(HtmlMethod.all_methods, 'Methods') gen_an_index(Generators::HtmlMethod.all_methods, 'Methods')
end end
def gen_an_index(collection, title) def gen_an_index(collection, title)
@ -124,5 +118,3 @@ module Generators
end end
end

Просмотреть файл

@ -18,8 +18,7 @@ require 'find'
require 'fileutils' require 'fileutils'
require 'time' require 'time'
# We put rdoc stuff in the RDoc module to avoid namespace # We put rdoc stuff in the RDoc module to avoid namespace clutter.
# clutter.
# #
# ToDo: This isn't universally true. # ToDo: This isn't universally true.
# #