Module: RDoc::Generator::HTML::HTML

Defined in:
lib/rdoc/generator/html/html.rb

Overview

CSS2 RDoc HTML template

This is a template for RDoc that uses XHTML 1.0 Transitional and dictates a bit more of the appearance of the output to cascading stylesheets than the default. It was designed for clean inline code display, and uses DHTMl to toggle the visbility of each method’s source with each click on the ‘[source]’ link.

Authors

Copyright © 2002, 2003 The FaerieMUD Consortium. Some rights reserved.

This work is licensed under the Creative Commons Attribution License. To view a copy of this license, visit creativecommons.org/licenses/by/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Constant Summary collapse

FONTS =
"Verdana,Arial,Helvetica,sans-serif"
STYLE =
"body {\nfont-family: Verdana,Arial,Helvetica,sans-serif;\nfont-size:   90%;\nmargin: 0;\nmargin-left: 40px;\npadding: 0;\nbackground: white;\n}\n\nh1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }\nh1 { font-size: 150%; }\nh2,h3,h4 { margin-top: 1em; }\n\na { background: #eef; color: #039; text-decoration: none; }\na:hover { background: #039; color: #eef; }\n\n/* Override the base stylesheet's Anchor inside a table cell */\ntd > a {\nbackground: transparent;\ncolor: #039;\ntext-decoration: none;\n}\n\n/* and inside a section title */\n.section-title > a {\nbackground: transparent;\ncolor: #eee;\ntext-decoration: none;\n}\n\n/* === Structural elements =================================== */\n\ndiv#index {\nmargin: 0;\nmargin-left: -40px;\npadding: 0;\nfont-size: 90%;\n}\n\n\ndiv#index a {\nmargin-left: 0.7em;\n}\n\ndiv#index .section-bar {\nmargin-left: 0px;\npadding-left: 0.7em;\nbackground: #ccc;\nfont-size: small;\n}\n\n\ndiv#classHeader, div#fileHeader {\nwidth: auto;\ncolor: white;\npadding: 0.5em 1.5em 0.5em 1.5em;\nmargin: 0;\nmargin-left: -40px;\nborder-bottom: 3px solid #006;\n}\n\ndiv#classHeader a, div#fileHeader a {\nbackground: inherit;\ncolor: white;\n}\n\ndiv#classHeader td, div#fileHeader td {\nbackground: inherit;\ncolor: white;\n}\n\n\ndiv#fileHeader {\nbackground: #057;\n}\n\ndiv#classHeader {\nbackground: #048;\n}\n\n\n.class-name-in-header {\nfont-size:  180%;\nfont-weight: bold;\n}\n\n\ndiv#bodyContent {\npadding: 0 1.5em 0 1.5em;\n}\n\ndiv#description {\npadding: 0.5em 1.5em;\nbackground: #efefef;\nborder: 1px dotted #999;\n}\n\ndiv#description h1,h2,h3,h4,h5,h6 {\ncolor: #125;;\nbackground: transparent;\n}\n\ndiv#validator-badges {\ntext-align: center;\n}\ndiv#validator-badges img { border: 0; }\n\ndiv#copyright {\ncolor: #333;\nbackground: #efefef;\nfont: 0.75em sans-serif;\nmargin-top: 5em;\nmargin-bottom: 0;\npadding: 0.5em 2em;\n}\n\n\n/* === Classes =================================== */\n\ntable.header-table {\ncolor: white;\nfont-size: small;\n}\n\n.type-note {\nfont-size: small;\ncolor: #DEDEDE;\n}\n\n.xxsection-bar {\nbackground: #eee;\ncolor: #333;\npadding: 3px;\n}\n\n.section-bar {\ncolor: #333;\nborder-bottom: 1px solid #999;\nmargin-left: -20px;\n}\n\n\n.section-title {\nbackground: #79a;\ncolor: #eee;\npadding: 3px;\nmargin-top: 2em;\nmargin-left: -30px;\nborder: 1px solid #999;\n}\n\n.top-aligned-row {  vertical-align: top }\n.bottom-aligned-row { vertical-align: bottom }\n\n/* --- Context section classes ----------------------- */\n\n.context-row { }\n.context-item-name { font-family: monospace; font-weight: bold; color: black; }\n.context-item-value { font-size: small; color: #448; }\n.context-item-desc { color: #333; padding-left: 2em; }\n\n/* --- Method classes -------------------------- */\n.method-detail {\nbackground: #efefef;\npadding: 0;\nmargin-top: 0.5em;\nmargin-bottom: 1em;\nborder: 1px dotted #ccc;\n}\n.method-heading {\ncolor: black;\nbackground: #ccc;\nborder-bottom: 1px solid #666;\npadding: 0.2em 0.5em 0 0.5em;\n}\n.method-signature { color: black; background: inherit; }\n.method-name { font-weight: bold; }\n.method-args { font-style: italic; }\n.method-description { padding: 0 0.5em 0 0.5em; }\n\n/* --- Source code sections -------------------- */\n\na.source-toggle { font-size: 90%; }\ndiv.method-source-code {\nbackground: #262626;\ncolor: #ffdead;\nmargin: 1em;\npadding: 0.5em;\nborder: 1px dashed #999;\noverflow: hidden;\n}\n\ndiv.method-source-code pre { color: #ffdead; overflow: hidden; }\n\n/* --- Ruby keyword styles --------------------- */\n\n.standalone-code { background: #221111; color: #ffdead; overflow: hidden; }\n\n.ruby-constant  { color: #7fffd4; background: transparent; }\n.ruby-keyword { color: #00ffff; background: transparent; }\n.ruby-ivar    { color: #eedd82; background: transparent; }\n.ruby-operator  { color: #00ffee; background: transparent; }\n.ruby-identifier { color: #ffdead; background: transparent; }\n.ruby-node    { color: #ffa07a; background: transparent; }\n.ruby-comment { color: #b22222; font-weight: bold; background: transparent; }\n.ruby-regexp  { color: #ffa07a; background: transparent; }\n.ruby-value   { color: #7fffd4; background: transparent; }\n"
XHTML_PREAMBLE =

