зеркало из https://github.com/github/ruby.git
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:
Родитель
b0f13cfebe
Коммит
b543ed3ac8
|
@ -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'
|
||||
|
||||
module Generators
|
||||
|
||||
class CHMGenerator < HTMLGenerator
|
||||
class Generators::CHMGenerator < Generators::HTMLGenerator
|
||||
|
||||
HHC_PATH = "c:/Program Files/HTML Help Workshop/hhc.exe"
|
||||
|
||||
##
|
||||
# Standard generator factory
|
||||
|
||||
def CHMGenerator.for(options)
|
||||
CHMGenerator.new(options)
|
||||
def self.for(options)
|
||||
new(options)
|
||||
end
|
||||
|
||||
def initialize(*args)
|
||||
|
@ -113,7 +111,5 @@ module Generators
|
|||
system(HHC_PATH, @project_name)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
require 'fileutils'
|
||||
|
||||
require 'rdoc/options'
|
||||
require 'rdoc/template'
|
||||
require 'rdoc/markup/simple_markup'
|
||||
require 'rdoc/generators'
|
||||
require 'rdoc/markup/simple_markup/to_html'
|
||||
require 'cgi'
|
||||
|
||||
module Generators
|
||||
|
||||
|
@ -780,7 +777,9 @@ module Generators
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
def index_name
|
||||
|
@ -1177,7 +1176,7 @@ module Generators
|
|||
# Generators may need to return specific subclasses depending on the
|
||||
# options they are passed. Because of this we create them using a factory
|
||||
|
||||
def HTMLGenerator.for(options)
|
||||
def self.for(options)
|
||||
AllReferences::reset
|
||||
HtmlMethod::reset
|
||||
|
||||
|
|
|
@ -1,33 +1,27 @@
|
|||
require 'rdoc/options'
|
||||
require 'rdoc/template'
|
||||
require 'rdoc/markup/simple_markup'
|
||||
require 'rdoc/generators'
|
||||
require 'rdoc/markup/simple_markup/to_flow'
|
||||
require 'cgi'
|
||||
|
||||
require 'rdoc/ri/ri_cache'
|
||||
require 'rdoc/ri/ri_reader'
|
||||
require 'rdoc/ri/ri_writer'
|
||||
require 'rdoc/ri/ri_descriptions'
|
||||
|
||||
module Generators
|
||||
|
||||
class RIGenerator
|
||||
class Generators::RIGenerator
|
||||
|
||||
##
|
||||
# Generators may need to return specific subclasses depending on the
|
||||
# options they are passed. Because of this we create them using a factory
|
||||
|
||||
def RIGenerator.for(options)
|
||||
def self.for(options)
|
||||
new(options)
|
||||
end
|
||||
|
||||
class <<self
|
||||
class << self
|
||||
protected :new
|
||||
end
|
||||
|
||||
##
|
||||
# Set up a new HTML generator. Basically all we do here is load up the
|
||||
# correct output temlate
|
||||
# Set up a new RIGenerator.
|
||||
|
||||
def initialize(options) #:not-new:
|
||||
@options = options
|
||||
|
@ -224,7 +218,5 @@ module Generators
|
|||
end
|
||||
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'
|
||||
|
||||
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
|
||||
|
||||
def XMLGenerator.for(options)
|
||||
XMLGenerator.new(options)
|
||||
def self.for(options)
|
||||
new(options)
|
||||
end
|
||||
|
||||
def initialize(*args)
|
||||
|
@ -46,18 +41,17 @@ module Generators
|
|||
# class, module, and method names)
|
||||
|
||||
def build_indices
|
||||
|
||||
@info.each do |toplevel|
|
||||
@files << HtmlFile.new(toplevel, @options, FILE_DIR)
|
||||
@files << Generators::HtmlFile.new(toplevel, @options, Generators::FILE_DIR)
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
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|
|
||||
build_class_list(mod, html_file, class_dir)
|
||||
end
|
||||
|
@ -104,7 +98,7 @@ module Generators
|
|||
end
|
||||
|
||||
def gen_method_index
|
||||
gen_an_index(HtmlMethod.all_methods, 'Methods')
|
||||
gen_an_index(Generators::HtmlMethod.all_methods, 'Methods')
|
||||
end
|
||||
|
||||
def gen_an_index(collection, title)
|
||||
|
@ -122,7 +116,5 @@ module Generators
|
|||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -18,8 +18,7 @@ require 'find'
|
|||
require 'fileutils'
|
||||
require 'time'
|
||||
|
||||
# We put rdoc stuff in the RDoc module to avoid namespace
|
||||
# clutter.
|
||||
# We put rdoc stuff in the RDoc module to avoid namespace clutter.
|
||||
#
|
||||
# ToDo: This isn't universally true.
|
||||
#
|
||||
|
|
Загрузка…
Ссылка в новой задаче