migrates the Jamis template to RDoc 2.x, the root Rakefile requires RDoc 2.2

To understand the changes in horo.rb check rdoc/template.rb in a RDoc 2.x
This commit is contained in:
Xavier Noria 2010-06-16 03:45:18 +02:00
parent 5cd3c2a855
commit 07c6b7a6ad
3 changed files with 145 additions and 129 deletions

View File

@ -45,7 +45,7 @@ elsif RUBY_ENGINE == "jruby"
end end
group :documentation do group :documentation do
gem 'rdoc', '2.1' gem 'rdoc', '2.2'
end end
if ENV['CI'] if ENV['CI']

View File

@ -1,3 +1,6 @@
gem 'rdoc', '= 2.2'
require 'rdoc'
require 'rake' require 'rake'
require 'rake/rdoctask' require 'rake/rdoctask'
require 'rake/gempackagetask' require 'rake/gempackagetask'
@ -68,7 +71,15 @@ Rake::RDocTask.new do |rdoc|
rdoc.options << '--charset' << 'utf-8' rdoc.options << '--charset' << 'utf-8'
rdoc.options << '--main' << 'railties/README' rdoc.options << '--main' << 'railties/README'
rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : './doc/template/horo' # Workaround: RDoc assumes that rdoc.template can be required, and that
# rdoc.template.upcase is a constant living in RDoc::Generator::HTML
# which holds the actual template class.
#
# We put 'doc/template' in the load path to be able to set the template
# to the string 'horo' and thus meet those RDoc's assumptions.
$:.unshift('doc/template')
rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : 'horo'
rdoc.rdoc_files.include('railties/CHANGELOG') rdoc.rdoc_files.include('railties/CHANGELOG')
rdoc.rdoc_files.include('railties/MIT-LICENSE') rdoc.rdoc_files.include('railties/MIT-LICENSE')

259
doc/template/horo.rb vendored
View File