H E A D E R T E M P L A T E

"<?xml version=\"1.0\" encoding=\"<%= values[\"charset\"] %>\"?>\n<!DOCTYPE html\nPUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
HEADER =
XHTML_PREAMBLE + "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n<head>\n<title><%= values[\"title\"] %></title>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=<%= values[\"charset\"] %>\" />\n<meta http-equiv=\"Content-Script-Type\" content=\"text/javascript\" />\n<link rel=\"stylesheet\" href=\"<%= values[\"style_url\"] %>\" type=\"text/css\" media=\"screen\" />\n<script type=\"text/javascript\">\n// <![CDATA[\n\nfunction popupCode( url ) {\nwindow.open(url, \"Code\", \"resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400\")\n}\n\nfunction toggleCode( id ) {\nif ( document.getElementById )\nelem = document.getElementById( id );\nelse if ( document.all )\nelem = eval( \"document.all.\" + id );\nelse\nreturn false;\n\nelemStyle = elem.style;\n\nif ( elemStyle.display != \"block\" ) {\nelemStyle.display = \"block\"\n} else {\nelemStyle.display = \"none\"\n}\n\nreturn true;\n}\n\n// Make codeblocks hidden by default\ndocument.writeln( \"<style type=\\\\\"text/css\\\\\">div.method-source-code { display: none }</style>\" )\n\n// ]]>\n</script>\n\n</head>\n<body>\n"
CONTEXT_CONTENT =

C O N T E X T C O N T E N T T E M P L A T E

%{
}
"<div id=\"validator-badges\">\n<p><small><a href=\"http://validator.w3.org/check/referer\">[Validate]</a></small></p>\n</div>\n\n</body>\n</html>\n"
FILE_PAGE =

F I L E P A G E H E A D E R T E M P L A T E

"<div id=\"fileHeader\">\n<h1><%= values[\"short_name\"] %></h1>\n<table class=\"header-table\">\n<tr class=\"top-aligned-row\">\n<td><strong>Path:</strong></td>\n<td><%= values[\"full_path\"] %>\n<% if values[\"cvsurl\"] then %>\n&nbsp;(<a href=\"<%= values[\"cvsurl\"] %>\"><acronym title=\"Concurrent Versioning System\">CVS</acronym></a>)\n<% end %>\n</td>\n</tr>\n<tr class=\"top-aligned-row\">\n<td><strong>Last Update:</strong></td>\n<td><%= values[\"dtm_modified\"] %></td>\n</tr>\n</table>\n</div>\n"
CLASS_PAGE =

