1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Reorganize RDoc generators

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2008-01-13 03:02:49 +00:00
parent 513d0ca7f6
commit 937b7ab8b5
15 changed files with 258 additions and 251 deletions

View file

@ -1,3 +1,7 @@
Sun Jan 13 12:01:32 2008 Eric Hodel <drbrain@segment7.net>
* lib/rdoc/generators*: Reorganize RDoc generators.
Sun Jan 13 11:41:11 2008 NARUSE, Yui <naruse@ruby-lang.org>
* encoding.c (ENCINDEX_EUC_JP, ENCINDEX_SJIS): removed.

View file

@ -1,9 +1,25 @@
require 'cgi'
require 'rdoc'
require 'rdoc/options'
require 'rdoc/markup/simple_markup'
require 'rdoc/template'
module RDoc; end # HACK
module RDoc::Generators
module RDoc::Generators; end
##
# Name of sub-direcory that holds file descriptions
FILE_DIR = "files"
##
# Name of sub-direcory that holds class descriptions
CLASS_DIR = "classes"
##
# Name of the RDoc CSS file
CSS_NAME = "rdoc-style.css"
end

View file

@ -1,6 +1,6 @@
require 'rdoc/generators/html_generator'
require 'rdoc/generators/html'
class RDoc::Generators::CHMGenerator < RDoc::Generators::HTMLGenerator
class RDoc::Generators::CHM < RDoc::Generators::HTML
HHC_PATH = "c:/Program Files/HTML Help Workshop/hhc.exe"
@ -52,7 +52,7 @@ class RDoc::Generators::CHMGenerator < RDoc::Generators::HTMLGenerator
# files that go to make up the help.
def create_project_file
template = RDoc::TemplatePage.new RDoc::Page::HPP_FILE
template = RDoc::TemplatePage.new @template::HPP_FILE
values = { "title" => @options.title, "opname" => @op_name }
files = []
@files.each do |f|
@ -90,13 +90,13 @@ class RDoc::Generators::CHMGenerator < RDoc::Generators::HTMLGenerator
end
values = { "contents" => contents }
template = RDoc::TemplatePage.new RDoc::Page::CONTENTS
template = RDoc::TemplatePage.new @template::CONTENTS
File.open("contents.hhc", "w") do |f|
template.write_html_on(f, values)
end
values = { "index" => index }
template = RDoc::TemplatePage.new RDoc::Page::CHM_INDEX
template = RDoc::TemplatePage.new @template::CHM_INDEX
File.open("index.hhk", "w") do |f|
template.write_html_on(f, values)
end

View file