@ -11,8 +11,12 @@ if defined?(RDoc::Diagram)
end end
end end
require 'rdoc/generator/html'
module RDoc module RDoc
module Page module Generator
class HTML
class HORO
FONTS = "\"Bitstream Vera Sans\", Verdana, Arial, Helvetica, sans-serif" FONTS = "\"Bitstream Vera Sans\", Verdana, Arial, Helvetica, sans-serif"
@ -28,7 +32,7 @@ a:hover {
} }
body, td, p { body, td, p {
font-family: %fonts%; font-family: <%= values['fonts'] %>;
background: #FFF; background: #FFF;
color: #000; color: #000;
margin: 0px; margin: 0px;
@ -206,7 +210,7 @@ dd {
} }
CSS CSS
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">
@ -221,9 +225,9 @@ XHTML_FRAMESET_PREAMBLE = %{
HEADER = XHTML_PREAMBLE + <<ENDHEADER HEADER = XHTML_PREAMBLE + <<ENDHEADER
<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" />
<script language="JavaScript" type="text/javascript"> <script language="JavaScript" type="text/javascript">
// <![CDATA[ // <![CDATA[
@ -273,20 +277,20 @@ FILE_PAGE = <<HTML
<table border='0' cellpadding='0' cellspacing='0' width="100%" class='banner'> <table border='0' cellpadding='0' cellspacing='0' width="100%" class='banner'>
<tr><td> <tr><td>
<table width="100%" border='0' cellpadding='0' cellspacing='0'><tr> <table width="100%" border='0' cellpadding='0' cellspacing='0'><tr>
<td class="file-title" colspan="2"><span class="file-title-prefix">File</span><br />%short_name%</td> <td class="file-title" colspan="2"><span class="file-title-prefix">File</span><br /><%= values['short_name'] %></td>
<td align="right"> <td align="right">
<table border='0' cellspacing="0" cellpadding="2"> <table border='0' cellspacing="0" cellpadding="2">
<tr> <tr>
<td>Path:</td> <td>Path:</td>
<td>%full_path% <td><%= values['full_path'] %>
IF:cvsurl <% if values['cvsurl'] %>
&nbsp;(<a href="%cvsurl%">CVS</a>) &nbsp;(<a href="<%= values['cvsurl'] %>">CVS</a>)
ENDIF:cvsurl <% end %>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Modified:</td> <td>Modified:</td>
<td>%dtm_modified%</td> <td><%= values['dtm_modified'] %></td>
</tr> </tr>
</table> </table>
</td></tr> </td></tr>
@ -299,34 +303,34 @@ HTML
CLASS_PAGE = <<HTML CLASS_PAGE = <<HTML
<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr> <table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
<td class="file-title"><span class="file-title-prefix">%classmod%</span><br />%full_name%</td> <td class="file-title"><span class="file-title-prefix"><%= values['classmod'] %></span><br /><%= values['full_name'] %></td>
<td align="right"> <td align="right">
<table cellspacing="0" cellpadding="2"> <table cellspacing="0" cellpadding="2">
<tr valign="top"> <tr valign="top">
<td>In:</td> <td>In:</td>
<td> <td>
START:infiles <% values['infiles'].each do |infile| %>
HREF:full_path_url:full_path: <%= href infile['full_path_url'], infile['full_path'] %>:
IF:cvsurl <% if infile['cvsurl'] %>
&nbsp;(<a href="%cvsurl%">CVS</a>) &nbsp;(<a href="<%= infile['cvsurl'] %>">CVS</a>)
ENDIF:cvsurl <% end %>
END:infiles <% end %>
</td> </td>
</tr> </tr>
IF:parent <% if values['parent'] %>
<tr> <tr>
<td>Parent:</td> <td>Parent:</td>
<td> <td>
IF:par_url <% if values['par_url'] %>
<a href="%par_url%"> <a href="<%= values['par_url'] %>">
ENDIF:par_url <% end %>
%parent% <%= values['parent'] %>
IF:par_url <% if values['par_url'] %>
</a> </a>
ENDIF:par_url <% end %>
</td> </td>
</tr> </tr>
ENDIF:parent <% end %>
</table> </table>
</td> </td>
</tr> </tr>
@ -337,149 +341,149 @@ HTML
METHOD_LIST = <<HTML METHOD_LIST = <<HTML
<div id="content"> <div id="content">
IF:diagram <% if values['diagram'] %>
<table cellpadding='0' cellspacing='0' border='0' width="100%"><tr><td align="center"> <table cellpadding='0' cellspacing='0' border='0' width="100%"><tr><td align="center">
%diagram% <%= values['diagram'] %>
</td></tr></table> </td></tr></table>
ENDIF:diagram <% end %>
IF:description <% if values['description'] %>
<div class="description">%description%</div> <div class="description"><%= values['description'] %></div>
ENDIF:description <% end %>
IF:requires <% if values['requires'] %>
<div class="sectiontitle">Required Files</div> <div class="sectiontitle">Required Files</div>
<ul> <ul>
START:requires <% values['requires'].each do |require| %>
<li>HREF:aref:name:</li> <li><%= href require['aref'], require['name'] %>:</li>
END:requires <% end %>
</ul> </ul>
ENDIF:requires <% end %>
IF:toc <% if values['toc'] %>
<div class="sectiontitle">Contents</div> <div class="sectiontitle">Contents</div>
<ul> <ul>
START:toc <% values['toc'].each do |toc| %>
<li><a href="#%href%">%secname%</a></li> <li><a href="#<%= toc['href'] %>"><%= toc['secname'] %></a></li>
END:toc <% end %>
</ul> </ul>
ENDIF:toc <% end %>
IF:methods <% if values['methods'] %>
<div class="sectiontitle">Methods</div> <div class="sectiontitle">Methods</div>
<ul> <ul>
START:methods <% values['methods'].each do |method| %>
<li>HREF:aref:name:</li> <li><%= href method['aref'], method['name'] %></li>
END:methods <% end %>
</ul> </ul>
ENDIF:methods <% end %>
IF:includes <% if values['includes'] %>
<div class="sectiontitle">Included Modules</div> <div class="sectiontitle">Included Modules</div>
<ul> <ul>
START:includes <% values['includes'].each do |include| %>
<li>HREF:aref:name:</li> <li><%= href include['aref'], include['name'] %>:</li>
END:includes <% end %>
</ul> </ul>
ENDIF:includes <% end %>
START:sections <% values['sections'].each do |section| %>
IF:sectitle <% if section['sectitle'] %>
<div class="sectiontitle"><a name="%secsequence%">%sectitle%</a></div> <div class="sectiontitle"><a name="<%= section['secsequence'] %>"><%= section['sectitle'] %></a></div>
IF:seccomment <% if section['seccomment'] %>
<div class="description"> <div class="description">
%seccomment% <%= section['seccomment'] %>
</div> </div>
ENDIF:seccomment <% end %>
ENDIF:sectitle <% end %>
IF:classlist <% if section['classlist'] %>
<div class="sectiontitle">Classes and Modules</div> <div class="sectiontitle">Classes and Modules</div>
%classlist% <%= section['classlist'] %>
ENDIF:classlist <% end %>
IF:constants <% if section['constants'] %>
<div class="sectiontitle">Constants</div> <div class="sectiontitle">Constants</div>
<table border='0' cellpadding='5'> <table border='0' cellpadding='5'>
START:constants <% section['constants'].each do |constant| %>
<tr valign='top'> <tr valign='top'>
<td class="attr-name">%name%</td> <td class="attr-name"><%= constant['name'] %></td>
<td>=</td> <td>=</td>
<td class="attr-value">%value%</td> <td class="attr-value"><%= constant['value'] %></td>
</tr> </tr>
IF:desc <% if constant['desc'] %>
<tr valign='top'> <tr valign='top'>
<td>&nbsp;</td> <td>&nbsp;</td>
<td colspan="2" class="attr-desc">%desc%</td> <td colspan="2" class="attr-desc"><%= constant['desc'] %></td>
</tr> </tr>
ENDIF:desc <% end %>
END:constants <% end %>
</table> </table>
ENDIF:constants <% end %>
IF:attributes <% if section['attributes'] %>
<div class="sectiontitle">Attributes</div> <div class="sectiontitle">Attributes</div>
<table border='0' cellpadding='5'> <table border='0' cellpadding='5'>
START:attributes <% section['attributes'].each do |attribute| %>
<tr valign='top'> <tr valign='top'>
<td class='attr-rw'> <td class='attr-rw'>
IF:rw <% if attribute['rw'] %>
[%rw%] [<%= attribute['rw'] %>]
ENDIF:rw <% end %>
</td> </td>
<td class='attr-name'>%name%</td> <td class='attr-name'><%= attribute['name'] %></td>
<td class='attr-desc'>%a_desc%</td> <td class='attr-desc'><%= attribute['a_desc'] %></td>
</tr> </tr>
END:attributes <% end %>
</table> </table>
ENDIF:attributes <% end %>
IF:method_list <% if section['method_list'] %>
START:method_list <% section['method_list'].each do |method_list| %>
IF:methods <% if method_list['methods'] %>
<div class="sectiontitle">%type% %category% methods</div> <div class="sectiontitle"><%= method_list['type'] %> <%= method_list['category'] %> methods</div>
START:methods <% method_list['methods'].each do |method| %>
<div class="method"> <div class="method">
<div class="title"> <div class="title">
IF:callseq <% if method['callseq'] %>
<a name="%aref%"></a><b>%callseq%</b> <a name="<%= method['aref'] %>"></a><b><%= method['callseq'] %></b>
ENDIF:callseq <% end %>
IFNOT:callseq <% unless method['callseq'] %>
<a name="%aref%"></a><b>%name%</b>%params% <a name="<%= method['aref'] %>"></a><b><%= method['name'] %></b><%= method['params'] %>
ENDIF:callseq <% end %>
IF:codeurl <% if method['codeurl'] %>
[&nbsp;<a href="%codeurl%" target="SOURCE_CODE" onclick="javascript:openCode('%codeurl%'); return false;">source</a>&nbsp;] [&nbsp;<a href="<%= method['codeurl'] %>" target="SOURCE_CODE" onclick="javascript:openCode('<%= method['codeurl'] %>'); return false;">source</a>&nbsp;]
ENDIF:codeurl <% end %>
</div> </div>
IF:m_desc <% if method['m_desc'] %>
<div class="description"> <div class="description">
%m_desc% <%= method['m_desc'] %>
</div> </div>
ENDIF:m_desc <% end %>
IF:aka <% if method['aka'] %>
<div class="aka"> <div class="aka">
This method is also aliased as This method is also aliased as
START:aka <% method['aka'].each do |aka| %>
<a href="%aref%">%name%</a> <a href="<%= aka['aref'] %>"><%= aka['name'] %></a>
END:aka <% end %>
</div> </div>
ENDIF:aka <% end %>
IF:sourcecode <% if method['sourcecode'] %>
<div class="sourcecode"> <div class="sourcecode">
<p class="source-link">[ <a href="javascript:toggleSource('%aref%_source')" id="l_%aref%_source">show source</a> ]</p> <p class="source-link">[ <a href="javascript:toggleSource('<%= method['aref'] %>_source')" id="l_<%= method['aref'] %>_source">show source</a> ]</p>
<div id="%aref%_source" class="dyn-source"> <div id="<%= method['aref'] %>_source" class="dyn-source">
<pre> <pre>
%sourcecode% <%= method['sourcecode'] %>
</pre> </pre>
</div> </div>
</div> </div>
ENDIF:sourcecode <% end %>
</div> </div>
END:methods <% end %>
ENDIF:methods <% end %>
END:method_list <% end %>
ENDIF:method_list <% end %>
END:sections <% end %>
</div> </div>
HTML HTML
@ -489,7 +493,7 @@ FOOTER = <<ENDFOOTER
ENDFOOTER ENDFOOTER
BODY = HEADER + <<ENDBODY BODY = HEADER + <<ENDBODY
!INCLUDE! <!-- banner header --> <%= template_include %> <!-- banner header -->
<div id="bodyContent"> <div id="bodyContent">
#{METHOD_LIST} #{METHOD_LIST}
@ -502,8 +506,8 @@ ENDBODY
SRC_PAGE = XHTML_PREAMBLE + <<HTML SRC_PAGE = XHTML_PREAMBLE + <<HTML
<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; }
@ -521,7 +525,7 @@ SRC_PAGE = XHTML_PREAMBLE + <<HTML
</style> </style>
</head> </head>
<body bgcolor="white"> <body bgcolor="white">
<pre>%code%</pre> <pre><%= values['code'] %></pre>
</body> </body>
</html> </html>
HTML HTML
@ -529,13 +533,13 @@ HTML
########################## Index ################################ ########################## Index ################################
FR_INDEX_BODY = <<HTML FR_INDEX_BODY = <<HTML
!INCLUDE! <%= template_include %>
HTML HTML
FILE_INDEX = XHTML_PREAMBLE + <<HTML FILE_INDEX = XHTML_PREAMBLE + <<HTML
<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'] %>" />
<title>Index</title> <title>Index</title>
<style type="text/css"> <style type="text/css">
<!-- <!--
@ -571,11 +575,11 @@ FILE_INDEX = XHTML_PREAMBLE + <<HTML
<base target="docwin" /> <base target="docwin" />
</head> </head>
<body> <body>
<div class="banner">%list_title%</div> <div class="banner"><%= values['list_title'] %></div>
<div class="entries"> <div class="entries">
START:entries <% values['entries'].each do |entrie| %>
<a href="%href%">%name%</a><br /> <a href="<%= entrie['href'] %>"><%= entrie['name'] %></a><br />
END:entries <% end %>
</div> </div>
</body></html> </body></html>
HTML HTML
@ -586,8 +590,8 @@ METHOD_INDEX = FILE_INDEX
INDEX = XHTML_FRAMESET_PREAMBLE + <<HTML INDEX = XHTML_FRAMESET_PREAMBLE + <<HTML
<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 cols="20%,*"> <frameset cols="20%,*">
@ -596,7 +600,7 @@ INDEX = XHTML_FRAMESET_PREAMBLE + <<HTML
<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" />
<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
@ -610,4 +614,5 @@ HTML
end end
end end
end
end