C L A S S P A G E H E A D E R T E M P L A T E

"<div id=\"classHeader\">\n<table class=\"header-table\">\n<tr class=\"top-aligned-row\">\n<td><strong><%= values[\"classmod\"] %></strong></td>\n<td class=\"class-name-in-header\"><%= values[\"full_name\"] %></td>\n</tr>\n<tr class=\"top-aligned-row\">\n<td><strong>In:</strong></td>\n<td>\n<% values[\"infiles\"].each do |infiles| %>\n<% if infiles[\"full_path_url\"] then %>\n<a href=\"<%= infiles[\"full_path_url\"] %>\">\n<% end %>\n<%= infiles[\"full_path\"] %>\n<% if infiles[\"full_path_url\"] then %>\n</a>\n<% end %>\n<% if infiles[\"cvsurl\"] then %>\n&nbsp;(<a href=\"<%= infiles[\"cvsurl\"] %>\"><acronym title=\"Concurrent Versioning System\">CVS</acronym></a>)\n<% end %>\n<br />\n<% end # values[\"infiles\"] %>\n</td>\n</tr>\n\n<% if values[\"parent\"] then %>\n<tr class=\"top-aligned-row\">\n<td><strong>Parent:</strong></td>\n<td>\n<% if values[\"par_url\"] then %>\n<a href=\"<%= values[\"par_url\"] %>\">\n<% end %>\n<%= values[\"parent\"] %>\n<% if values[\"par_url\"] then %>\n</a>\n<% end %>\n</td>\n</tr>\n<% end %>\n</table>\n</div>\n"
METHOD_LIST =

M E T H O D L I S T T E M P L A T E