@ -1,14 +1,26 @@
module RDoc::Page
require 'rdoc/generators/chm'
require 'rdoc/generators/html/html'
require "rdoc/generators/template/html/html"
module RDoc::Generators::CHM::CHM
# This is a nasty little hack, but hhc doesn't support the <?xml
# tag, so...
HTML = RDoc::Generators::HTML::HTML
BODY.sub!(/<\?xml.*\?>/, '')
SRC_PAGE.sub!(/<\?xml.*\?>/, '')
INDEX = HTML::INDEX
HPP_FILE = %{
CLASS_INDEX = HTML::CLASS_INDEX
CLASS_PAGE = HTML::CLASS_PAGE
FILE_INDEX = HTML::FILE_INDEX
FILE_PAGE = HTML::FILE_PAGE
METHOD_INDEX = HTML::METHOD_INDEX
METHOD_LIST = HTML::METHOD_LIST
FR_INDEX_BODY = HTML::FR_INDEX_BODY
# This is a nasty little hack, but hhc doesn't support the <?xml tag, so...
BODY = HTML::BODY.sub!(/<\?xml.*\?>/, '')
SRC_PAGE = HTML::SRC_PAGE.sub!(/<\?xml.*\?>/, '')
HPP_FILE = <<-EOF
[OPTIONS]
Auto Index = Yes
Compatibility=1.1 or later
@ -23,9 +35,9 @@ Title=<%= values["title"] %>
<% values["all_html_files"].each do |all_html_files| %>
<%= all_html_files["html_file_name"] %>
<% end # values["all_html_files"] %>
}
EOF
CONTENTS = %{
CONTENTS = <<-EOF
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
@ -57,9 +69,9 @@ CONTENTS = %{
<% end # values["contents"] %>
</UL>
</BODY></HTML>
}
EOF
CHM_INDEX = %{
CHM_INDEX = <<-EOF
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
@ -80,7 +92,7 @@ CHM_INDEX = %{
<% end # values["index"] %>
</UL>
</BODY></HTML>
}
EOF
end

View file

@ -5,21 +5,6 @@ require 'rdoc/markup/simple_markup/to_html'
module RDoc::Generators
##
# Name of sub-direcory that holds file descriptions
FILE_DIR = "files"
##
# Name of sub-direcory that holds class descriptions
CLASS_DIR = "classes"
##
# Name of the RDoc CSS file
CSS_NAME = "rdoc-style.css"
##
# Build a hash of all items that can be cross-referenced.
# This is used when we output required and included names:
@ -126,7 +111,7 @@ module RDoc::Generators
if path[0,1] == '#' # is this meaningful?
url = path
else
url = HTMLGenerator.gen_url(@from_path, path)
url = HTML.gen_url(@from_path, path)
end
end
@ -235,7 +220,7 @@ module RDoc::Generators
if %r{^(https?:/)?/} =~ css_name
return css_name
else
return HTMLGenerator.gen_url(path, css_name)
return HTML.gen_url(path, css_name)
end
end
@ -268,6 +253,9 @@ module RDoc::Generators
def initialize(context, options)
@context = context
@options = options
# HACK ugly
@template = options.template_class
end
##
@ -285,7 +273,7 @@ module RDoc::Generators
if @options.all_one_file
"#" + path
else
HTMLGenerator.gen_url(from_path, path)
HTML.gen_url(from_path, path)
end
end
@ -513,7 +501,7 @@ module RDoc::Generators
end
def url(target)
HTMLGenerator.gen_url(path, target)
HTML.gen_url(path, target)
end
def aref_to(target)
@ -618,9 +606,9 @@ module RDoc::Generators
def write_on(f)
value_hash
template = RDoc::TemplatePage.new(RDoc::Page::BODY,
RDoc::Page::CLASS_PAGE,
RDoc::Page::METHOD_LIST)
template = RDoc::TemplatePage.new(@template::BODY,
@template::CLASS_PAGE,
@template::METHOD_LIST)
template.write_html_on(f, @values)
end
@ -851,9 +839,11 @@ module RDoc::Generators
def write_on(f)
value_hash
template = RDoc::TemplatePage.new(RDoc::Page::BODY,
RDoc::Page::FILE_PAGE,
RDoc::Page::METHOD_LIST)
template = RDoc::TemplatePage.new(@template::BODY,
@template::FILE_PAGE,
@template::METHOD_LIST)
template.write_html_on(f, @values)
end
@ -903,6 +893,10 @@ module RDoc::Generators
@context = context
@html_class = html_class
@options = options
# HACK ugly
@template = options.template_class
@@seq = @@seq.succ
@seq = @@seq
@@all_methods << self
@ -913,7 +907,7 @@ module RDoc::Generators
@source_code = markup_code(ts)
unless @options.inline_source
@src_url = create_source_code_file(@source_code)
@img_url = HTMLGenerator.gen_url(path, 'source.png')
@img_url = HTML.gen_url(path, 'source.png')
end
end
@ -928,7 +922,7 @@ module RDoc::Generators
if @options.all_one_file
"#" + path
else
HTMLGenerator.gen_url(from_path, path)
HTML.gen_url(from_path, path)
end
end
@ -988,7 +982,6 @@ module RDoc::Generators
def params
# params coming from a call-seq in 'C' will start with the
# method name
p = @context.params
if p !~ /^\w/
p = @context.params.gsub(/\s*\#.*/, '')
p = p.tr("\n", " ").squeeze(" ")
@ -1016,7 +1009,7 @@ module RDoc::Generators
FileUtils.mkdir_p(meth_path)
file_path = File.join(meth_path, @seq) + ".html"
template = RDoc::TemplatePage.new(RDoc::Page::SRC_PAGE)
template = RDoc::TemplatePage.new(@template::SRC_PAGE)
File.open(file_path, "w") do |f|
values = {
'title' => CGI.escapeHTML(index_name),
@ -1026,7 +1019,7 @@ module RDoc::Generators
}
template.write_html_on(f, values)
end
HTMLGenerator.gen_url(path, file_path)
HTML.gen_url(path, file_path)
end
def self.all_methods
@ -1149,7 +1142,7 @@ module RDoc::Generators
#
# HTML is generated using the Template class.
class HTMLGenerator
class HTML
include MarkUp
@ -1183,9 +1176,9 @@ module RDoc::Generators
HtmlMethod.reset
if options.all_one_file
HTMLGeneratorInOne.new(options)
HTMLInOne.new(options)
else
HTMLGenerator.new(options)
HTML.new(options)
end
end
@ -1226,12 +1219,17 @@ module RDoc::Generators
def load_html_template
template = @options.template
unless template =~ %r{/|\\}
template = File.join("rdoc/generators/template",
unless template =~ %r{/|\\} then
template = File.join("rdoc/generators",
@options.generator.key, template)
end
require template
extend RDoc::Page
@template = self.class.const_get @options.template.upcase
@options.template_class = @template
rescue LoadError
$stderr.puts "Could not find HTML template '#{template}'"
exit 99
@ -1241,10 +1239,20 @@ module RDoc::Generators
# Write out the style sheet used by the main frames
def write_style_sheet
template = RDoc::TemplatePage.new(RDoc::Page::STYLE)
unless @options.css
return unless @template.constants.include? :STYLE or
@template.constants.include? 'STYLE'
template = RDoc::TemplatePage.new @template::STYLE
unless @options.css then
File.open(CSS_NAME, "w") do |f|
values = { "fonts" => RDoc::Page::FONTS }
values = {}
if @template.constants.include? :FONTS or
@template.constants.include? 'FONTS' then
values["fonts"] = @template::FONTS
end
template.write_html_on(f, values)
end
end
@ -1316,25 +1324,21 @@ module RDoc::Generators
end
def gen_file_index
gen_an_index(@files, 'Files',
RDoc::Page::FILE_INDEX,
"fr_file_index.html")
gen_an_index @files, 'Files', @template::FILE_INDEX, "fr_file_index.html"
end
def gen_class_index
gen_an_index(@classes, 'Classes',
RDoc::Page::CLASS_INDEX,
gen_an_index(@classes, 'Classes', @template::CLASS_INDEX,
"fr_class_index.html")
end
def gen_method_index
gen_an_index(HtmlMethod.all_methods, 'Methods',
RDoc::Page::METHOD_INDEX,
gen_an_index(HtmlMethod.all_methods, 'Methods', @template::METHOD_INDEX,
"fr_method_index.html")
end
def gen_an_index(collection, title, template, filename)
template = RDoc::TemplatePage.new(RDoc::Page::FR_INDEX_BODY, template)
template = RDoc::TemplatePage.new @template::FR_INDEX_BODY, template
res = []
collection.sort.each do |f|
if f.document_self
@ -1362,7 +1366,7 @@ module RDoc::Generators
# line.
def gen_main_index
template = RDoc::TemplatePage.new RDoc::Page::INDEX
template = RDoc::TemplatePage.new @template::INDEX
open 'index.html', 'w' do |f|
classes = @classes.sort.map { |klass| klass.value_hash }
@ -1413,7 +1417,7 @@ module RDoc::Generators
end
class HTMLGeneratorInOne < HTMLGenerator
class HTMLInOne < HTML
def initialize(*args)
super
@ -1476,7 +1480,7 @@ module RDoc::Generators
# this method is defined in the template file
write_extra_pages if defined? write_extra_pages
template = RDoc::TemplatePage.new(RDoc::Page::ONE_PAGE)
template = RDoc::TemplatePage.new @template::ONE_PAGE
if @options.op_name
opfile = File.open(@options.op_name, "w")

View file

@ -1,10 +1,11 @@
module RDoc
module Page
require 'rdoc/generators/html'
require 'rdoc/generators/html/html'
module RDoc::Generators::HTML::HEFSS
FONTS = "Verdana, Arial, Helvetica, sans-serif"
STYLE = %{
STYLE = <<-EOF
body,p { font-family: Verdana, Arial, Helvetica, sans-serif;
color: #000040; background: #BBBBBB;
}
@ -104,13 +105,9 @@ td { font-family: Verdana, Arial, Helvetica, sans-serif;
.srcbut { float: right }
}
EOF
############################################################################
BODY = %{
BODY = <<-EOF
<html><head>
<title><%= values["title"] %></title>
<meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>">
@ -198,11 +195,9 @@ BODY = %{
</body>
</html>
}
EOF
###############################################################################
FILE_PAGE = <<_FILE_PAGE_
FILE_PAGE = <<-EOF
<table width="100%">
<tr class="title-row">
<td><table width="100%"><tr>
@ -224,11 +219,9 @@ FILE_PAGE = <<_FILE_PAGE_
</td></tr></table></td>
</tr>
</table><br />
_FILE_PAGE_
EOF
###################################################################
CLASS_PAGE = %{
CLASS_PAGE = <<-EOF
<table width="100%" border="0" cellspacing="0">
<tr class="title-row">
<td class="big-title-font">
@ -265,11 +258,9 @@ CLASS_PAGE = %{
</td>
</tr>
</table><br />
}
EOF
###################################################################
METHOD_LIST = %{
METHOD_LIST = <<-EOF
<% if values["includes"] then %>
<div class="tablesubsubtitle">Uses</div><br />
<div class="name-list">
@ -308,14 +299,9 @@ METHOD_LIST = %{
<% end %>
<% end # values["sections"] %>
<% end %>
}
EOF
=begin
=end
########################## Source code ##########################
SRC_PAGE = %{
SRC_PAGE = <<-EOF
<html>
<head><title><%= values["title"] %></title>
<meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>">
@ -339,15 +325,13 @@ SRC_PAGE = %{
<pre><%= values["code"] %></pre>
</body>
</html>
}
########################## Index ################################
EOF
FR_INDEX_BODY = %{
<%= template_include %>
}
FILE_INDEX = %{
FILE_INDEX = <<-EOF
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>">
@ -383,12 +367,12 @@ div.banner {
<a href="<%= entries["href"] %>"><%= entries["name"] %></a><br />
<% end # values["entries"] %>
</body></html>
}
EOF
CLASS_INDEX = FILE_INDEX
METHOD_INDEX = FILE_INDEX
INDEX = %{
INDEX = <<-EOF
<html>
<head>
<title><%= values["title"] %></title>
@ -414,9 +398,9 @@ INDEX = %{
</frameset>
</html>
}
EOF
# and a blank page to use as a target
# Blank page to use as a target
BLANK = %{
<html><body bgcolor="#BBBBBB"></body></html>
}
@ -427,4 +411,4 @@ def write_extra_pages
end
end
end

View file

@ -1,4 +1,7 @@
#
require 'rdoc/generators/html'
require 'rdoc/generators/html/one_page_html'
##
# = CSS2 RDoc HTML template
#
# This is a template for RDoc that uses XHTML 1.0 Transitional and dictates a
@ -17,10 +20,8 @@
# a copy of this license, visit http://creativecommons.org/licenses/by/1.0/ or
# send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California
# 94305, USA.
#
module RDoc
module Page
module RDoc::Generators::HTML::HTML
FONTS = "Verdana,Arial,Helvetica,sans-serif"
@ -239,11 +240,12 @@ EOF
### H E A D E R T E M P L A T E
#####################################################################
XHTML_PREAMBLE = %{<?xml version="1.0" encoding="<%= values["charset"] %>"?>
XHTML_PREAMBLE = <<-EOF
<?xml version="1.0" encoding="<%= values["charset"] %>"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
}
EOF
HEADER = XHTML_PREAMBLE + <<-EOF
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
@ -288,7 +290,6 @@ HEADER = XHTML_PREAMBLE + <<-EOF
<body>
EOF
#####################################################################
### C O N T E X T C O N T E N T T E M P L A T E
#####################################################################
@ -296,10 +297,10 @@ EOF
CONTEXT_CONTENT = %{
}
#####################################################################
### F O O T E R T E M P L A T E
#####################################################################
FOOTER = <<-EOF
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
@ -334,7 +335,6 @@ FILE_PAGE = <<-EOF
</div>
EOF
#####################################################################
### C L A S S P A G E H E A D E R T E M P L A T E
#####################################################################
@ -383,7 +383,6 @@ CLASS_PAGE = <<-EOF
</div>
EOF
#####################################################################
### M E T H O D L I S T T E M P L A T E
#####################################################################
@ -419,7 +418,7 @@ METHOD_LIST = <<-EOF
<div id="contents-list">
<h3 class="section-bar">Contents</h3>
<ul>
<% values["toc"].each do |toc| $stderr.puts({ :toc => toc }.inspect) %>
<% values["toc"].each do |toc| %>
<li><a href="#<%= values["href"] %>"><%= values["secname"] %></a></li>
<% end # values["toc"] %>
</ul>
@ -603,7 +602,6 @@ METHOD_LIST = <<-EOF
<% end # values["sections"] %>
EOF
#####################################################################
### B O D Y T E M P L A T E
#####################################################################
@ -620,8 +618,6 @@ BODY = HEADER + %{
} + FOOTER
#####################################################################
### S O U R C E C O D E T E M P L A T E
#####################################################################
@ -648,7 +644,7 @@ FR_INDEX_BODY = %{
<%= template_include %>
}
FILE_INDEX = XHTML_PREAMBLE + %{
FILE_INDEX = XHTML_PREAMBLE + <<-EOF
<!--
<%= values["list_title"] %>
@ -672,12 +668,13 @@ FILE_INDEX = XHTML_PREAMBLE + %{
</div>
</body>
</html>
}
EOF
CLASS_INDEX = FILE_INDEX
METHOD_INDEX = FILE_INDEX
INDEX = %{<?xml version="1.0" encoding="<%= values["charset"] %>"?>
INDEX = <<-EOF
<?xml version="1.0" encoding="<%= values["charset"] %>"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
@ -701,11 +698,7 @@ INDEX = %{<?xml version="1.0" encoding="<%= values["charset"] %>"?>
<frame src="<%= values["initial_page"] %>" name="docwin" />
</frameset>
</html>
}
EOF
end
end # module Page
end # class RDoc
require 'rdoc/generators/template/html/one_page_html'

View file

@ -1,10 +1,10 @@
module RDoc
module Page
require 'rdoc/generators/html'
module RDoc::Generators::HTML::KILMER
FONTS = "Verdana, Arial, Helvetica, sans-serif"
STYLE = %{
STYLE = <<-EOF
body,td,p { font-family: <%= values["fonts"] %>;
color: #000040;
}
@ -83,14 +83,9 @@ body,td,p { font-family: <%= values["fonts"] %>;
}
.srcbut { float: right }
EOF
}
############################################################################
BODY = %{
BODY = <<-EOF
<html><head>
<title><%= values["title"] %></title>
<meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>">
@ -184,11 +179,9 @@ BODY = %{
</body>
</html>
}
EOF
###############################################################################
FILE_PAGE = <<_FILE_PAGE_
FILE_PAGE = <<-EOF
<table width="100%">
<tr class="title-row">
<td><table width="100%"><tr>
@ -210,11 +203,9 @@ FILE_PAGE = <<_FILE_PAGE_
</td></tr></table></td>
</tr>
</table><br />
_FILE_PAGE_
EOF
###################################################################
CLASS_PAGE = %{
CLASS_PAGE = <<-EOF
<table width="100%" border="0" cellspacing="0">
<tr class="title-row">
<td class="big-title-font">
@ -251,11 +242,9 @@ CLASS_PAGE = %{
</td>
</tr>
</table><br />
}
EOF
###################################################################
METHOD_LIST = %{
METHOD_LIST = <<-EOF
<% if values["includes"] then %>
<div class="tablesubsubtitle">Included modules</div><br />
<div class="name-list">
@ -308,14 +297,9 @@ This method is also aliased as
<% end %>
<% end # values["method_list"] %>
<% end %>
}
EOF
=begin
=end
########################## Source code ##########################
SRC_PAGE = %{
SRC_PAGE = <<-EOF
<html>
<head><title><%= values["title"] %></title>
<meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>">
@ -339,15 +323,13 @@ SRC_PAGE = %{
<pre><%= values["code"] %></pre>
</body>
</html>
}
########################## Index ################################
EOF
FR_INDEX_BODY = %{
<%= template_include %>
}
FILE_INDEX = %{
FILE_INDEX = <<-EOF
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>">
@ -361,6 +343,7 @@ background-color: #ddddff;
line-height: 14px;
color: #000040;
}
div.banner {
background: #0000aa;
color: white;
@ -383,12 +366,12 @@ div.banner {
<a href="<%= entries["href"] %>"><%= entries["name"] %></a><br />
<% end # values["entries"] %>
</body></html>
}
EOF
CLASS_INDEX = FILE_INDEX
METHOD_INDEX = FILE_INDEX
INDEX = %{
INDEX = <<-EOF
<html>
<head>
<title><%= values["title"] %></title>
@ -419,9 +402,9 @@ INDEX = %{
</frameset>
</html>
}
EOF
# and a blank page to use as a target
# A blank page to use as a target
BLANK = %{
<html><body bgcolor="white"></body></html>
}
@ -432,4 +415,4 @@ def write_extra_pages
end
end
end

View file

@ -1,6 +1,8 @@
module RDoc::Page
require 'rdoc/generators/html'
CONTENTS_XML = %{
module RDoc::Generators::HTML::ONE_PAGE_HTML
CONTENTS_XML = <<-EOF
<% if defined? classes and classes["description"] then %>
<%= classes["description"] %>
<% end %>
@ -72,9 +74,7 @@ CONTENTS_XML = %{
<% end %>
<% end # classes["sections"] %>
<% end %>
}
########################################################################
EOF
ONE_PAGE = %{
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

View file

@ -6,7 +6,7 @@ require 'rdoc/ri/reader'
require 'rdoc/ri/writer'
require 'rdoc/ri/descriptions'
class RDoc::Generators::RIGenerator
class RDoc::Generators::RI
##
# Generators may need to return specific subclasses depending on the
@ -21,7 +21,7 @@ class RDoc::Generators::RIGenerator
end
##
# Set up a new RIGenerator.
# Set up a new RDoc::Generators::RI.
def initialize(options) #:not-new:
@options = options

View file

@ -1,9 +1,9 @@
require 'rdoc/generators/html_generator'
require 'rdoc/generators/html'
##
# Generate XML output as one big file
class RDoc::Generators::XMLGenerator < RDoc::Generators::HTMLGenerator
class RDoc::Generators::XML < RDoc::Generators::HTML
##
# Standard generator factory
@ -71,7 +71,7 @@ class RDoc::Generators::XMLGenerator < RDoc::Generators::HTMLGenerator
# this method is defined in the template file
write_extra_pages if defined? write_extra_pages
template = RDoc::TemplatePage.new(RDoc::Page::ONE_PAGE)
template = RDoc::TemplatePage.new @template::ONE_PAGE
if @options.op_name
opfile = File.open(@options.op_name, "w")

View file

@ -1,6 +1,8 @@
module RDoc::Page
require 'rdoc/generators/xml'
CONTENTS_RDF = %{
module RDoc::Generators::XML::RDF
CONTENTS_RDF = <<-EOF
<% if defined? classes and classes["description"] then %>
<description rd:parseType="Literal">
<%= classes["description"] %>
@ -63,7 +65,7 @@ CONTENTS_RDF = %{
<!-- end method list -->
<% end # classes["sections"] %>
<% end %>
}
EOF
########################################################################

View file

@ -1,6 +1,8 @@
module RDoc::Page
require 'rdoc/generators/xml'
CONTENTS_XML = %{
module RDoc::Generators::XML::XML
CONTENTS_XML = <<-EOF
<% if defined? classes and classes["description"] then %>
<description>
<%= classes["description"] %>
@ -69,9 +71,7 @@ CONTENTS_XML = %{
</included-module-list>
<% end %>
</contents>
}
########################################################################
EOF
ONE_PAGE = %{<?xml version="1.0" encoding="utf-8"?>
<rdoc>

View file

@ -132,6 +132,13 @@ class RDoc::Options
attr_reader :template
##
# Template class for file generation
#--
# HACK around dependencies in lib/rdoc/generators/html.rb
attr_accessor :template_class # :nodoc:
##
# Documentation title
@ -156,6 +163,7 @@ class RDoc::Options
@rdoc_include = []
@title = nil
@template = nil
@template_class = nil
@diagram = false
@fileboxes = false
@show_hash = false
@ -379,6 +387,7 @@ Usage: #{opt.program_name} [options] [names...]
"Put all the output into a single file.") do |value|
@all_one_file = value
@inline_source = value if value
@template = 'one_page_html'
end
opt.separator nil
@ -411,7 +420,7 @@ Usage: #{opt.program_name} [options] [names...]
opt.on("--quiet", "-q",
"Don't show progress as we parse.") do |value|
@quite = value
@quiet = value
end
opt.separator nil

View file

@ -68,11 +68,11 @@ module RDoc
File.directory? "#{d}/rdoc/generators"
end.each do |dir|
Dir.entries("#{dir}/rdoc/generators").each do |gen|
next unless /(\w+)_generator.rb$/ =~ gen
next unless /(\w+)\.rb$/ =~ gen
type = $1
unless GENERATORS.has_key? type
GENERATORS[type] = Generator.new("rdoc/generators/#{gen}",
"#{type.upcase}Generator".intern,
"#{type.upcase}".intern,
type)
end
end