summaryrefslogtreecommitdiff
path: root/lib/rdoc/generators
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/generators')
-rw-r--r--lib/rdoc/generators/chm.rb (renamed from lib/rdoc/generators/chm_generator.rb)10
-rw-r--r--lib/rdoc/generators/chm/chm.rb (renamed from lib/rdoc/generators/template/chm/chm.rb)36
-rw-r--r--lib/rdoc/generators/html.rb (renamed from lib/rdoc/generators/html_generator.rb)104
-rw-r--r--lib/rdoc/generators/html/hefss.rb (renamed from lib/rdoc/generators/template/html/hefss.rb)88
-rw-r--r--lib/rdoc/generators/html/html.rb (renamed from lib/rdoc/generators/template/html/html.rb)75
-rw-r--r--lib/rdoc/generators/html/kilmer.rb (renamed from lib/rdoc/generators/template/html/kilmer.rb)109
-rw-r--r--lib/rdoc/generators/html/one_page_html.rb (renamed from lib/rdoc/generators/template/html/one_page_html.rb)12
-rw-r--r--lib/rdoc/generators/ri.rb (renamed from lib/rdoc/generators/ri_generator.rb)4
-rw-r--r--lib/rdoc/generators/xml.rb (renamed from lib/rdoc/generators/xml_generator.rb)6
-rw-r--r--lib/rdoc/generators/xml/rdf.rb (renamed from lib/rdoc/generators/template/xml/rdf.rb)10
-rw-r--r--lib/rdoc/generators/xml/xml.rb (renamed from lib/rdoc/generators/template/xml/xml.rb)16
11 files changed, 224 insertions, 246 deletions
diff --git a/lib/rdoc/generators/chm_generator.rb b/lib/rdoc/generators/chm.rb
index c3272c9af3..ce05d38d50 100644
--- a/lib/rdoc/generators/chm_generator.rb
+++ b/lib/rdoc/generators/chm.rb
@@ -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
diff --git a/lib/rdoc/generators/template/chm/chm.rb b/lib/rdoc/generators/chm/chm.rb
index 1932023416..4134420668 100644
--- a/lib/rdoc/generators/template/chm/chm.rb
+++ b/lib/rdoc/generators/chm/chm.rb
@@ -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
diff --git a/lib/rdoc/generators/html_generator.rb b/lib/rdoc/generators/html.rb
index a887bd84dc..10244576df 100644
--- a/lib/rdoc/generators/html_generator.rb
+++ b/lib/rdoc/generators/html.rb
@@ -6,21 +6,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:
# if the names appear in this hash, we can generate
@@ -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")
diff --git a/lib/rdoc/generators/template/html/hefss.rb b/lib/rdoc/generators/html/hefss.rb
index a7baac6fd3..c7b4fcc449 100644
--- a/lib/rdoc/generators/template/html/hefss.rb
+++ b/lib/rdoc/generators/html/hefss.rb
@@ -1,15 +1,16 @@
-module RDoc
-module Page
+require 'rdoc/generators/html'
+require 'rdoc/generators/html/html'
+module RDoc::Generators::HTML::HEFSS
-FONTS = "Verdana, Arial, Helvetica, sans-serif"
+ FONTS = "Verdana, Arial, Helvetica, sans-serif"
-STYLE = %{
-body,p { font-family: Verdana, Arial, Helvetica, sans-serif;
+STYLE = <<-EOF
+body,p { font-family: Verdana, Arial, Helvetica, sans-serif;
color: #000040; background: #BBBBBB;
}
-td { font-family: Verdana, Arial, Helvetica, sans-serif;
+td { font-family: Verdana, Arial, Helvetica, sans-serif;
color: #000040;
}
@@ -21,7 +22,7 @@ td { font-family: Verdana, Arial, Helvetica, sans-serif;
.big-title-font { color: white;
font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: large;
+ font-size: large;
height: 50px}
.small-title-font { color: purple;
@@ -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>
-}
+ EOF
-########################## Index ################################
-
-FR_INDEX_BODY = %{
+ FR_INDEX_BODY = %{
<%= template_include %>
}
-FILE_INDEX = %{
+ FILE_INDEX = <<-EOF
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>">
@@ -355,10 +339,10 @@ FILE_INDEX = %{
<!--
body {
background-color: #bbbbbb;
- font-family: #{FONTS};
- font-size: 11px;
+ font-family: #{FONTS};
+ font-size: 11px;
font-style: normal;
- line-height: 14px;
+ line-height: 14px;
color: #000040;
}
div.banner {
@@ -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
+ CLASS_INDEX = FILE_INDEX
+ METHOD_INDEX = FILE_INDEX
-INDEX = %{
+ INDEX = <<-EOF
<html>
<head>
<title><%= values["title"] %></title>
@@ -414,17 +398,17 @@ INDEX = %{
</frameset>
</html>
-}
+ EOF
-# and a blank page to use as a target
-BLANK = %{
+ # Blank page to use as a target
+ BLANK = %{
<html><body bgcolor="#BBBBBB"></body></html>
}
-def write_extra_pages
- template = TemplatePage.new(BLANK)
- File.open("blank.html", "w") { |f| template.write_html_on(f, {}) }
-end
+ def write_extra_pages
+ template = TemplatePage.new(BLANK)
+ File.open("blank.html", "w") { |f| template.write_html_on(f, {}) }
+ end
end
-end
+
diff --git a/lib/rdoc/generators/template/html/html.rb b/lib/rdoc/generators/html/html.rb
index 528058382b..4eb7a86975 100644
--- a/lib/rdoc/generators/template/html/html.rb
+++ b/lib/rdoc/generators/html/html.rb
@@ -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,14 +20,12 @@
# 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"
+ FONTS = "Verdana,Arial,Helvetica,sans-serif"
-STYLE = <<-EOF
+ STYLE = <<-EOF
body {
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: 90%;
@@ -239,13 +240,14 @@ 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
+ HEADER = XHTML_PREAMBLE + <<-EOF
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><%= values["title"] %></title>
@@ -288,33 +290,32 @@ 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
#####################################################################
-CONTEXT_CONTENT = %{
+ CONTEXT_CONTENT = %{
}
-
#####################################################################
### F O O T E R T E M P L A T E
#####################################################################
-FOOTER = <<-EOF
+
+ FOOTER = <<-EOF
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>
-EOF
+ EOF
#####################################################################
### F I L E P A G E H E A D E R T E M P L A T E
#####################################################################
-FILE_PAGE = <<-EOF
+ FILE_PAGE = <<-EOF
<div id="fileHeader">
<h1><%= values["short_name"] %></h1>
<table class="header-table">
@@ -332,14 +333,13 @@ FILE_PAGE = <<-EOF
</tr>
</table>
</div>
-EOF
-
+ EOF
#####################################################################
### C L A S S P A G E H E A D E R T E M P L A T E
#####################################################################
-CLASS_PAGE = <<-EOF
+ CLASS_PAGE = <<-EOF
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
@@ -381,14 +381,13 @@ CLASS_PAGE = <<-EOF
<% end %>
</table>
</div>
-EOF
-
+ EOF
#####################################################################
### M E T H O D L I S T T E M P L A T E
#####################################################################
-METHOD_LIST = <<-EOF
+ METHOD_LIST = <<-EOF
<div id="contextContent">
<% if values["diagram"] then %>
@@ -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>
@@ -601,14 +600,13 @@ METHOD_LIST = <<-EOF
</div>
<% end %>
<% end # values["sections"] %>
-EOF
-
+ EOF
#####################################################################
### B O D Y T E M P L A T E
#####################################################################
-BODY = HEADER + %{
+ BODY = HEADER + %{
<%= template_include %> <!-- banner header -->
@@ -620,13 +618,11 @@ BODY = HEADER + %{
} + FOOTER
-
-
#####################################################################
### S O U R C E C O D E T E M P L A T E
#####################################################################
-SRC_PAGE = XHTML_PREAMBLE + <<-EOF
+ SRC_PAGE = XHTML_PREAMBLE + <<-EOF
<html>
<head>
<title><%= values["title"] %></title>
@@ -637,18 +633,18 @@ SRC_PAGE = XHTML_PREAMBLE + <<-EOF
<pre><%= values["code"] %></pre>
</body>
</html>
-EOF
+ EOF
#####################################################################
### I N D E X F I L E T E M P L A T E S
#####################################################################
-FR_INDEX_BODY = %{
+ 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
+ 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 # module Page
-end # class RDoc
+end
-require 'rdoc/generators/template/html/one_page_html'
diff --git a/lib/rdoc/generators/template/html/kilmer.rb b/lib/rdoc/generators/html/kilmer.rb
index 64687ff3cd..e4c5b115a6 100644
--- a/lib/rdoc/generators/template/html/kilmer.rb
+++ b/lib/rdoc/generators/html/kilmer.rb
@@ -1,11 +1,11 @@
-module RDoc
-module Page
+require 'rdoc/generators/html'
+module RDoc::Generators::HTML::KILMER
-FONTS = "Verdana, Arial, Helvetica, sans-serif"
+ FONTS = "Verdana, Arial, Helvetica, sans-serif"
-STYLE = %{
-body,td,p { font-family: <%= values["fonts"] %>;
+ STYLE = <<-EOF
+body,td,p { font-family: <%= values["fonts"] %>;
color: #000040;
}
@@ -15,11 +15,11 @@ body,td,p { font-family: <%= values["fonts"] %>;
color: #000010;
}
-.big-title-font {
+.big-title-font {
color: black;
font-weight: bold;
- font-family: <%= values["fonts"] %>;
- font-size: large;
+ font-family: <%= values["fonts"] %>;
+ font-size: large;
height: 60px;
padding: 10px 3px 10px 3px;
}
@@ -31,7 +31,7 @@ body,td,p { font-family: <%= values["fonts"] %>;
.aqua { color: black }
.method-name, .attr-name {
- font-family: font-family: <%= values["fonts"] %>;
+ font-family: font-family: <%= values["fonts"] %>;
font-weight: bold;
font-size: small;
margin-left: 20px;
@@ -67,7 +67,7 @@ body,td,p { font-family: <%= values["fonts"] %>;
font-weight: bold;
text-decoration: none;
color: #000033;
- background-color: white;
+ background-color: white;
}
.srclink {
@@ -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 %>
-}
-
-=begin
-=end
+ EOF
-########################## 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,31 +323,30 @@ SRC_PAGE = %{
<pre><%= values["code"] %></pre>
</body>
</html>
-}
-
-########################## Index ################################
+ EOF
-FR_INDEX_BODY = %{
+ FR_INDEX_BODY = %{
<%= template_include %>
}
-FILE_INDEX = %{
+ FILE_INDEX = <<-EOF
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>">
<style>
<!--
- body {
-background-color: #ddddff;
- font-family: #{FONTS};
- font-size: 11px;
- font-style: normal;
- line-height: 14px;
- color: #000040;
- }
+body {
+ background-color: #ddddff;
+ font-family: #{FONTS};
+ font-size: 11px;
+ font-style: normal;
+ line-height: 14px;
+ color: #000040;
+}
+
div.banner {
background: #0000aa;
- color: white;
+ color: white;
padding: 1;
margin: 0;
font-size: 90%;
@@ -372,7 +355,7 @@ div.banner {
text-align: center;
width: 100%;
}
-
+
-->
</style>
<base target="docwin">
@@ -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
+ CLASS_INDEX = FILE_INDEX
+ METHOD_INDEX = FILE_INDEX
-INDEX = %{
+ INDEX = <<-EOF
<html>
<head>
<title><%= values["title"] %></title>
@@ -419,17 +402,17 @@ INDEX = %{
</frameset>
</html>
-}
+ EOF
-# and a blank page to use as a target
-BLANK = %{
+ # A blank page to use as a target
+ BLANK = %{
<html><body bgcolor="white"></body></html>
}
-def write_extra_pages
- template = TemplatePage.new(BLANK)
- File.open("blank.html", "w") { |f| template.write_html_on(f, {}) }
-end
+ def write_extra_pages
+ template = TemplatePage.new(BLANK)
+ File.open("blank.html", "w") { |f| template.write_html_on(f, {}) }
+ end
end
-end
+
diff --git a/lib/rdoc/generators/template/html/one_page_html.rb b/lib/rdoc/generators/html/one_page_html.rb
index 170bbf23c8..dbac9e2f5a 100644
--- a/lib/rdoc/generators/template/html/one_page_html.rb
+++ b/lib/rdoc/generators/html/one_page_html.rb
@@ -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,11 +74,9 @@ CONTENTS_XML = %{
<% end %>
<% end # classes["sections"] %>
<% end %>
-}
-
-########################################################################
+ EOF
-ONE_PAGE = %{
+ ONE_PAGE = %{
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
diff --git a/lib/rdoc/generators/ri_generator.rb b/lib/rdoc/generators/ri.rb
index 111a232856..a8cacc7501 100644
--- a/lib/rdoc/generators/ri_generator.rb
+++ b/lib/rdoc/generators/ri.rb
@@ -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
diff --git a/lib/rdoc/generators/xml_generator.rb b/lib/rdoc/generators/xml.rb
index fe772f9ef4..d84cecc05c 100644
--- a/lib/rdoc/generators/xml_generator.rb
+++ b/lib/rdoc/generators/xml.rb
@@ -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")
diff --git a/lib/rdoc/generators/template/xml/rdf.rb b/lib/rdoc/generators/xml/rdf.rb
index fbeb599ce6..3f6643e15b 100644
--- a/lib/rdoc/generators/template/xml/rdf.rb
+++ b/lib/rdoc/generators/xml/rdf.rb
@@ -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,11 +65,11 @@ CONTENTS_RDF = %{
<!-- end method list -->
<% end # classes["sections"] %>
<% end %>
-}
+ EOF
########################################################################
-ONE_PAGE = %{<?xml version="1.0" encoding="utf-8"?>
+ ONE_PAGE = %{<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://pragprog.com/rdoc/rdoc.rdf#"
xmlns:rd="http://pragprog.com/rdoc/rdoc.rdf#">
diff --git a/lib/rdoc/generators/template/xml/xml.rb b/lib/rdoc/generators/xml/xml.rb
index ab6355a1c5..e711b514fa 100644
--- a/lib/rdoc/generators/template/xml/xml.rb
+++ b/lib/rdoc/generators/xml/xml.rb
@@ -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"] %>
@@ -11,7 +13,7 @@ CONTENTS_XML = %{
<required-file-list>
<% files["requires"].each do |requires| %>
<required-file name="<%= requires["name"] %>"
-<% if requires["aref"] then %>
+<% if requires["aref"] then %>
href="<%= requires["aref"] %>"
<% end %>
/>
@@ -69,11 +71,9 @@ CONTENTS_XML = %{
</included-module-list>
<% end %>
</contents>
-}
-
-########################################################################
+ EOF
-ONE_PAGE = %{<?xml version="1.0" encoding="utf-8"?>
+ ONE_PAGE = %{<?xml version="1.0" encoding="utf-8"?>
<rdoc>
<file-list>
<% values["files"].each do |files| %>
@@ -91,7 +91,7 @@ ONE_PAGE = %{<?xml version="1.0" encoding="utf-8"?>
<<%= classes["classmod"] %> name="<%= classes["full_name"] %>" id="<%= classes["full_name"] %>">
<classmod-info>
<% if classes["infiles"] then %>
- <infiles>
+ <infiles>
<% classes["infiles"].each do |infiles| %>
<infile><%= href infiles["full_path_url"], infiles["full_path"] %></infile>
<% end # classes["infiles"] %>