"\n<div id=\"contextContent\">\n<% if values[\"diagram\"] then %>\n<div id=\"diagram\">\n<%= values[\"diagram\"] %>\n</div>\n<% end %>\n\n<% if values[\"description\"] then %>\n<div id=\"description\">\n<%= values[\"description\"] %>\n</div>\n<% end %>\n\n<% if values[\"requires\"] then %>\n<div id=\"requires-list\">\n<h3 class=\"section-bar\">Required files</h3>\n\n<div class=\"name-list\">\n<% values[\"requires\"].each do |requires| %>\n<%= href requires[\"aref\"], requires[\"name\"] %>&nbsp;&nbsp;\n<% end # values[\"requires\"] %>\n</div>\n</div>\n<% end %>\n\n<% if values[\"toc\"] then %>\n<div id=\"contents-list\">\n<h3 class=\"section-bar\">Contents</h3>\n<ul>\n<% values[\"toc\"].each do |toc| %>\n<li><a href=\"#<%= values[\"href\"] %>\"><%= values[\"secname\"] %></a></li>\n<% end # values[\"toc\"] %>\n</ul>\n<% end %>\n</div>\n\n<% if values[\"methods\"] then %>\n<div id=\"method-list\">\n<h3 class=\"section-bar\">Methods</h3>\n\n<div class=\"name-list\">\n<% values[\"methods\"].each do |methods| %>\n<%= href methods[\"aref\"], methods[\"name\"] %>&nbsp;&nbsp;\n<% end # values[\"methods\"] %>\n</div>\n</div>\n<% end %>\n\n</div>\n\n\n<!-- if includes -->\n<% if values[\"includes\"] then %>\n<div id=\"includes\">\n<h3 class=\"section-bar\">Included Modules</h3>\n\n<div id=\"includes-list\">\n<% values[\"includes\"].each do |includes| %>\n<span class=\"include-name\"><%= href includes[\"aref\"], includes[\"name\"] %></span>\n<% end # values[\"includes\"] %>\n</div>\n</div>\n<% end %>\n\n<% values[\"sections\"].each do |sections| %>\n<div id=\"section\">\n<% if sections[\"sectitle\"] then %>\n<h2 class=\"section-title\"><a name=\"<%= sections[\"secsequence\"] %>\"><%= sections[\"sectitle\"] %></a></h2>\n<% if sections[\"seccomment\"] then %>\n<div class=\"section-comment\">\n<%= sections[\"seccomment\"] %>\n</div>\n<% end %>\n<% end %>\n\n<% if values[\"classlist\"] then %>\n<div id=\"class-list\">\n<h3 class=\"section-bar\">Classes and Modules</h3>\n\n<%= values[\"classlist\"] %>\n</div>\n<% end %>\n\n<% if values[\"constants\"] then %>\n<div id=\"constants-list\">\n<h3 class=\"section-bar\">Constants</h3>\n\n<div class=\"name-list\">\n<table summary=\"Constants\">\n<% values[\"constants\"].each do |constants| %>\n<tr class=\"top-aligned-row context-row\">\n<td class=\"context-item-name\"><%= constants[\"name\"] %></td>\n<td>=</td>\n<td class=\"context-item-value\"><%= constants[\"value\"] %></td>\n<% if values[\"desc\"] then %>\n<td width=\"3em\">&nbsp;</td>\n<td class=\"context-item-desc\"><%= constants[\"desc\"] %></td>\n<% end %>\n</tr>\n<% end # values[\"constants\"] %>\n</table>\n</div>\n</div>\n<% end %>\n\n<% if values[\"aliases\"] then %>\n<div id=\"aliases-list\">\n<h3 class=\"section-bar\">External Aliases</h3>\n\n<div class=\"name-list\">\n<table summary=\"aliases\">\n<% values[\"aliases\"].each do |aliases| $stderr.puts({ :aliases => aliases }.inspect) %>\n<tr class=\"top-aligned-row context-row\">\n<td class=\"context-item-name\"><%= values[\"old_name\"] %></td>\n<td>-&gt;</td>\n<td class=\"context-item-value\"><%= values[\"new_name\"] %></td>\n</tr>\n<% if values[\"desc\"] then %>\n<tr class=\"top-aligned-row context-row\">\n<td>&nbsp;</td>\n<td colspan=\"2\" class=\"context-item-desc\"><%= values[\"desc\"] %></td>\n</tr>\n<% end %>\n<% end # values[\"aliases\"] %>\n</table>\n</div>\n</div>\n<% end %>\n\n\n<% if values[\"attributes\"] then %>\n<div id=\"attribute-list\">\n<h3 class=\"section-bar\">Attributes</h3>\n\n<div class=\"name-list\">\n<table>\n<% values[\"attributes\"].each do |attributes| $stderr.puts({ :attributes => attributes }.inspect) %>\n<tr class=\"top-aligned-row context-row\">\n<td class=\"context-item-name\"><%= values[\"name\"] %></td>\n<% if values[\"rw\"] then %>\n<td class=\"context-item-value\">&nbsp;[<%= values[\"rw\"] %>]&nbsp;</td>\n<% end %>\n<% unless values[\"rw\"] then %>\n<td class=\"context-item-value\">&nbsp;&nbsp;</td>\n<% end %>\n<td class=\"context-item-desc\"><%= values[\"a_desc\"] %></td>\n</tr>\n<% end # values[\"attributes\"] %>\n</table>\n</div>\n</div>\n<% end %>\n\n\n\n<!-- if method_list -->\n<% if sections[\"method_list\"] then %>\n<div id=\"methods\">\n<% sections[\"method_list\"].each do |method_list| %>\n<% if method_list[\"methods\"] then %>\n<h3 class=\"section-bar\"><%= method_list[\"type\"] %> <%= method_list[\"category\"] %> methods</h3>\n\n<% method_list[\"methods\"].each do |methods| %>\n<div id=\"method-<%= methods[\"aref\"] %>\" class=\"method-detail\">\n<a name=\"<%= methods[\"aref\"] %>\"></a>\n\n<div class=\"method-heading\">\n<% if methods[\"codeurl\"] then %>\n<a href=\"<%= methods[\"codeurl\"] %>\" target=\"Code\" class=\"method-signature\"\nonclick=\"popupCode('<%= methods[\"codeurl\"] %>');return false;\">\n<% end %>\n<% if methods[\"sourcecode\"] then %>\n<a href=\"#<%= methods[\"aref\"] %>\" class=\"method-signature\">\n<% end %>\n<% if methods[\"callseq\"] then %>\n<span class=\"method-name\"><%= methods[\"callseq\"] %></span>\n<% end %>\n<% unless methods[\"callseq\"] then %>\n<span class=\"method-name\"><%= methods[\"name\"] %></span><span class=\"method-args\"><%= methods[\"params\"] %></span>\n<% end %>\n<% if methods[\"codeurl\"] then %>\n</a>\n<% end %>\n<% if methods[\"sourcecode\"] then %>\n</a>\n<% end %>\n</div>\n\n<div class=\"method-description\">\n<% if methods[\"m_desc\"] then %>\n<%= methods[\"m_desc\"] %>\n<% end %>\n<% if methods[\"sourcecode\"] then %>\n<p><a class=\"source-toggle\" href=\"#\"\nonclick=\"toggleCode('<%= methods[\"aref\"] %>-source');return false;\">[Source]</a></p>\n<div class=\"method-source-code\" id=\"<%= methods[\"aref\"] %>-source\">\n<pre>\n<%= methods[\"sourcecode\"] %>\n</pre>\n</div>\n<% end %>\n</div>\n</div>\n\n<% end # method_list[\"methods\"] %>\n<% end %>\n<% end # sections[\"method_list\"] %>\n\n</div>\n<% end %>\n<% end # values[\"sections\"] %>\n"
BODY =

