Use ERB instead of custom template language for RDoc.

Remove old_html template.

Convert all templates to ERB.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2008-01-07 10:40:50 +00:00
parent f2707db2dc
commit 466d40ed15
11 changed files with 690 additions and 1575 deletions

View File

@ -1,3 +1,11 @@
Mon Jan 7 19:39:50 2008 Eric Hodel <drbrain@segment7.net>
* lib/rdoc/template.rb: Use ERB instead of custom template language.
* lib/rdoc/generators/template/html/old_html.rb: Remove.
* lib/rdoc/generators/template/*: Convert to ERB.
Mon Jan 7 19:11:30 2008 Yukihiro Matsumoto <matz@ruby-lang.org> Mon Jan 7 19:11:30 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (Init_String): sym_match arity spec was wrong. a patch * string.c (Init_String): sym_match arity spec was wrong. a patch

View File

@ -27,8 +27,6 @@ class RDoc::Generators::CHMGenerator < RDoc::Generators::HTMLGenerator
"\n\nYou can download a copy for free from:\n\n" << "\n\nYou can download a copy for free from:\n\n" <<
" http://msdn.microsoft.com/library/default.asp?" << " http://msdn.microsoft.com/library/default.asp?" <<
"url=/library/en-us/htmlhelp/html/hwMicrosoftHTMLHelpDownloads.asp\n\n" "url=/library/en-us/htmlhelp/html/hwMicrosoftHTMLHelpDownloads.asp\n\n"
exit 99
end end
## ##
@ -54,7 +52,7 @@ class RDoc::Generators::CHMGenerator < RDoc::Generators::HTMLGenerator
# files that go to make up the help. # files that go to make up the help.
def create_project_file def create_project_file
template = TemplatePage.new(RDoc::Page::HPP_FILE) template = RDoc::TemplatePage.new RDoc::Page::HPP_FILE
values = { "title" => @options.title, "opname" => @op_name } values = { "title" => @options.title, "opname" => @op_name }
files = [] files = []
@files.each do |f| @files.each do |f|
@ -92,13 +90,13 @@ class RDoc::Generators::CHMGenerator < RDoc::Generators::HTMLGenerator
end end
values = { "contents" => contents } values = { "contents" => contents }
template = TemplatePage.new(RDoc::Page::CONTENTS) template = RDoc::TemplatePage.new RDoc::Page::CONTENTS
File.open("contents.hhc", "w") do |f| File.open("contents.hhc", "w") do |f|
template.write_html_on(f, values) template.write_html_on(f, values)
end end
values = { "index" => index } values = { "index" => index }
template = TemplatePage.new(RDoc::Page::CHM_INDEX) template = RDoc::TemplatePage.new RDoc::Page::CHM_INDEX
File.open("index.hhk", "w") do |f| File.open("index.hhk", "w") do |f|
template.write_html_on(f, values) template.write_html_on(f, values)
end end

View File

@ -1,5 +1,4 @@
module RDoc module RDoc::Page
module Page
require "rdoc/generators/template/html/html" require "rdoc/generators/template/html/html"
@ -13,17 +12,17 @@ HPP_FILE = %{
[OPTIONS] [OPTIONS]
Auto Index = Yes Auto Index = Yes
Compatibility=1.1 or later Compatibility=1.1 or later
Compiled file=%opname%.chm Compiled file=<%= values["opname"] %>.chm
Contents file=contents.hhc Contents file=contents.hhc
Full-text search=Yes Full-text search=Yes
Index file=index.hhk Index file=index.hhk
Language=0x409 English(United States) Language=0x409 English(United States)
Title=%title% Title=<%= values["title"] %>
[FILES] [FILES]
START:all_html_files <% values["all_html_files"].each do |all_html_files| %>
%html_file_name% <%= all_html_files["html_file_name"] %>
END:all_html_files <% end # values["all_html_files"] %>
} }
CONTENTS = %{ CONTENTS = %{
@ -39,28 +38,27 @@ CONTENTS = %{
<param name="ImageType" value="Folder"> <param name="ImageType" value="Folder">
</OBJECT> </OBJECT>
<UL> <UL>
START:contents <% values["contents"].each do |contents| %>
<LI> <OBJECT type="text/sitemap"> <LI> <OBJECT type="text/sitemap">
<param name="Name" value="%c_name%"> <param name="Name" value="<%= contents["c_name"] %>">
<param name="Local" value="%ref%"> <param name="Local" value="<%= contents["ref"] %>">
</OBJECT> </OBJECT>
IF:methods <% if contents["methods"] then %>
<ul> <ul>
START:methods <% contents["methods"].each do |methods| %>
<LI> <OBJECT type="text/sitemap"> <LI> <OBJECT type="text/sitemap">
<param name="Name" value="%name%"> <param name="Name" value="<%= methods["name"] %>">
<param name="Local" value="%aref%"> <param name="Local" value="<%= methods["aref"] %>">
</OBJECT> </OBJECT>
END:methods <% end # contents["methods"] %>
</ul> </ul>
ENDIF:methods <% end %>
</LI> </LI>
END:contents <% end # values["contents"] %>
</UL> </UL>
</BODY></HTML> </BODY></HTML>
} }
CHM_INDEX = %{ CHM_INDEX = %{
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML> <HTML>
@ -74,14 +72,15 @@ CHM_INDEX = %{
<param name="ImageType" value="Folder"> <param name="ImageType" value="Folder">
</OBJECT> </OBJECT>
<UL> <UL>
START:index <% values["index"].each do |index| %>
<LI> <OBJECT type="text/sitemap"> <LI> <OBJECT type="text/sitemap">
<param name="Name" value="%name%"> <param name="Name" value="<%= index["name"] %>">
<param name="Local" value="%aref%"> <param name="Local" value="<%= index["aref"] %>">
</OBJECT> </OBJECT>
END:index <% end # values["index"] %>
</UL> </UL>
</BODY></HTML> </BODY></HTML>
} }
end end
end

View File

@ -112,9 +112,9 @@ td { font-family: Verdana, Arial, Helvetica, sans-serif;
BODY = %{ BODY = %{
<html><head> <html><head>
<title>%title%</title> <title><%= values["title"] %></title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>">
<link rel="stylesheet" href="%style_url%" type="text/css" media="screen" /> <link rel="stylesheet" href="<%= values["style_url"] %>" type="text/css" media="screen" />
<script type="text/javascript" language="JavaScript"> <script type="text/javascript" language="JavaScript">
<!-- <!--
function popCode(url) { function popCode(url) {
@ -125,68 +125,76 @@ BODY = %{
</head> </head>
<body bgcolor="#BBBBBB"> <body bgcolor="#BBBBBB">
!INCLUDE! <!-- banner header --> <%= template_include %> <!-- banner header -->
IF:diagram <% if values["diagram"] then %>
<table width="100%"><tr><td align="center"> <table width="100%"><tr><td align="center">
%diagram% <%= values["diagram"] %>
</td></tr></table> </td></tr></table>
ENDIF:diagram <% end %>
IF:description <% if values["description"] then %>
<div class="description">%description%</div> <div class="description"><%= values["description"] %></div>
ENDIF:description <% end %>
IF:requires <% if values["requires"] then %>
<table cellpadding="5" width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Required files</td></tr> <tr><td class="tablesubtitle">Required files</td></tr>
</table><br /> </table><br />
<div class="name-list"> <div class="name-list">
START:requires <% values["requires"].each do |requires| %>
HREF:aref:name: <%= href requires["aref"], requires["name"] %>
END:requires <% end # values["requires"] %>
ENDIF:requires <% end %>
</div> </div>
IF:methods <% if values["sections"] then %>
<% values["sections"].each do |sections| %>
<% if sections["method_list"] then %>
<% sections["method_list"].each do |method_list| %>
<% if method_list["methods"] then %>
<table cellpadding="5" width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Subroutines and Functions</td></tr> <tr><td class="tablesubtitle">Subroutines and Functions</td></tr>
</table><br /> </table><br />
<div class="name-list"> <div class="name-list">
START:methods <% method_list["methods"].each do |methods| %>
HREF:aref:name:, <a href="<%= methods["codeurl"] %>" target="source"><%= methods["name"] %></a>
END:methods <% end # values["methods"] %>
</div> </div>
ENDIF:methods <% end %>
<% end # values["method_list"] %>
<% end %>
IF:attributes <% if sections["attributes"] then %>
<table cellpadding="5" width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Arguments</td></tr> <tr><td class="tablesubtitle">Arguments</td></tr>
</table><br /> </table><br />
<table cellspacing="5"> <table cellspacing="5">
START:attributes <% sections["attributes"].each do |attributes| %>
<tr valign="top"> <tr valign="top">
IF:rw <% if attributes["rw"] then %>
<td align="center" class="attr-rw">&nbsp;[%rw%]&nbsp;</td> <td align="center" class="attr-rw">&nbsp;[<%= attributes["rw"] %>]&nbsp;</td>
ENDIF:rw <% end %>
IFNOT:rw <% unless attributes["rw"] then %>
<td></td> <td></td>
ENDIF:rw <% end %>
<td class="attr-name">%name%</td> <td class="attr-name"><%= attributes["name"] %></td>
<td>%a_desc%</td> <td><%= attributes["a_desc"] %></td>
</tr> </tr>
END:attributes <% end # values["attributes"] %>
</table> </table>
ENDIF:attributes <% end %>
<% end # values["sections"] %>
<% end %>
IF:classlist <% if values["classlist"] then %>
<table cellpadding="5" width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Modules</td></tr> <tr><td class="tablesubtitle">Modules</td></tr>
</table><br /> </table><br />
%classlist%<br /> <%= values["classlist"] %><br />
ENDIF:classlist <% end %>
!INCLUDE! <!-- method descriptions --> <%= template_include %> <!-- method descriptions -->
</body> </body>
</html> </html>
@ -198,19 +206,19 @@ FILE_PAGE = <<_FILE_PAGE_
<table width="100%"> <table width="100%">
<tr class="title-row"> <tr class="title-row">
<td><table width="100%"><tr> <td><table width="100%"><tr>
<td class="big-title-font" colspan="2"><font size="-3"><b>File</b><br /></font>%short_name%</td> <td class="big-title-font" colspan="2"><font size="-3"><b>File</b><br /></font><%= values["short_name"] %></td>
<td align="right"><table cellspacing="0" cellpadding="2"> <td align="right"><table cellspacing="0" cellpadding="2">
<tr> <tr>
<td class="small-title-font">Path:</td> <td class="small-title-font">Path:</td>
<td class="small-title-font">%full_path% <td class="small-title-font"><%= values["full_path"] %>
IF:cvsurl <% if values["cvsurl"] then %>
&nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>) &nbsp;(<a href="<%= values["cvsurl"] %>"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
ENDIF:cvsurl <% end %>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="small-title-font">Modified:</td> <td class="small-title-font">Modified:</td>
<td class="small-title-font">%dtm_modified%</td> <td class="small-title-font"><%= values["dtm_modified"] %></td>
</tr> </tr>
</table> </table>
</td></tr></table></td> </td></tr></table></td>
@ -224,35 +232,35 @@ CLASS_PAGE = %{
<table width="100%" border="0" cellspacing="0"> <table width="100%" border="0" cellspacing="0">
<tr class="title-row"> <tr class="title-row">
<td class="big-title-font"> <td class="big-title-font">
<font size="-3"><b>%classmod%</b><br /></font>%full_name% <font size="-3"><b><%= values["classmod"] %></b><br /></font><%= values["full_name"] %>
</td> </td>
<td align="right"> <td align="right">
<table cellspacing="0" cellpadding="2"> <table cellspacing="0" cellpadding="2">
<tr valign="top"> <tr valign="top">
<td class="small-title-font">In:</td> <td class="small-title-font">In:</td>
<td class="small-title-font"> <td class="small-title-font">
START:infiles <% values["infiles"].each do |infiles| %>
HREF:full_path_url:full_path: <%= href infiles["full_path_url"], infiles["full_path"] %>
IF:cvsurl <% if infiles["cvsurl"] then %>
&nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>) &nbsp;(<a href="<%= infiles["cvsurl"] %>"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
ENDIF:cvsurl <% end %>
END:infiles <% end # values["infiles"] %>
</td> </td>
</tr> </tr>
IF:parent <% if values["parent"] then %>
<tr> <tr>
<td class="small-title-font">Parent:</td> <td class="small-title-font">Parent:</td>
<td class="small-title-font"> <td class="small-title-font">
IF:par_url <% if values["par_url"] then %>
<a href="%par_url%" class="cyan"> <a href="<%= values["par_url"] %>" class="cyan">
ENDIF:par_url <% end %>
%parent% <%= values["parent"] %>
IF:par_url <% if values["par_url"] then %>
</a> </a>
ENDIF:par_url <% end %>
</td> </td>
</tr> </tr>
ENDIF:parent <% end %>
</table> </table>
</td> </td>
</tr> </tr>
@ -262,40 +270,44 @@ ENDIF:parent
################################################################### ###################################################################
METHOD_LIST = %{ METHOD_LIST = %{
IF:includes <% if values["includes"] then %>
<div class="tablesubsubtitle">Uses</div><br /> <div class="tablesubsubtitle">Uses</div><br />
<div class="name-list"> <div class="name-list">
START:includes <% values["includes"].each do |includes| %>
<span class="method-name">HREF:aref:name:</span> <span class="method-name"><%= href includes["aref"], includes["name"] %></span>
END:includes <% end # values["includes"] %>
</div> </div>
ENDIF:includes <% end %>
IF:method_list <% if values["sections"] then %>
START:method_list <% values["sections"].each do |sections| %>
IF:methods <% if sections["method_list"] then %>
<% sections["method_list"].each do |method_list| %>
<% if method_list["methods"] then %>
<table cellpadding="5" width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">%type% %category% methods</td></tr> <tr><td class="tablesubtitle"><%= method_list["type"] %> <%= method_list["category"] %> methods</td></tr>
</table> </table>
START:methods <% method_list["methods"].each do |methods| %>
<table width="100%" cellspacing="0" cellpadding="5" border="0"> <table width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle"> <tr><td class="methodtitle">
<a name="%aref%"> <a name="<%= methods["aref"] %>">
<b>%name%</b>%params% <b><%= methods["name"] %></b><%= methods["params"] %>
IF:codeurl <% if methods["codeurl"] then %>
<a href="%codeurl%" target="source" class="srclink">src</a> <a href="<%= methods["codeurl"] %>" target="source" class="srclink">src</a>
ENDIF:codeurl <% end %>
</a></td></tr> </a></td></tr>
</table> </table>
IF:m_desc <% if method_list["m_desc"] then %>
<div class="description"> <div class="description">
%m_desc% <%= method_list["m_desc"] %>
</div> </div>
ENDIF:m_desc <% end %>
END:methods <% end # method_list["methods"] %>
ENDIF:methods <% end %>
END:method_list <% end # sections["method_list"] %>
ENDIF:method_list <% end %>
<% end # values["sections"] %>
<% end %>
} }
=begin =begin
@ -305,8 +317,8 @@ ENDIF:method_list
SRC_PAGE = %{ SRC_PAGE = %{
<html> <html>
<head><title>%title%</title> <head><title><%= values["title"] %></title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>">
<style type="text/css"> <style type="text/css">
.kw { color: #3333FF; font-weight: bold } .kw { color: #3333FF; font-weight: bold }
.cmt { color: green; font-style: italic } .cmt { color: green; font-style: italic }
@ -324,7 +336,7 @@ SRC_PAGE = %{
</style> </style>
</head> </head>
<body bgcolor="#BBBBBB"> <body bgcolor="#BBBBBB">
<pre>%code%</pre> <pre><%= values["code"] %></pre>
</body> </body>
</html> </html>
} }
@ -332,13 +344,13 @@ SRC_PAGE = %{
########################## Index ################################ ########################## Index ################################
FR_INDEX_BODY = %{ FR_INDEX_BODY = %{
!INCLUDE! <%= template_include %>
} }
FILE_INDEX = %{ FILE_INDEX = %{
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>">
<style type="text/css"> <style type="text/css">
<!-- <!--
body { body {
@ -366,10 +378,10 @@ div.banner {
<base target="docwin"> <base target="docwin">
</head> </head>
<body> <body>
<div class="banner">%list_title%</div> <div class="banner"><%= values["list_title"] %></div>
START:entries <% values["entries"].each do |entries| %>
<a href="%href%">%name%</a><br /> <a href="<%= entries["href"] %>"><%= entries["name"] %></a><br />
END:entries <% end # values["entries"] %>
</body></html> </body></html>
} }
@ -379,8 +391,8 @@ METHOD_INDEX = FILE_INDEX
INDEX = %{ INDEX = %{
<html> <html>
<head> <head>
<title>%title%</title> <title><%= values["title"] %></title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>">
</head> </head>
<frameset cols="20%,*"> <frameset cols="20%,*">
@ -390,7 +402,7 @@ INDEX = %{
<frame src="fr_method_index.html" name="Subroutines and Functions"> <frame src="fr_method_index.html" name="Subroutines and Functions">
</frameset> </frameset>
<frameset rows="80%,20%"> <frameset rows="80%,20%">
<frame src="%initial_page%" name="docwin"> <frame src="<%= values["initial_page"] %>" name="docwin">
<frame src="blank.html" name="source"> <frame src="blank.html" name="source">
</frameset> </frameset>
<noframes> <noframes>

View File

@ -24,7 +24,7 @@ module RDoc
FONTS = "Verdana,Arial,Helvetica,sans-serif" FONTS = "Verdana,Arial,Helvetica,sans-serif"
STYLE = %{ STYLE = <<-EOF
body { body {
font-family: Verdana,Arial,Helvetica,sans-serif; font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: 90%; font-size: 90%;
@ -232,26 +232,26 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
.ruby-comment { color: #b22222; font-weight: bold; background: transparent; } .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
.ruby-regexp { color: #ffa07a; background: transparent; } .ruby-regexp { color: #ffa07a; background: transparent; }
.ruby-value { color: #7fffd4; background: transparent; } .ruby-value { color: #7fffd4; background: transparent; }
} EOF
##################################################################### #####################################################################
### H E A D E R T E M P L A T E ### H E A D E R T E M P L A T E
##################################################################### #####################################################################
XHTML_PREAMBLE = %{<?xml version="1.0" encoding="%charset%"?> XHTML_PREAMBLE = %{<?xml version="1.0" encoding="<%= values["charset"] %>"?>
<!DOCTYPE html <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
} }
HEADER = XHTML_PREAMBLE + %{ HEADER = XHTML_PREAMBLE + <<-EOF
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<title>%title%</title> <title><%= values["title"] %></title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%" /> <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>" />
<meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="%style_url%" type="text/css" media="screen" /> <link rel="stylesheet" href="<%= values["style_url"] %>" type="text/css" media="screen" />
<script type="text/javascript"> <script type="text/javascript">
// <![CDATA[ // <![CDATA[
@ -286,7 +286,7 @@ HEADER = XHTML_PREAMBLE + %{
</head> </head>
<body> <body>
} EOF
##################################################################### #####################################################################
@ -300,308 +300,308 @@ CONTEXT_CONTENT = %{
##################################################################### #####################################################################
### F O O T E R T E M P L A T E ### F O O T E R T E M P L A T E
##################################################################### #####################################################################
FOOTER = %{ FOOTER = <<-EOF
<div id="validator-badges"> <div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div> </div>
</body> </body>
</html> </html>
} EOF
##################################################################### #####################################################################
### F I L E P A G E H E A D E R T E M P L A T E ### F I L E P A G E H E A D E R T E M P L A T E
##################################################################### #####################################################################
FILE_PAGE = %{ FILE_PAGE = <<-EOF
<div id="fileHeader"> <div id="fileHeader">
<h1>%short_name%</h1> <h1><%= values["short_name"] %></h1>
<table class="header-table"> <table class="header-table">
<tr class="top-aligned-row"> <tr class="top-aligned-row">
<td><strong>Path:</strong></td> <td><strong>Path:</strong></td>
<td>%full_path% <td><%= values["full_path"] %>
IF:cvsurl <% if values["cvsurl"] then %>
&nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>) &nbsp;(<a href="<%= values["cvsurl"] %>"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
ENDIF:cvsurl <% end %>
</td> </td>
</tr> </tr>
<tr class="top-aligned-row"> <tr class="top-aligned-row">
<td><strong>Last Update:</strong></td> <td><strong>Last Update:</strong></td>
<td>%dtm_modified%</td> <td><%= values["dtm_modified"] %></td>
</tr> </tr>
</table> </table>
</div> </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 ### 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 = %{ CLASS_PAGE = <<-EOF
<div id="classHeader"> <div id="classHeader">
<table class="header-table"> <table class="header-table">
<tr class="top-aligned-row"> <tr class="top-aligned-row">
<td><strong>%classmod%</strong></td> <td><strong><%= values["classmod"] %></strong></td>
<td class="class-name-in-header">%full_name%</td> <td class="class-name-in-header"><%= values["full_name"] %></td>
</tr> </tr>
<tr class="top-aligned-row"> <tr class="top-aligned-row">
<td><strong>In:</strong></td> <td><strong>In:</strong></td>
<td> <td>
START:infiles <% values["infiles"].each do |infiles| %>
IF:full_path_url <% if infiles["full_path_url"] then %>
<a href="%full_path_url%"> <a href="<%= infiles["full_path_url"] %>">
ENDIF:full_path_url <% end %>
%full_path% <%= infiles["full_path"] %>
IF:full_path_url <% if infiles["full_path_url"] then %>
</a> </a>
ENDIF:full_path_url <% end %>
IF:cvsurl <% if infiles["cvsurl"] then %>
&nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>) &nbsp;(<a href="<%= infiles["cvsurl"] %>"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
ENDIF:cvsurl <% end %>
<br /> <br />
END:infiles <% end # values["infiles"] %>
</td> </td>
</tr> </tr>
IF:parent <% if values["parent"] then %>
<tr class="top-aligned-row"> <tr class="top-aligned-row">
<td><strong>Parent:</strong></td> <td><strong>Parent:</strong></td>
<td> <td>
IF:par_url <% if values["par_url"] then %>
<a href="%par_url%"> <a href="<%= values["par_url"] %>">
ENDIF:par_url <% end %>
%parent% <%= values["parent"] %>
IF:par_url <% if values["par_url"] then %>
</a> </a>
ENDIF:par_url <% end %>
</td> </td>
</tr> </tr>
ENDIF:parent <% end %>
</table> </table>
</div> </div>
} EOF
##################################################################### #####################################################################
### M E T H O D L I S T T E M P L A T E ### M E T H O D L I S T T E M P L A T E
##################################################################### #####################################################################
METHOD_LIST = %{ METHOD_LIST = <<-EOF
<div id="contextContent"> <div id="contextContent">
IF:diagram <% if values["diagram"] then %>
<div id="diagram"> <div id="diagram">
%diagram% <%= values["diagram"] %>
</div> </div>
ENDIF:diagram <% end %>
IF:description <% if values["description"] then %>
<div id="description"> <div id="description">
%description% <%= values["description"] %>
</div> </div>
ENDIF:description <% end %>
IF:requires <% if values["requires"] then %>
<div id="requires-list"> <div id="requires-list">
<h3 class="section-bar">Required files</h3> <h3 class="section-bar">Required files</h3>
<div class="name-list"> <div class="name-list">
START:requires <% values["requires"].each do |requires| %>
HREF:aref:name:&nbsp;&nbsp; <%= href requires["aref"], requires["name"] %>&nbsp;&nbsp;
END:requires <% end # values["requires"] %>
</div> </div>
</div> </div>
ENDIF:requires <% end %>
IF:toc <% if values["toc"] then %>
<div id="contents-list"> <div id="contents-list">
<h3 class="section-bar">Contents</h3> <h3 class="section-bar">Contents</h3>
<ul> <ul>
START:toc <% values["toc"].each do |toc| $stderr.puts({ :toc => toc }.inspect) %>
<li><a href="#%href%">%secname%</a></li> <li><a href="#<%= values["href"] %>"><%= values["secname"] %></a></li>
END:toc <% end # values["toc"] %>
</ul> </ul>
ENDIF:toc <% end %>
</div> </div>
IF:methods <% if values["methods"] then %>
<div id="method-list"> <div id="method-list">
<h3 class="section-bar">Methods</h3> <h3 class="section-bar">Methods</h3>
<div class="name-list"> <div class="name-list">
START:methods <% values["methods"].each do |methods| %>
HREF:aref:name:&nbsp;&nbsp; <%= href methods["aref"], methods["name"] %>&nbsp;&nbsp;
END:methods <% end # values["methods"] %>
</div> </div>
</div> </div>
ENDIF:methods <% end %>
</div> </div>
<!-- if includes --> <!-- if includes -->
IF:includes <% if values["includes"] then %>
<div id="includes"> <div id="includes">
<h3 class="section-bar">Included Modules</h3> <h3 class="section-bar">Included Modules</h3>
<div id="includes-list"> <div id="includes-list">
START:includes <% values["includes"].each do |includes| %>
<span class="include-name">HREF:aref:name:</span> <span class="include-name"><%= href includes["aref"], includes["name"] %></span>
END:includes <% end # values["includes"] %>
</div> </div>
</div> </div>
ENDIF:includes <% end %>
START:sections <% values["sections"].each do |sections| %>
<div id="section"> <div id="section">
IF:sectitle <% if sections["sectitle"] then %>
<h2 class="section-title"><a name="%secsequence%">%sectitle%</a></h2> <h2 class="section-title"><a name="<%= sections["secsequence"] %>"><%= sections["sectitle"] %></a></h2>
IF:seccomment <% if sections["seccomment"] then %>
<div class="section-comment"> <div class="section-comment">
%seccomment% <%= sections["seccomment"] %>
</div> </div>
ENDIF:seccomment <% end %>
ENDIF:sectitle <% end %>
IF:classlist <% if values["classlist"] then %>
<div id="class-list"> <div id="class-list">
<h3 class="section-bar">Classes and Modules</h3> <h3 class="section-bar">Classes and Modules</h3>
%classlist% <%= values["classlist"] %>
</div> </div>
ENDIF:classlist <% end %>
IF:constants <% if values["constants"] then %>
<div id="constants-list"> <div id="constants-list">
<h3 class="section-bar">Constants</h3> <h3 class="section-bar">Constants</h3>
<div class="name-list"> <div class="name-list">
<table summary="Constants"> <table summary="Constants">
START:constants <% values["constants"].each do |constants| $stderr.puts({ :constants => constants }.inspect) %>
<tr class="top-aligned-row context-row"> <tr class="top-aligned-row context-row">
<td class="context-item-name">%name%</td> <td class="context-item-name"><%= values["name"] %></td>
<td>=</td> <td>=</td>
<td class="context-item-value">%value%</td> <td class="context-item-value"><%= values["value"] %></td>
IF:desc <% if values["desc"] then %>
<td width="3em">&nbsp;</td> <td width="3em">&nbsp;</td>
<td class="context-item-desc">%desc%</td> <td class="context-item-desc"><%= values["desc"] %></td>
ENDIF:desc <% end %>
</tr> </tr>
END:constants <% end # values["constants"] %>
</table> </table>
</div> </div>
</div> </div>
ENDIF:constants <% end %>
IF:aliases <% if values["aliases"] then %>
<div id="aliases-list"> <div id="aliases-list">
<h3 class="section-bar">External Aliases</h3> <h3 class="section-bar">External Aliases</h3>
<div class="name-list"> <div class="name-list">
<table summary="aliases"> <table summary="aliases">
START:aliases <% values["aliases"].each do |aliases| $stderr.puts({ :aliases => aliases }.inspect) %>
<tr class="top-aligned-row context-row"> <tr class="top-aligned-row context-row">
<td class="context-item-name">%old_name%</td> <td class="context-item-name"><%= values["old_name"] %></td>
<td>-&gt;</td> <td>-&gt;</td>
<td class="context-item-value">%new_name%</td> <td class="context-item-value"><%= values["new_name"] %></td>
</tr> </tr>
IF:desc <% if values["desc"] then %>
<tr class="top-aligned-row context-row"> <tr class="top-aligned-row context-row">
<td>&nbsp;</td> <td>&nbsp;</td>
<td colspan="2" class="context-item-desc">%desc%</td> <td colspan="2" class="context-item-desc"><%= values["desc"] %></td>
</tr> </tr>
ENDIF:desc <% end %>
END:aliases <% end # values["aliases"] %>
</table> </table>
</div> </div>
</div> </div>
ENDIF:aliases <% end %>
IF:attributes <% if values["attributes"] then %>
<div id="attribute-list"> <div id="attribute-list">
<h3 class="section-bar">Attributes</h3> <h3 class="section-bar">Attributes</h3>
<div class="name-list"> <div class="name-list">
<table> <table>
START:attributes <% values["attributes"].each do |attributes| $stderr.puts({ :attributes => attributes }.inspect) %>
<tr class="top-aligned-row context-row"> <tr class="top-aligned-row context-row">
<td class="context-item-name">%name%</td> <td class="context-item-name"><%= values["name"] %></td>
IF:rw <% if values["rw"] then %>
<td class="context-item-value">&nbsp;[%rw%]&nbsp;</td> <td class="context-item-value">&nbsp;[<%= values["rw"] %>]&nbsp;</td>
ENDIF:rw <% end %>
IFNOT:rw <% unless values["rw"] then %>
<td class="context-item-value">&nbsp;&nbsp;</td> <td class="context-item-value">&nbsp;&nbsp;</td>
ENDIF:rw <% end %>
<td class="context-item-desc">%a_desc%</td> <td class="context-item-desc"><%= values["a_desc"] %></td>
</tr> </tr>
END:attributes <% end # values["attributes"] %>
</table> </table>
</div> </div>
</div> </div>
ENDIF:attributes <% end %>
<!-- if method_list --> <!-- if method_list -->
IF:method_list <% if sections["method_list"] then %>
<div id="methods"> <div id="methods">
START:method_list <% sections["method_list"].each do |method_list| %>
IF:methods <% if method_list["methods"] then %>
<h3 class="section-bar">%type% %category% methods</h3> <h3 class="section-bar"><%= method_list["type"] %> <%= method_list["category"] %> methods</h3>
START:methods <% method_list["methods"].each do |methods| %>
<div id="method-%aref%" class="method-detail"> <div id="method-<%= methods["aref"] %>" class="method-detail">
<a name="%aref%"></a> <a name="<%= methods["aref"] %>"></a>
<div class="method-heading"> <div class="method-heading">
IF:codeurl <% if methods["codeurl"] then %>
<a href="%codeurl%" target="Code" class="method-signature" <a href="<%= methods["codeurl"] %>" target="Code" class="method-signature"
onclick="popupCode('%codeurl%');return false;"> onclick="popupCode('<%= methods["codeurl"] %>');return false;">
ENDIF:codeurl <% end %>
IF:sourcecode <% if methods["sourcecode"] then %>
<a href="#%aref%" class="method-signature"> <a href="#<%= methods["aref"] %>" class="method-signature">
ENDIF:sourcecode <% end %>
IF:callseq <% if methods["callseq"] then %>
<span class="method-name">%callseq%</span> <span class="method-name"><%= methods["callseq"] %></span>
ENDIF:callseq <% end %>
IFNOT:callseq <% unless methods["callseq"] then %>
<span class="method-name">%name%</span><span class="method-args">%params%</span> <span class="method-name"><%= methods["name"] %></span><span class="method-args"><%= methods["params"] %></span>
ENDIF:callseq <% end %>
IF:codeurl <% if methods["codeurl"] then %>
</a> </a>
ENDIF:codeurl <% end %>
IF:sourcecode <% if methods["sourcecode"] then %>
</a> </a>
ENDIF:sourcecode <% end %>
</div> </div>
<div class="method-description"> <div class="method-description">
IF:m_desc <% if methods["m_desc"] then %>
%m_desc% <%= methods["m_desc"] %>
ENDIF:m_desc <% end %>
IF:sourcecode <% if methods["sourcecode"] then %>
<p><a class="source-toggle" href="#" <p><a class="source-toggle" href="#"
onclick="toggleCode('%aref%-source');return false;">[Source]</a></p> onclick="toggleCode('<%= methods["aref"] %>-source');return false;">[Source]</a></p>
<div class="method-source-code" id="%aref%-source"> <div class="method-source-code" id="<%= methods["aref"] %>-source">
<pre> <pre>
%sourcecode% <%= methods["sourcecode"] %>
</pre> </pre>
</div> </div>
ENDIF:sourcecode <% end %>
</div> </div>
</div> </div>
END:methods <% end # method_list["methods"] %>
ENDIF:methods <% end %>
END:method_list <% end # sections["method_list"] %>
</div> </div>
ENDIF:method_list <% end %>
END:sections <% end # values["sections"] %>
} EOF
##################################################################### #####################################################################
@ -610,7 +610,7 @@ END:sections
BODY = HEADER + %{ BODY = HEADER + %{
!INCLUDE! <!-- banner header --> <%= template_include %> <!-- banner header -->
<div id="bodyContent"> <div id="bodyContent">
@ -626,18 +626,18 @@ BODY = HEADER + %{
### S O U R C E C O D E T E M P L A T E ### S O U R C E C O D E T E M P L A T E
##################################################################### #####################################################################
SRC_PAGE = XHTML_PREAMBLE + %{ SRC_PAGE = XHTML_PREAMBLE + <<-EOF
<html> <html>
<head> <head>
<title>%title%</title> <title><%= values["title"] %></title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%" /> <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>" />
<link rel="stylesheet" href="%style_url%" type="text/css" media="screen" /> <link rel="stylesheet" href="<%= values["style_url"] %>" type="text/css" media="screen" />
</head> </head>
<body class="standalone-code"> <body class="standalone-code">
<pre>%code%</pre> <pre><%= values["code"] %></pre>
</body> </body>
</html> </html>
} EOF
##################################################################### #####################################################################
@ -645,29 +645,29 @@ SRC_PAGE = XHTML_PREAMBLE + %{
##################################################################### #####################################################################
FR_INDEX_BODY = %{ FR_INDEX_BODY = %{
!INCLUDE! <%= template_include %>
} }
FILE_INDEX = XHTML_PREAMBLE + %{ FILE_INDEX = XHTML_PREAMBLE + %{
<!-- <!--
%list_title% <%= values["list_title"] %>
--> -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<title>%list_title%</title> <title><%= values["list_title"] %></title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%" /> <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>" />
<link rel="stylesheet" href="%style_url%" type="text/css" /> <link rel="stylesheet" href="<%= values["style_url"] %>" type="text/css" />
<base target="docwin" /> <base target="docwin" />
</head> </head>
<body> <body>
<div id="index"> <div id="index">
<h1 class="section-bar">%list_title%</h1> <h1 class="section-bar"><%= values["list_title"] %></h1>
<div id="index-entries"> <div id="index-entries">
START:entries <% values["entries"].each do |entries| %>
<a href="%href%">%name%</a><br /> <a href="<%= entries["href"] %>"><%= entries["name"] %></a><br />
END:entries <% end # values["entries"] %>
</div> </div>
</div> </div>
</body> </body>
@ -677,20 +677,20 @@ END:entries
CLASS_INDEX = FILE_INDEX CLASS_INDEX = FILE_INDEX
METHOD_INDEX = FILE_INDEX METHOD_INDEX = FILE_INDEX
INDEX = %{<?xml version="1.0" encoding="%charset%"?> INDEX = %{<?xml version="1.0" encoding="<%= values["charset"] %>"?>
<!DOCTYPE html <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<!-- <!--
%title% <%= values["title"] %>
--> -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<title>%title%</title> <title><%= values["title"] %></title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%" /> <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>" />
</head> </head>
<frameset rows="20%, 80%"> <frameset rows="20%, 80%">
<frameset cols="25%,35%,45%"> <frameset cols="25%,35%,45%">
@ -698,7 +698,7 @@ INDEX = %{<?xml version="1.0" encoding="%charset%"?>
<frame src="fr_class_index.html" name="Classes" /> <frame src="fr_class_index.html" name="Classes" />
<frame src="fr_method_index.html" name="Methods" /> <frame src="fr_method_index.html" name="Methods" />
</frameset> </frameset>
<frame src="%initial_page%" name="docwin" /> <frame src="<%= values["initial_page"] %>" name="docwin" />
</frameset> </frameset>
</html> </html>
} }

View File

@ -5,7 +5,7 @@ module Page
FONTS = "Verdana, Arial, Helvetica, sans-serif" FONTS = "Verdana, Arial, Helvetica, sans-serif"
STYLE = %{ STYLE = %{
body,td,p { font-family: %fonts%; body,td,p { font-family: <%= values["fonts"] %>;
color: #000040; color: #000040;
} }
@ -18,20 +18,20 @@ body,td,p { font-family: %fonts%;
.big-title-font { .big-title-font {
color: black; color: black;
font-weight: bold; font-weight: bold;
font-family: %fonts%; font-family: <%= values["fonts"] %>;
font-size: large; font-size: large;
height: 60px; height: 60px;
padding: 10px 3px 10px 3px; padding: 10px 3px 10px 3px;
} }
.small-title-font { color: black; .small-title-font { color: black;
font-family: %fonts%; font-family: <%= values["fonts"] %>;
font-size:10; } font-size:10; }
.aqua { color: black } .aqua { color: black }
.method-name, .attr-name { .method-name, .attr-name {
font-family: font-family: %fonts%; font-family: font-family: <%= values["fonts"] %>;
font-weight: bold; font-weight: bold;
font-size: small; font-size: small;
margin-left: 20px; margin-left: 20px;
@ -92,9 +92,9 @@ body,td,p { font-family: %fonts%;
BODY = %{ BODY = %{
<html><head> <html><head>
<title>%title%</title> <title><%= values["title"] %></title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>">
<link rel="stylesheet" href="%style_url%" type="text/css" media="screen" /> <link rel="stylesheet" href="<%= values["style_url"] %>" type="text/css" media="screen" />
<script type="text/javascript" language="JavaScript"> <script type="text/javascript" language="JavaScript">
<!-- <!--
function popCode(url) { function popCode(url) {
@ -105,82 +105,82 @@ BODY = %{
</head> </head>
<body bgcolor="white"> <body bgcolor="white">
!INCLUDE! <!-- banner header --> <%= template_include %> <!-- banner header -->
IF:diagram <% if values["diagram"] then %>
<table width="100%"><tr><td align="center"> <table width="100%"><tr><td align="center">
%diagram% <%= values["diagram"] %>
</td></tr></table> </td></tr></table>
ENDIF:diagram <% end %>
IF:description <% if values["description"] then %>
<div class="description">%description%</div> <div class="description"><%= values["description"] %></div>
ENDIF:description <% end %>
IF:requires <% if values["requires"] then %>
<table cellpadding="5" width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Required files</td></tr> <tr><td class="tablesubtitle">Required files</td></tr>
</table><br /> </table><br />
<div class="name-list"> <div class="name-list">
START:requires <% values["requires"].each do |requires| %>
HREF:aref:name: <%= href requires["aref"], requires["name"] %>
END:requires <% end # values["requires"] %>
ENDIF:requires <% end %>
</div> </div>
IF:methods <% if values["methods"] then %>
<table cellpadding="5" width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Methods</td></tr> <tr><td class="tablesubtitle">Methods</td></tr>
</table><br /> </table><br />
<div class="name-list"> <div class="name-list">
START:methods <% values["methods"].each do |methods| %>
HREF:aref:name:, <%= href methods["aref"], methods["name"] %>,
END:methods <% end # values["methods"] %>
</div> </div>
ENDIF:methods <% end %>
START:sections <% values["sections"].each do |sections| %>
<div id="section"> <div id="section">
IF:sectitle <% if sections["sectitle"] then %>
<h2 class="section-title"><a name="%secsequence%">%sectitle%</a></h2> <h2 class="section-title"><a name="<%= sections["secsequence"] %>"><%= sections["sectitle"] %></a></h2>
IF:seccomment <% if sections["seccomment"] then %>
<div class="section-comment"> <div class="section-comment">
%seccomment% <%= sections["seccomment"] %>
</div> </div>
ENDIF:seccomment <% end %>
ENDIF:sectitle <% end %>
IF:attributes <% if sections["attributes"] then %>
<table cellpadding="5" width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Attributes</td></tr> <tr><td class="tablesubtitle">Attributes</td></tr>
</table><br /> </table><br />
<table cellspacing="5"> <table cellspacing="5">
START:attributes <% sections["attributes"].each do |attributes| %>
<tr valign="top"> <tr valign="top">
IF:rw <% if attributes["rw"] then %>
<td align="center" class="attr-rw">&nbsp;[%rw%]&nbsp;</td> <td align="center" class="attr-rw">&nbsp;[<%= attributes["rw"] %>]&nbsp;</td>
ENDIF:rw <% end %>
IFNOT:rw <% unless attributes["rw"] then %>
<td></td> <td></td>
ENDIF:rw <% end %>
<td class="attr-name">%name%</td> <td class="attr-name"><%= attributes["name"] %></td>
<td>%a_desc%</td> <td><%= attributes["a_desc"] %></td>
</tr> </tr>
END:attributes <% end # sections["attributes"] %>
</table> </table>
ENDIF:attributes <% end %>
IF:classlist <% if sections["classlist"] then %>
<table cellpadding="5" width="100%"> <table cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Classes and Modules</td></tr> <tr><td class="tablesubtitle">Classes and Modules</td></tr>
</table><br /> </table><br />
%classlist%<br /> <%= sections["classlist"] %><br />
ENDIF:classlist <% end %>
!INCLUDE! <!-- method descriptions --> <%= template_include %> <!-- method descriptions -->
END:sections <% end # values["sections"] %>
</body> </body>
</html> </html>
@ -192,19 +192,19 @@ FILE_PAGE = <<_FILE_PAGE_
<table width="100%"> <table width="100%">
<tr class="title-row"> <tr class="title-row">
<td><table width="100%"><tr> <td><table width="100%"><tr>
<td class="big-title-font" colspan="2"><font size="-3"><b>File</b><br /></font>%short_name%</td> <td class="big-title-font" colspan="2"><font size="-3"><b>File</b><br /></font><%= values["short_name"] %></td>
<td align="right"><table cellspacing="0" cellpadding="2"> <td align="right"><table cellspacing="0" cellpadding="2">
<tr> <tr>
<td class="small-title-font">Path:</td> <td class="small-title-font">Path:</td>
<td class="small-title-font">%full_path% <td class="small-title-font"><%= values["full_path"] %>
IF:cvsurl <% if values["cvsurl"] then %>
&nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>) &nbsp;(<a href="<%= values["cvsurl"] %>"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
ENDIF:cvsurl <% end %>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="small-title-font">Modified:</td> <td class="small-title-font">Modified:</td>
<td class="small-title-font">%dtm_modified%</td> <td class="small-title-font"><%= values["dtm_modified"] %></td>
</tr> </tr>
</table> </table>
</td></tr></table></td> </td></tr></table></td>
@ -218,35 +218,35 @@ CLASS_PAGE = %{
<table width="100%" border="0" cellspacing="0"> <table width="100%" border="0" cellspacing="0">
<tr class="title-row"> <tr class="title-row">
<td class="big-title-font"> <td class="big-title-font">
<font size="-3"><b>%classmod%</b><br /></font>%full_name% <font size="-3"><b><%= values["classmod"] %></b><br /></font><%= values["full_name"] %>
</td> </td>
<td align="right"> <td align="right">
<table cellspacing="0" cellpadding="2"> <table cellspacing="0" cellpadding="2">
<tr valign="top"> <tr valign="top">
<td class="small-title-font">In:</td> <td class="small-title-font">In:</td>
<td class="small-title-font"> <td class="small-title-font">
START:infiles <% values["infiles"].each do |infiles| %>
HREF:full_path_url:full_path: <%= href infiles["full_path_url"], infiles["full_path"] %>
IF:cvsurl <% if infiles["cvsurl"] then %>
&nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>) &nbsp;(<a href="<%= infiles["cvsurl"] %>"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
ENDIF:cvsurl <% end %>
END:infiles <% end # values["infiles"] %>
</td> </td>
</tr> </tr>
IF:parent <% if values["parent"] then %>
<tr> <tr>
<td class="small-title-font">Parent:</td> <td class="small-title-font">Parent:</td>
<td class="small-title-font"> <td class="small-title-font">
IF:par_url <% if values["par_url"] then %>
<a href="%par_url%" class="cyan"> <a href="<%= values["par_url"] %>" class="cyan">
ENDIF:par_url <% end %>
%parent% <%= values["parent"] %>
IF:par_url <% if values["par_url"] then %>
</a> </a>
ENDIF:par_url <% end %>
</td> </td>
</tr> </tr>
ENDIF:parent <% end %>
</table> </table>
</td> </td>
</tr> </tr>
@ -256,58 +256,58 @@ ENDIF:parent
################################################################### ###################################################################
METHOD_LIST = %{ METHOD_LIST = %{
IF:includes <% if values["includes"] then %>
<div class="tablesubsubtitle">Included modules</div><br /> <div class="tablesubsubtitle">Included modules</div><br />
<div class="name-list"> <div class="name-list">
START:includes <% values["includes"].each do |includes| %>
<span class="method-name">HREF:aref:name:</span> <span class="method-name"><%= href includes["aref"], includes["name"] %></span>
END:includes <% end # values["includes"] %>
</div> </div>
ENDIF:includes <% end %>
IF:method_list <% if values["method_list"] then %>
START:method_list <% values["method_list"].each do |method_list| $stderr.puts({ :method_list => method_list }.inspect) %>
IF:methods <% if values["methods"] then %>
<table cellpadding=5 width="100%"> <table cellpadding=5 width="100%">
<tr><td class="tablesubtitle">%type% %category% methods</td></tr> <tr><td class="tablesubtitle"><%= values["type"] %> <%= values["category"] %> methods</td></tr>
</table> </table>
START:methods <% values["methods"].each do |methods| $stderr.puts({ :methods => methods }.inspect) %>
<table width="100%" cellspacing="0" cellpadding="5" border="0"> <table width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle"> <tr><td class="methodtitle">
<a name="%aref%"> <a name="<%= values["aref"] %>">
IF:callseq <% if values["callseq"] then %>
<b>%callseq%</b> <b><%= values["callseq"] %></b>
ENDIF:callseq <% end %>
IFNOT:callseq <% unless values["callseq"] then %>
<b>%name%</b>%params% <b><%= values["name"] %></b><%= values["params"] %>
ENDIF:callseq <% end %>
IF:codeurl <% if values["codeurl"] then %>
<a href="%codeurl%" target="source" class="srclink">src</a> <a href="<%= values["codeurl"] %>" target="source" class="srclink">src</a>
ENDIF:codeurl <% end %>
</a></td></tr> </a></td></tr>
</table> </table>
IF:m_desc <% if values["m_desc"] then %>
<div class="description"> <div class="description">
%m_desc% <%= values["m_desc"] %>
</div> </div>
ENDIF:m_desc <% end %>
IF:aka <% if values["aka"] then %>
<div class="aka"> <div class="aka">
This method is also aliased as This method is also aliased as
START:aka <% values["aka"].each do |aka| $stderr.puts({ :aka => aka }.inspect) %>
<a href="%aref%">%name%</a> <a href="<%= values["aref"] %>"><%= values["name"] %></a>
END:aka <% end # values["aka"] %>
</div> </div>
ENDIF:aka <% end %>
IF:sourcecode <% if values["sourcecode"] then %>
<pre class="source"> <pre class="source">
%sourcecode% <%= values["sourcecode"] %>
</pre> </pre>
ENDIF:sourcecode <% end %>
END:methods <% end # values["methods"] %>
ENDIF:methods <% end %>
END:method_list <% end # values["method_list"] %>
ENDIF:method_list <% end %>
} }
=begin =begin
@ -317,8 +317,8 @@ ENDIF:method_list
SRC_PAGE = %{ SRC_PAGE = %{
<html> <html>
<head><title>%title%</title> <head><title><%= values["title"] %></title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>">
<style type="text/css"> <style type="text/css">
.ruby-comment { color: green; font-style: italic } .ruby-comment { color: green; font-style: italic }
.ruby-constant { color: #4433aa; font-weight: bold; } .ruby-constant { color: #4433aa; font-weight: bold; }
@ -336,7 +336,7 @@ SRC_PAGE = %{
</style> </style>
</head> </head>
<body bgcolor="white"> <body bgcolor="white">
<pre>%code%</pre> <pre><%= values["code"] %></pre>
</body> </body>
</html> </html>
} }
@ -344,13 +344,13 @@ SRC_PAGE = %{
########################## Index ################################ ########################## Index ################################
FR_INDEX_BODY = %{ FR_INDEX_BODY = %{
!INCLUDE! <%= template_include %>
} }
FILE_INDEX = %{ FILE_INDEX = %{
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>">
<style> <style>
<!-- <!--
body { body {
@ -378,10 +378,10 @@ div.banner {
<base target="docwin"> <base target="docwin">
</head> </head>
<body> <body>
<div class="banner">%list_title%</div> <div class="banner"><%= values["list_title"] %></div>
START:entries <% values["entries"].each do |entries| %>
<a href="%href%">%name%</a><br /> <a href="<%= entries["href"] %>"><%= entries["name"] %></a><br />
END:entries <% end # values["entries"] %>
</body></html> </body></html>
} }
@ -391,8 +391,8 @@ METHOD_INDEX = FILE_INDEX
INDEX = %{ INDEX = %{
<html> <html>
<head> <head>
<title>%title%</title> <title><%= values["title"] %></title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%"> <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>">
</head> </head>
<frameset cols="20%,*"> <frameset cols="20%,*">
@ -401,15 +401,15 @@ INDEX = %{
<frame src="fr_class_index.html" name="Classes"> <frame src="fr_class_index.html" name="Classes">
<frame src="fr_method_index.html" name="Methods"> <frame src="fr_method_index.html" name="Methods">
</frameset> </frameset>
IF:inline_source <% if values["inline_source"] then %>
<frame src="%initial_page%" name="docwin"> <frame src="<%= values["initial_page"] %>" name="docwin">
ENDIF:inline_source <% end %>
IFNOT:inline_source <% unless values["inline_source"] then %>
<frameset rows="80%,20%"> <frameset rows="80%,20%">
<frame src="%initial_page%" name="docwin"> <frame src="<%= values["initial_page"] %>" name="docwin">
<frame src="blank.html" name="source"> <frame src="blank.html" name="source">
</frameset> </frameset>
ENDIF:inline_source <% end %>
<noframes> <noframes>
<body bgcolor="white"> <body bgcolor="white">
Click <a href="html/index.html">here</a> for a non-frames Click <a href="html/index.html">here</a> for a non-frames

View File

@ -1,728 +0,0 @@
module RDoc
# This is how you define the HTML that RDoc generates. Simply create
# a file in rdoc/generators/html_templates that creates the
# module RDoc::Page and populate it as described below. Then invoke
# rdoc using the --template <name of your file> option, and
# your template will be used.
#
# The constants defining pages use a simple templating system:
#
# * The templating system is passed a hash. Keys in the hash correspond
# to tags on this page. The tag %abc% is looked up in the hash,
# and is replaced by the corresponding hash value.
#
# * Some tags are optional. You can detect this using IF/ENDIF
#
# IF: title
# The value of title is %title%
# ENDIF: title
#
# * Some entries in the hash have values that are arrays, where each
# entry in the array is itself a hash. These are used to generate
# lists using the START: construct. For example, given a hash
# containing
#
# { 'people' => [ { 'name' => 'Fred', 'age' => '12' },
# { 'name' => 'Mary', 'age' => '21' } ]
#
# You could generate a simple table using
#
# <table>
# START:people
# <tr><td>%name%<td>%age%</tr>
# END:people
# </table>
#
# These lists can be nested to an arbitrary depth
#
# * the construct HREF:url:name: generates <a href="%url%">%name%</a>
# if +url+ is defined in the hash, or %name% otherwise.
#
#
# Your file must contain the following constants
#
# [*FONTS*] a list of fonts to be used
# [*STYLE*] a CSS section (without the <style> or comments). This is
# used to generate a style.css file
#
# [*BODY*]
# The main body of all non-index RDoc pages. BODY will contain
# two !INCLUDE!s. The first is used to include a document-type
# specific header (FILE_PAGE or CLASS_PAGE). The second include
# is for the method list (METHOD_LIST). THe body is passed:
#
# %title%::
# the page's title
#
# %style_url%::
# the url of a style sheet for this page
#
# %diagram%::
# the optional URL of a diagram for this page
#
# %description%::
# a (potentially multi-paragraph) string containing the
# description for th file/class/module.
#
# %requires%::
# an optional list of %aref%/%name% pairs, one for each module
# required by this file.
#
# %methods%::
# an optional list of %aref%/%name%, one for each method
# documented on this page. This is intended to be an index.
#
# %attributes%::
# An optional list. For each attribute it contains:
# %name%:: the attribute name
# %rw%:: r/o, w/o, or r/w
# %a_desc%:: description of the attribute
#
# %classlist%::
# An optional string containing an already-formatted list of
# classes and modules documented in this file
#
# For FILE_PAGE entries, the body will be passed
#
# %short_name%::
# The name of the file
#
# %full_path%::
# The full path to the file
#
# %dtm_modified%::
# The date/time the file was last changed
#
# For class and module pages, the body will be passed
#
# %classmod%::
# The name of the class or module
#
# %files%::
# A list. For each file this class is defined in, it contains:
# %full_path_url%:: an (optional) URL of the RDoc page
# for this file
# %full_path%:: the name of the file
#
# %par_url%::
# The (optional) URL of the RDoc page documenting this class's
# parent class
#
# %parent%::
# The name of this class's parent.
#
# For both files and classes, the body is passed the following information
# on includes and methods:
#
# %includes%::
# Optional list of included modules. For each, it receives
# %aref%:: optional URL to RDoc page for the module
# %name%:: the name of the module
#
# %method_list%::
# Optional list of methods of a particular class and category.
#
# Each method list entry contains:
#
# %type%:: public/private/protected
# %category%:: instance/class
# %methods%:: a list of method descriptions
#
# Each method description contains:
#
# %aref%:: a target aref, used when referencing this method
# description. You should code this as <a name="%aref%">
# %codeurl%:: the optional URL to the page containing this method's
# source code.
# %name%:: the method's name
# %params%:: the method's parameters
# %callseq%:: a full calling sequence
# %m_desc%:: the (potentially multi-paragraph) description of
# this method.
#
# [*CLASS_PAGE*]
# Header for pages documenting classes and modules. See
# BODY above for the available parameters.
#
# [*FILE_PAGE*]
# Header for pages documenting files. See
# BODY above for the available parameters.
#
# [*METHOD_LIST*]
# Controls the display of the listing of methods. See BODY for
# parameters.
#
# [*INDEX*]
# The top-level index page. For a browser-like environment
# define a frame set that includes the file, class, and
# method indices. Passed
# %title%:: title of page
# %initial_page% :: url of initial page to display
#
# [*CLASS_INDEX*]
# Individual files for the three indexes. Passed:
# %index_url%:: URL of main index page
# %entries%:: List of
# %name%:: name of an index entry
# %href%:: url of corresponding page
# [*METHOD_INDEX*]
# Same as CLASS_INDEX for methods
#
# [*FILE_INDEX*]
# Same as CLASS_INDEX for methods
#
# [*FR_INDEX_BODY*]
# A wrapper around CLASS_INDEX, METHOD_INDEX, and FILE_INDEX.
# If those index strings contain the complete HTML for the
# output, then FR_INDEX_BODY can simply be !INCLUDE!
#
# [*SRC_PAGE*]
# Page used to display source code. Passed %title% and %code%,
# the latter being a multi-line string of code.
module Page
FONTS = "Verdana, Arial, Helvetica, sans-serif"
STYLE = %{
body,td,p { font-family: %fonts%;
color: #000040;
}
.attr-rw { font-size: x-small; color: #444488 }
.title-row { background: #0000aa;
color: #eeeeff;
}
.big-title-font { color: white;
font-family: %fonts%;
font-size: large;
height: 50px}
.small-title-font { color: aqua;
font-family: %fonts%;
font-size: xx-small; }
.aqua { color: aqua }
.method-name, attr-name {
font-family: monospace; font-weight: bold;
}
.tablesubtitle, .tablesubsubtitle {
width: 100%;
margin-top: 1ex;
margin-bottom: .5ex;
padding: 5px 0px 5px 20px;
font-size: large;
color: aqua;
background: #3333cc;
}
.name-list {
font-family: monospace;
margin-left: 40px;
margin-bottom: 2ex;
line-height: 140%;
}
.description {
margin-left: 40px;
margin-top: -2ex;
margin-bottom: 2ex;
}
.description p {
line-height: 140%;
}
.aka {
margin-left: 40px;
margin-bottom: 2ex;
line-height: 100%;
font-size: small;
color: #808080;
}
.methodtitle {
font-size: medium;
text-decoration: none;
color: #0000AA;
background: white;
}
.paramsig {
font-size: small;
}
.srcbut { float: right }
pre { font-size: 1.2em; }
tt { font-size: 1.2em; }
pre.source {
border-style: groove;
background-color: #ddddff;
margin-left: 40px;
padding: 1em 0em 1em 2em;
}
.classlist {
margin-left: 40px;
margin-bottom: 2ex;
line-height: 140%;
}
li {
display: list-item;
margin-top: .6em;
}
.ruby-comment { color: green; font-style: italic }
.ruby-constant { color: #4433aa; font-weight: bold; }
.ruby-identifier { color: #222222; }
.ruby-ivar { color: #2233dd; }
.ruby-keyword { color: #3333FF; font-weight: bold }
.ruby-node { color: #777777; }
.ruby-operator { color: #111111; }
.ruby-regexp { color: #662222; }
.ruby-value { color: #662222; font-style: italic }
}
############################################################################
HEADER = %{
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%" />
<link rel=StyleSheet href="%style_url%" type="text/css" media="screen" />
<script type="text/javascript" language="JavaScript">
<!--
function popCode(url) {
window.open(url, "Code",
"resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
//-->
</script>
</head>
}
###################################################################
METHOD_LIST = %{
IF:includes
<table summary="Included modules" cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Included modules</td></tr>
</table>
<div class="name-list">
START:includes
<span class="method-name">HREF:aref:name:</span>
END:includes
</div>
ENDIF:includes
IF:method_list
START:method_list
IF:methods
<table summary="Method list" cellpadding="5" width="100%">
<tr><td class="tablesubtitle">%type% %category% methods</td></tr>
</table>
START:methods
<table summary="method" width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td class="methodtitle">
<a name="%aref%"></a>
IF:codeurl
<a href="%codeurl%" target="Code" class="methodtitle"
onClick="popCode('%codeurl%');return false;">
ENDIF:codeurl
IF:callseq
<b>%callseq%</b>
ENDIF:callseq
IFNOT:callseq
<b>%name%</b>%params%
ENDIF:callseq
IF:codeurl
</a>
ENDIF:codeurl
</td></tr>
</table>
IF:m_desc
<div class="description">
%m_desc%
</div>
ENDIF:m_desc
IF:aka
<div class="aka">
This method is also aliased as
START:aka
<a href="%aref%">%name%</a>
END:aka
</div>
ENDIF:aka
IF:sourcecode
<pre class="source">
%sourcecode%
</pre>
ENDIF:sourcecode
END:methods
ENDIF:methods
END:method_list
ENDIF:method_list
}
###################################################################
CONTEXT_CONTENT = %{
IF:diagram
<table summary="Diagram of classes and modules" width="100%">
<tr><td align="center">
%diagram%
</td></tr></table>
ENDIF:diagram
IF:description
<div class="description">%description%</div>
ENDIF:description
IF:requires
<table summary="Requires" cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Required files</td></tr>
</table>
<div class="name-list">
START:requires
HREF:aref:name:&nbsp; &nbsp;
END:requires
</div>
ENDIF:requires
IF:methods
<table summary="Methods" cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Methods</td></tr>
</table>
<div class="name-list">
START:methods
HREF:aref:name:&nbsp; &nbsp;
END:methods
</div>
ENDIF:methods
IF:constants
<table summary="Constants" cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Constants</td></tr>
</table>
<table cellpadding="5">
START:constants
<tr valign="top"><td>%name%</td><td>=</td><td>%value%</td></tr>
IF:desc
<tr><td></td><td></td><td>%desc%</td></tr>
ENDIF:desc
END:constants
</table>
ENDIF:constants
IF:aliases
<table summary="Aliases" cellpadding="5" width="100%">
<tr><td class="tablesubtitle">External Aliases</td></tr>
</table>
<div class="name-list">
START:aliases
%old_name% -> %new_name%<br />
END:aliases
</div>
ENDIF:aliases
IF:attributes
<table summary="Attributes" cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Attributes</td></tr>
</table>
<table summary="Attribute details" cellspacing="5">
START:attributes
<tr valign="top">
<td class="attr-name">%name%</td>
IF:rw
<td align="center" class="attr-rw">&nbsp;[%rw%]&nbsp;</td>
ENDIF:rw
IFNOT:rw
<td></td>
ENDIF:rw
<td>%a_desc%</td>
</tr>
END:attributes
</table>
ENDIF:attributes
IF:classlist
<table summary="List of classes" cellpadding="5" width="100%">
<tr><td class="tablesubtitle">Classes and Modules</td></tr>
</table>
<div class="classlist">
%classlist%
</div>
ENDIF:classlist
}
###############################################################################
BODY = HEADER + %{
<body bgcolor="white">
!INCLUDE! <!-- banner header -->
} +
CONTEXT_CONTENT + METHOD_LIST +
%{
</body>
</html>
}
###############################################################################
FILE_PAGE = <<_FILE_PAGE_
<table summary="Information on file" width="100%">
<tr class="title-row">
<td><table summary="layout" width="100%"><tr>
<td class="big-title-font" colspan="2">%short_name%</td>
<td align="right"><table summary="layout" cellspacing="0" cellpadding="2">
<tr>
<td class="small-title-font">Path:</td>
<td class="small-title-font">%full_path%
IF:cvsurl
&nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
ENDIF:cvsurl
</td>
</tr>
<tr>
<td class="small-title-font">Modified:</td>
<td class="small-title-font">%dtm_modified%</td>
</tr>
</table>
</td></tr></table></td>
</tr>
</table>
_FILE_PAGE_
###################################################################
CLASS_PAGE = %{
<table summary="Information on class" width="100%" border="0" cellspacing="0">
<tr class="title-row">
<td class="big-title-font">
<sup><font color="aqua">%classmod%</font></sup> %full_name%
</td>
<td align="right">
<table summary="layout" cellspacing="0" cellpadding="2">
<tr valign="top">
<td class="small-title-font">In:</td>
<td class="small-title-font">
START:infiles
IF:full_path_url
<a href="%full_path_url%" class="aqua">
ENDIF:full_path_url
%full_path%
IF:full_path_url
</a>
ENDIF:full_path_url
IF:cvsurl
&nbsp;(<a href="%cvsurl%"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
ENDIF:cvsurl
<br />
END:infiles
</td>
</tr>
IF:parent
<tr>
<td class="small-title-font">Parent:</td>
<td class="small-title-font">
IF:par_url
<a href="%par_url%" class="aqua">
ENDIF:par_url
%parent%
IF:par_url
</a>
ENDIF:par_url
</td>
</tr>
ENDIF:parent
</table>
</td>
</tr>
</table>
}
=begin
=end
########################## Source code ##########################
SRC_PAGE = %{
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%">
<title>%title%</title>
<link rel="stylesheet" href="%style_url%" type="text/css" media="screen" />
</head>
<body bgcolor="white">
<pre>%code%</pre>
</body>
</html>
}
########################## Index ################################
FR_INDEX_BODY = %{
!INCLUDE!
}
FILE_INDEX = %{
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%">
<title>%list_title%</title>
<style type="text/css">
<!--
body {
background-color: #ddddff;
font-family: #{FONTS};
font-size: 11px;
font-style: normal;
line-height: 14px;
color: #000040;
}
div.banner {
background: #0000aa;
color: white;
padding: 1;
margin: 0;
font-size: 90%;
font-weight: bold;
line-height: 1.1;
text-align: center;
width: 100%;
}
A.xx { color: white; font-weight: bold; }
-->
</style>
<base target="docwin">
</head>
<body>
<div class="banner"><a href="%index_url%" class="xx">%list_title%</a></div>
START:entries
<a href="%href%">%name%</a><br />
END:entries
</body></html>
}
CLASS_INDEX = FILE_INDEX
METHOD_INDEX = FILE_INDEX
INDEX = %{
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%">
<title>%title%</title></head>
<frameset rows="20%, 80%">
<frameset cols="25%,35%,45%">
<frame src="fr_file_index.html" title="Files" name="Files">
<frame src="fr_class_index.html" name="Classes">
<frame src="fr_method_index.html" name="Methods">
</frameset>
<frame src="%initial_page%" name="docwin">
<noframes>
<body bgcolor="white">
Sorry, RDoc currently only generates HTML using frames.
</body>
</noframes>
</frameset>
</html>
}
######################################################################
#
# The following is used for the -1 option
#
CONTENTS_XML = %{
IF:description
%description%
ENDIF:description
IF:requires
<h4>Requires:</h4>
<ul>
START:requires
IF:aref
<li><a href="%aref%">%name%</a></li>
ENDIF:aref
IFNOT:aref
<li>%name%</li>
ENDIF:aref
END:requires
</ul>
ENDIF:requires
IF:attributes
<h4>Attributes</h4>
<table>
START:attributes
<tr><td>%name%</td><td>%rw%</td><td>%a_desc%</td></tr>
END:attributes
</table>
ENDIF:attributes
IF:includes
<h4>Includes</h4>
<ul>
START:includes
IF:aref
<li><a href="%aref%">%name%</a></li>
ENDIF:aref
IFNOT:aref
<li>%name%</li>
ENDIF:aref
END:includes
</ul>
ENDIF:includes
IF:method_list
<h3>Methods</h3>
START:method_list
IF:methods
START:methods
<h4>%type% %category% method: <a name="%aref%">%name%%params%</a></h4>
IF:m_desc
%m_desc%
ENDIF:m_desc
IF:sourcecode
<blockquote><pre>
%sourcecode%
</pre></blockquote>
ENDIF:sourcecode
END:methods
ENDIF:methods
END:method_list
ENDIF:method_list
}
end
end
require 'rdoc/generators/template/html/one_page_html'

View File

@ -1,78 +1,77 @@
module RDoc module RDoc::Page
module Page
######################################################################
#
# The following is used for the -1 option
#
CONTENTS_XML = %{ CONTENTS_XML = %{
IF:description <% if defined? classes and classes["description"] then %>
%description% <%= classes["description"] %>
ENDIF:description <% end %>
IF:requires <% if defined? files and files["requires"] then %>
<h4>Requires:</h4> <h4>Requires:</h4>
<ul> <ul>
START:requires <% files["requires"].each do |requires| %>
IF:aref <% if requires["aref"] then %>
<li><a href="%aref%">%name%</a></li> <li><a href="<%= requires["aref"] %>"><%= requires["name"] %></a></li>
ENDIF:aref <% end %>
IFNOT:aref <% unless requires["aref"] then %>
<li>%name%</li> <li><%= requires["name"] %></li>
ENDIF:aref <% end %>
END:requires <% end # files["requires"] %>
</ul> </ul>
ENDIF:requires <% end %>
IF:attributes <% if defined? classes and classes["includes"] then %>
<h4>Attributes</h4>
<table>
START:attributes
<tr><td>%name%</td><td>%rw%</td><td>%a_desc%</td></tr>
END:attributes
</table>
ENDIF:attributes
IF:includes
<h4>Includes</h4> <h4>Includes</h4>
<ul> <ul>
START:includes <% classes["includes"].each do |includes| %>
IF:aref <% if includes["aref"] then %>
<li><a href="%aref%">%name%</a></li> <li><a href="<%= includes["aref"] %>"><%= includes["name"] %></a></li>
ENDIF:aref <% end %>
IFNOT:aref <% unless includes["aref"] then %>
<li>%name%</li> <li><%= includes["name"] %></li>
ENDIF:aref <% end %>
END:includes <% end # classes["includes"] %>
</ul> </ul>
ENDIF:includes <% end %>
IF:method_list <% if defined? classes and classes["sections"] then %>
<% classes["sections"].each do |sections| %>
<% if sections["attributes"] then %>
<h4>Attributes</h4>
<table>
<% sections["attributes"].each do |attributes| %>
<tr><td><%= attributes["name"] %></td><td><%= attributes["rw"] %></td><td><%= attributes["a_desc"] %></td></tr>
<% end # sections["attributes"] %>
</table>
<% end %>
<% if sections["method_list"] then %>
<h3>Methods</h3> <h3>Methods</h3>
START:method_list <% sections["method_list"].each do |method_list| %>
IF:methods <% if method_list["methods"] then %>
START:methods <% method_list["methods"].each do |methods| %>
<h4>%type% %category% method: <h4><%= methods["type"] %> <%= methods["category"] %> method:
IF:callseq <% if methods["callseq"] then %>
<a name="%aref%">%callseq%</a> <a name="<%= methods["aref"] %>"><%= methods["callseq"] %></a>
ENDIF:callseq <% end %>
IFNOT:callseq <% unless methods["callseq"] then %>
<a name="%aref%">%name%%params%</a></h4> <a name="<%= methods["aref"] %>"><%= methods["name"] %><%= methods["params"] %></a></h4>
ENDIF:callseq <% end %>
IF:m_desc <% if methods["m_desc"] then %>
%m_desc% <%= methods["m_desc"] %>
ENDIF:m_desc <% end %>
IF:sourcecode <% if methods["sourcecode"] then %>
<blockquote><pre> <blockquote><pre>
%sourcecode% <%= methods["sourcecode"] %>
</pre></blockquote> </pre></blockquote>
ENDIF:sourcecode <% end %>
END:methods <% end # method_list["methods"] %>
ENDIF:methods <% end %>
END:method_list <% end # sections["method_list"] %>
ENDIF:method_list <% end %>
<% end # classes["sections"] %>
<% end %>
} }
######################################################################## ########################################################################
@ -81,42 +80,42 @@ ONE_PAGE = %{
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> <html>
<head> <head>
<title>%title%</title> <title><%= values["title"] %></title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%" /> <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>" />
</head> </head>
<body> <body>
START:files <% values["files"].each do |files| %>
<h2>File: %short_name%</h2> <h2>File: <%= files["short_name"] %></h2>
<table> <table>
<tr><td>Path:</td><td>%full_path%</td></tr> <tr><td>Path:</td><td><%= files["full_path"] %></td></tr>
<tr><td>Modified:</td><td>%dtm_modified%</td></tr> <tr><td>Modified:</td><td><%= files["dtm_modified"] %></td></tr>
</table> </table>
} + CONTENTS_XML + %{ } + CONTENTS_XML + %{
END:files <% end # values["files"] %>
IF:classes <% if values["classes"] then %>
<h2>Classes</h2> <h2>Classes</h2>
START:classes <% values["classes"].each do |classes| %>
IF:parent <% if classes["parent"] then %>
<h3>%classmod% %full_name% &lt; HREF:par_url:parent:</h3> <h3><%= classes["classmod"] %> <%= classes["full_name"] %> &lt; <%= href classes["par_url"], classes["parent"] %></h3>
ENDIF:parent <% end %>
IFNOT:parent <% unless classes["parent"] then %>
<h3>%classmod% %full_name%</h3> <h3><%= classes["classmod"] %> <%= classes["full_name"] %></h3>
ENDIF:parent <% end %>
IF:infiles <% if classes["infiles"] then %>
(in files (in files
START:infiles <% classes["infiles"].each do |infiles| %>
HREF:full_path_url:full_path: <%= href infiles["full_path_url"], infiles["full_path"] %>
END:infiles <% end # classes["infiles"] %>
) )
ENDIF:infiles <% end %>
} + CONTENTS_XML + %{ } + CONTENTS_XML + %{
END:classes <% end # values["classes"] %>
ENDIF:classes <% end %>
</body> </body>
</html> </html>
} }
end end
end

View File

@ -1,67 +1,68 @@
module RDoc module RDoc::Page
module Page
CONTENTS_RDF = %{ CONTENTS_RDF = %{
IF:description <% if defined? classes and classes["description"] then %>
<description rd:parseType="Literal"> <description rd:parseType="Literal">
%description% <%= classes["description"] %>
</description> </description>
ENDIF:description <% end %>
IF:requires <% if defined? files and files["requires"] then %>
START:requires <% files["requires"].each do |requires| %>
<rd:required-file rd:name="%name%" /> <rd:required-file rd:name="<%= requires["name"] %>" />
END:requires <% end # files["requires"] %>
ENDIF:requires <% end %>
IF:attributes <% if defined? classes and classes["includes"] then %>
START:attributes <IncludedModuleList>
<% classes["includes"].each do |includes| %>
<included-module rd:name="<%= includes["name"] %>" />
<% end # includes["includes"] %>
</IncludedModuleList>
<% end %>
<% if defined? classes and classes["sections"] then %>
<% classes["sections"].each do |sections| %>
<% if sections["attributes"] then %>
<% sections["attributes"].each do |attributes| %>
<contents> <contents>
<Attribute rd:name="%name%"> <Attribute rd:name="<%= attributes["name"] %>">
IF:rw <% if attributes["rw"] then %>
<attribute-rw>%rw%</attribute-rw> <attribute-rw><%= attributes["rw"] %></attribute-rw>
ENDIF:rw <% end %>
<description rdf:parseType="Literal">%a_desc%</description> <description rdf:parseType="Literal"><%= attributes["a_desc"] %></description>
</Attribute> </Attribute>
</contents> </contents>
END:attributes <% end # sections["attributes"] %>
ENDIF:attributes <% end %>
IF:includes <% if sections["method_list"] then %>
<IncludedModuleList> <% sections["method_list"].each do |method_list| %>
START:includes <% if method_list["methods"] then %>
<included-module rd:name="%name%" /> <% method_list["methods"].each do |methods| %>
END:includes
</IncludedModuleList>
ENDIF:includes
IF:method_list
START:method_list
IF:methods
START:methods
<contents> <contents>
<Method rd:name="%name%" rd:visibility="%type%" <Method rd:name="<%= methods["name"] %>" rd:visibility="<%= methods["type"] %>"
rd:category="%category%" rd:id="%aref%"> rd:category="<%= methods["category"] %>" rd:id="<%= methods["aref"] %>">
<parameters>%params%</parameters> <parameters><%= methods["params"] %></parameters>
IF:m_desc <% if methods["m_desc"] then %>
<description rdf:parseType="Literal"> <description rdf:parseType="Literal">
%m_desc% <%= methods["m_desc"] %>
</description> </description>
ENDIF:m_desc <% end %>
IF:sourcecode <% if methods["sourcecode"] then %>
<source-code-listing rdf:parseType="Literal"> <source-code-listing rdf:parseType="Literal">
%sourcecode% <%= methods["sourcecode"] %>
</source-code-listing> </source-code-listing>
ENDIF:sourcecode <% end %>
</Method> </Method>
</contents> </contents>
END:methods <% end # method_list["methods"] %>
ENDIF:methods <% end %>
END:method_list <% end # sections["method_list"] %>
ENDIF:method_list <% end %>
<!-- end method list --> <!-- end method list -->
<% end # classes["sections"] %>
<% end %>
} }
######################################################################## ########################################################################
@ -72,41 +73,39 @@ ONE_PAGE = %{<?xml version="1.0" encoding="utf-8"?>
xmlns:rd="http://pragprog.com/rdoc/rdoc.rdf#"> xmlns:rd="http://pragprog.com/rdoc/rdoc.rdf#">
<!-- RDoc --> <!-- RDoc -->
START:files <% values["files"].each do |files| %>
<rd:File rd:name="%short_name%" rd:id="%href%"> <rd:File rd:name="<%= files["short_name"] %>" rd:id="<%= files["href"] %>">
<path>%full_path%</path> <path><%= files["full_path"] %></path>
<dtm-modified>%dtm_modified%</dtm-modified> <dtm-modified><%= files["dtm_modified"] %></dtm-modified>
} + CONTENTS_RDF + %{ } + CONTENTS_RDF + %{
</rd:File> </rd:File>
END:files <% end # values["files"] %>
START:classes <% values["classes"].each do |classes| %>
<%classmod% rd:name="%full_name%" rd:id="%full_name%"> <<%= values["classmod"] %> rd:name="<%= classes["full_name"] %>" rd:id="<%= classes["full_name"] %>">
<classmod-info> <classmod-info>
IF:infiles <% if classes["infiles"] then %>
<InFiles> <InFiles>
START:infiles <% classes["infiles"].each do |infiles| %>
<infile> <infile>
<File rd:name="%full_path%" <File rd:name="<%= infiles["full_path"] %>"
IF:full_path_url <% if infiles["full_path_url"] then %>
rdf:about="%full_path_url%" rdf:about="<%= infiles["full_path_url"] %>"
ENDIF:full_path_url <% end %>
/> />
</infile> </infile>
END:infiles <% end # classes["infiles"] %>
</InFiles> </InFiles>
ENDIF:infiles <% end %>
IF:parent <% if classes["parent"] then %>
<superclass>HREF:par_url:parent:</superclass> <superclass><%= href classes["par_url"], classes["parent"] %></superclass>
ENDIF:parent <% end %>
</classmod-info> </classmod-info>
} + CONTENTS_RDF + %{ } + CONTENTS_RDF + %{
</%classmod%> </<%= classes["classmod"] %>>
END:classes <% end # values["classes"] %>
<!-- /RDoc --> <!-- /RDoc -->
</rdf:RDF> </rdf:RDF>
} }
end
end end

View File

@ -1,72 +1,73 @@
module RDoc module RDoc::Page
module Page
CONTENTS_XML = %{ CONTENTS_XML = %{
IF:description <% if defined? classes and classes["description"] then %>
<description> <description>
%description% <%= classes["description"] %>
</description> </description>
ENDIF:description <% end %>
<contents> <contents>
IF:requires <% if defined? files and files["requires"] then %>
<required-file-list> <required-file-list>
START:requires <% files["requires"].each do |requires| %>
<required-file name="%name%" <required-file name="<%= requires["name"] %>"
IF:aref <% if requires["aref"] then %>
href="%aref%" href="<%= requires["aref"] %>"
ENDIF:aref <% end %>
/> />
END:requires <% end # files["requires"] %>
</required-file-list> </required-file-list>
ENDIF:requires <% end %>
IF:attributes <% if defined? classes and classes["sections"] then %>
<% classes["sections"].each do |sections| %>
<% if sections["attributes"] then %>
<attribute-list> <attribute-list>
START:attributes <% sections["attributes"].each do |attributes| %>
<attribute name="%name%"> <attribute name="<%= attributes["name"] %>">
IF:rw <% if attributes["rw"] then %>
<attribute-rw>%rw%</attribute-rw> <attribute-rw><%= attributes["rw"] %></attribute-rw>
ENDIF:rw <% end %>
<description>%a_desc%</description> <description><%= attributes["a_desc"] %></description>
</attribute> </attribute>
END:attributes <% end # sections["attributes"] %>
</attribute-list> </attribute-list>
ENDIF:attributes <% end %>
IF:includes <% if sections["method_list"] then %>
<included-module-list>
START:includes
<included-module name="%name%"
IF:aref
href="%aref%"
ENDIF:aref
/>
END:includes
</included-module-list>
ENDIF:includes
IF:method_list
<method-list> <method-list>
START:method_list <% sections["method_list"].each do |method_list| %>
IF:methods <% if method_list["methods"] then %>
START:methods <% method_list["methods"].each do |methods| %>
<method name="%name%" type="%type%" category="%category%" id="%aref%"> <method name="<%= methods["name"] %>" type="<%= methods["type"] %>" category="<%= methods["category"] %>" id="<%= methods["aref"] %>">
<parameters>%params%</parameters> <parameters><%= methods["params"] %></parameters>
IF:m_desc <% if methods["m_desc"] then %>
<description> <description>
%m_desc% <%= methods["m_desc"] %>
</description> </description>
ENDIF:m_desc <% end %>
IF:sourcecode <% if methods["sourcecode"] then %>
<source-code-listing> <source-code-listing>
%sourcecode% <%= methods["sourcecode"] %>
</source-code-listing> </source-code-listing>
ENDIF:sourcecode <% end %>
</method> </method>
END:methods <% end # method_list["methods"] %>
ENDIF:methods <% end %>
END:method_list <% end # sections["method_list"] %>
</method-list> </method-list>
ENDIF:method_list <% end %>
<% end # classes["sections"] %>
<% end %>
<% if defined? classes and classes["includes"] then %>
<included-module-list>
<% classes["includes"].each do |includes| %>
<included-module name="<%= includes["name"] %>"
<% if includes["aref"] then %>
href="<%= includes["aref"] %>"
<% end %>
/>
<% end # classes["includes"] %>
</included-module-list>
<% end %>
</contents> </contents>
} }
@ -75,38 +76,36 @@ ENDIF:method_list
ONE_PAGE = %{<?xml version="1.0" encoding="utf-8"?> ONE_PAGE = %{<?xml version="1.0" encoding="utf-8"?>
<rdoc> <rdoc>
<file-list> <file-list>
START:files <% values["files"].each do |files| %>
<file name="%short_name%" id="%href%"> <file name="<%= files["short_name"] %>" id="<%= files["href"] %>">
<file-info> <file-info>
<path>%full_path%</path> <path><%= files["full_path"] %></path>
<dtm-modified>%dtm_modified%</dtm-modified> <dtm-modified><%= files["dtm_modified"] %></dtm-modified>
</file-info> </file-info>
} + CONTENTS_XML + %{ } + CONTENTS_XML + %{
</file> </file>
END:files <% end # values["files"] %>
</file-list> </file-list>
<class-module-list> <class-module-list>
START:classes <% values["classes"].each do |classes| %>
<%classmod% name="%full_name%" id="%full_name%"> <<%= classes["classmod"] %> name="<%= classes["full_name"] %>" id="<%= classes["full_name"] %>">
<classmod-info> <classmod-info>
IF:infiles <% if classes["infiles"] then %>
<infiles> <infiles>
START:infiles <% classes["infiles"].each do |infiles| %>
<infile>HREF:full_path_url:full_path:</infile> <infile><%= href infiles["full_path_url"], infiles["full_path"] %></infile>
END:infiles <% end # classes["infiles"] %>
</infiles> </infiles>
ENDIF:infiles <% end %>
IF:parent <% if classes["parent"] then %>
<superclass>HREF:par_url:parent:</superclass> <superclass><%= href classes["par_url"], classes["parent"] %></superclass>
ENDIF:parent <% end %>
</classmod-info> </classmod-info>
} + CONTENTS_XML + %{ } + CONTENTS_XML + %{
</%classmod%> </<%= classes["classmod"] %>>
END:classes <% end # values["classes"] %>
</class-module-list> </class-module-list>
</rdoc> </rdoc>
} }
end
end end

View File

@ -1,233 +1,62 @@
# Cheap-n-cheerful HTML page template system. You create a require 'erb'
# template containing:
##
# An ERB wrapper.
# #
# * variable names between percent signs (<tt>%fred%</tt>) # This TemplatePage operates similarly to RDoc 1.x's TemplatePage, but uses
# * blocks of repeating stuff: # ERB instead of a custom template language.
# #
# START:key # Converting from a RDoc 1.x template to an RDoc 2.x template is fairly easy.
# ... stuff
# END:key
# #
# You feed the code a hash. For simple variables, the values # * %blah% becomes <%= values["blah"] %>
# are resolved directly from the hash. For blocks, the hash entry # * !INCLUDE! becomes <%= template_include %>
# corresponding to +key+ will be an array of hashes. The block will # * HREF:aref:name becomes <%= href values["aref"], values["name"] %>
# be generated once for each entry. Blocks can be nested arbitrarily # * IF:blah becomes <% if values["blah"] then %>
# deeply. # * IFNOT:blah becomes <% unless values["blah"] then %>
# * ENDIF:blah becomes <% end %>
# * START:blah becomes <% values["blah"].each do |blah| %>
# * END:blah becomes <% end %>
# #
# The template may also contain # To make nested loops easier to convert, start by converting START statements
# # to:
# IF:key
# ... stuff
# ENDIF:key
#
# _stuff_ will only be included in the output if the corresponding
# key is set in the value hash.
#
# Usage: Given a set of templates <tt>T1, T2,</tt> etc
#
# values = { "name" => "Dave", state => "TX" }
#
# t = TemplatePage.new(T1, T2, T3)
# File.open(name, "w") {|f| t.write_html_on(f, values)}
# or
# res = ''
# t.write_html_on(res, values)
# #
# <% values["blah"].each do |blah| $stderr.puts blah.keys %>
# #
# So you can see what is being used inside which loop.
class RDoc::TemplatePage class RDoc::TemplatePage
########## ##
# A context holds a stack of key/value pairs (like a symbol # Create a new TemplatePage that will use +templates+.
# table). When asked to resolve a key, it first searches the top of
# the stack, then the next level, and so on until it finds a match
# (or runs out of entries)
class Context
def initialize
@stack = []
end
def push(hash)
@stack.push(hash)
end
def pop
@stack.pop
end
# Find a scalar value, throwing an exception if not found. This
# method is used when substituting the %xxx% constructs
def find_scalar(key)
@stack.reverse_each do |level|
if val = level[key]
return val unless val.kind_of? Array
end
end
raise "Template error: can't find variable '#{key}'"
end
# Lookup any key in the stack of hashes
def lookup(key)
@stack.reverse_each do |level|
val = level[key]
return val if val
end
nil
end
end
#########
# Simple class to read lines out of a string
class LineReader
# we're initialized with an array of lines
def initialize(lines)
@lines = lines
end
# read the next line
def read
@lines.shift
end
# Return a list of lines up to the line that matches
# a pattern. That last line is discarded.
def read_up_to(pattern)
res = []
while line = read
if pattern.match(line)
return LineReader.new(res)
else
res << line
end
end
raise "Missing end tag in template: #{pattern.source}"
end
# Return a copy of ourselves that can be modified without
# affecting us
def dup
LineReader.new(@lines.dup)
end
end
# +templates+ is an array of strings containing the templates.
# We start at the first, and substitute in subsequent ones
# where the string <tt>!INCLUDE!</tt> occurs. For example,
# we could have the overall page template containing
#
# <html><body>
# <h1>Master</h1>
# !INCLUDE!
# </bost></html>
#
# and substitute subpages in to it by passing [master, sub_page].
# This gives us a cheap way of framing pages
def initialize(*templates) def initialize(*templates)
result = "!INCLUDE!" @templates = templates
templates.each do |content|
result.sub!(/!INCLUDE!/, content)
end
@lines = LineReader.new(result.split($/))
end end
# Render the templates into HTML, storing the result on +op+ ##
# using the method <tt><<</tt>. The <tt>value_hash</tt> contains # Returns "<a href=\"#{ref}\">#{name}</a>"
# key/value pairs used to drive the substitution (as described above)
def write_html_on(op, value_hash) def href(ref, name)
@context = Context.new if ref then
op << substitute_into(@lines, value_hash).tr("\000", '\\')
end
# Substitute a set of key/value pairs into the given template.
# Keys with scalar values have them substituted directly into
# the page. Those with array values invoke <tt>substitute_array</tt>
# (below), which examples a block of the template once for each
# row in the array.
#
# This routine also copes with the <tt>IF:</tt>_key_ directive,
# removing chunks of the template if the corresponding key
# does not appear in the hash, and the START: directive, which
# loops its contents for each value in an array
def substitute_into(lines, values)
@context.push(values)
skip_to = nil
result = []
while line = lines.read
case line
when /^IF:(\w+)/
lines.read_up_to(/^ENDIF:#$1/) unless @context.lookup($1)
when /^IFNOT:(\w+)/
lines.read_up_to(/^ENDIF:#$1/) if @context.lookup($1)
when /^ENDIF:/
;
when /^START:(\w+)/
tag = $1
body = lines.read_up_to(/^END:#{tag}/)
inner_values = @context.lookup(tag)
raise "unknown tag: #{tag}" unless inner_values
raise "not array: #{tag}" unless inner_values.kind_of?(Array)
inner_values.each do |vals|
result << substitute_into(body.dup, vals)
end
else
result << expand_line(line.dup)
end
end
@context.pop
result.join("\n")
end
# Given an individual line, we look for %xxx% constructs and
# HREF:ref:name: constructs, substituting for each.
def expand_line(line)
# Generate a cross reference if a reference is given,
# otherwise just fill in the name part
line.gsub!(/HREF:(\w+?):(\w+?):/) {
ref = @context.lookup($1)
name = @context.find_scalar($2)
if ref and !ref.kind_of?(Array)
"<a href=\"#{ref}\">#{name}</a>" "<a href=\"#{ref}\">#{name}</a>"
else else
name name
end end
} end
# Substitute in values for %xxx% constructs. This is made complex ##
# because the replacement string may contain characters that are # Process the template using +values+, writing the result to +io+.
# meaningful to the regexp (like \1)
line = line.gsub(/%([a-zA-Z]\w*)%/) { def write_html_on(io, values)
val = @context.find_scalar($1) template_include = ""
val.tr('\\', "\000")
}
b = binding
line @templates.reverse_each do |template|
rescue Exception => e template_include = ERB.new(template).result b
$stderr.puts "Error in template: #{e}" end
$stderr.puts "Original line: #{line}"
exit io.write template_include
end end
end end