B O D Y T E M P L A T E

HEADER + %{

<%= template_include %>  <!-- banner header -->

  <div id="bodyContent">

} +  METHOD_LIST + %{

  </div>

} + FOOTER
SRC_PAGE =

S O U R C E C O D E T E M P L A T E

XHTML_PREAMBLE + "<html>\n<head>\n<title><%= values[\"title\"] %></title>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=<%= values[\"charset\"] %>\" />\n<link rel=\"stylesheet\" href=\"<%= values[\"style_url\"] %>\" type=\"text/css\" media=\"screen\" />\n</head>\n<body class=\"standalone-code\">\n<pre><%= values[\"code\"] %></pre>\n</body>\n</html>\n"
FR_INDEX_BODY =

I N D E X F I L E T E M P L A T E S

%{
<%= template_include %>
}
FILE_INDEX =
XHTML_PREAMBLE + "<!--\n\n<%= values[\"list_title\"] %>\n\n-->\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n<head>\n<title><%= values[\"list_title\"] %></title>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=<%= values[\"charset\"] %>\" />\n<link rel=\"stylesheet\" href=\"<%= values[\"style_url\"] %>\" type=\"text/css\" />\n<base target=\"docwin\" />\n</head>\n<body>\n<div id=\"index\">\n<h1 class=\"section-bar\"><%= values[\"list_title\"] %></h1>\n<div id=\"index-entries\">\n<% values[\"entries\"].each do |entries| %>\n<a href=\"<%= entries[\"href\"] %>\"><%= entries[\"name\"] %></a><br />\n<% end # values[\"entries\"] %>\n</div>\n</div>\n</body>\n</html>\n"
CLASS_INDEX =
FILE_INDEX
METHOD_INDEX =
FILE_INDEX
INDEX =
"<?xml version=\"1.0\" encoding=\"<%= values[\"charset\"] %>\"?>\n<!DOCTYPE html\nPUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n\n<!--\n\n<%= values[\"title\"] %>\n\n-->\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n<head>\n<title><%= values[\"title\"] %></title>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=<%= values[\"charset\"] %>\" />\n</head>\n<frameset rows=\"20%, 80%\">\n<frameset cols=\"25%,35%,45%\">\n<frame src=\"fr_file_index.html\"   title=\"Files\" name=\"Files\" />\n<frame src=\"fr_class_index.html\"  name=\"Classes\" />\n<frame src=\"fr_method_index.html\" name=\"Methods\" />\n</frameset>\n<frame src=\"<%= values[\"initial_page\"] %>\" name=\"docwin\" />\n</frameset>\n</html>\n"