1 require 'rdoc/generator/html'
2 require 'rdoc/generator/html/one_page_html'
5 # = CSS2 RDoc HTML template
7 # This is a template for RDoc that uses XHTML 1.0 Transitional and dictates a
8 # bit more of the appearance of the output to cascading stylesheets than the
9 # default. It was designed for clean inline code display, and uses DHTMl to
10 # toggle the visibility of each method's source with each click on the
15 # * Michael Granger <ged@FaerieMUD.org>
17 # Copyright (c) 2002, 2003 The FaerieMUD Consortium. Some rights reserved.
19 # This work is licensed under the Creative Commons Attribution License. To
20 # view a copy of this license, visit
21 # http://creativecommons.org/licenses/by/1.0/ or send a letter to Creative
22 # Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
24 module RDoc::Generator::HTML::HTML
26 FONTS = "Verdana,Arial,Helvetica,sans-serif"
30 font-family: Verdana,Arial,Helvetica,sans-serif;
38 h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
39 h1 { font-size: 150%; }
40 h2,h3,h4 { margin-top: 1em; }
42 a { background: #eef; color: #039; text-decoration: none; }
43 a:hover { background: #039; color: #eef; }
45 /* Override the base stylesheet's Anchor inside a table cell */
47 background: transparent;
49 text-decoration: none;
52 /* and inside a section title */
54 background: transparent;
56 text-decoration: none;
59 /* === Structural elements =================================== */
73 div#index .section-bar {
81 div#classHeader, div#fileHeader {
84 padding: 0.5em 1.5em 0.5em 1.5em;
87 border-bottom: 3px solid #006;
90 div#classHeader a, div#fileHeader a {
95 div#classHeader td, div#fileHeader td {
110 .class-name-in-header {
117 padding: 0 1.5em 0 1.5em;
121 padding: 0.5em 1.5em;
123 border: 1px dotted #999;
126 div#description h1,h2,h3,h4,h5,h6 {
128 background: transparent;
131 div#validator-badges {
134 div#validator-badges img { border: 0; }
139 font: 0.75em sans-serif;
146 /* === Classes =================================== */
166 border-bottom: 1px solid #999;
177 border: 1px solid #999;
180 .top-aligned-row { vertical-align: top }
181 .bottom-aligned-row { vertical-align: bottom }
183 /* --- Context section classes ----------------------- */
186 .context-item-name { font-family: monospace; font-weight: bold; color: black; }
187 .context-item-value { font-size: small; color: #448; }
188 .context-item-desc { color: #333; padding-left: 2em; }
190 /* --- Method classes -------------------------- */
196 border: 1px dotted #ccc;
201 border-bottom: 1px solid #666;
202 padding: 0.2em 0.5em 0 0.5em;
204 .method-signature { color: black; background: inherit; }
205 .method-name { font-weight: bold; }
206 .method-args { font-style: italic; }
207 .method-description { padding: 0 0.5em 0 0.5em; }
209 /* --- Source code sections -------------------- */
211 a.source-toggle { font-size: 90%; }
212 div.method-source-code {
217 border: 1px dashed #999;
221 div.method-source-code pre { color: #ffdead; overflow: hidden; }
223 /* --- Ruby keyword styles --------------------- */
225 .standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
227 .ruby-constant { color: #7fffd4; background: transparent; }
228 .ruby-keyword { color: #00ffff; background: transparent; }
229 .ruby-ivar { color: #eedd82; background: transparent; }
230 .ruby-operator { color: #00ffee; background: transparent; }
231 .ruby-identifier { color: #ffdead; background: transparent; }
232 .ruby-node { color: #ffa07a; background: transparent; }
233 .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
234 .ruby-regexp { color: #ffa07a; background: transparent; }
235 .ruby-value { color: #7fffd4; background: transparent; }
239 #####################################################################
240 ### H E A D E R T E M P L A T E
241 #####################################################################
243 XHTML_PREAMBLE = <<-EOF
244 <?xml version="1.0" encoding="<%= values["charset"] %>"?>
246 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
247 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
250 HEADER = XHTML_PREAMBLE + <<-EOF
251 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
253 <title><%= values["title"] %></title>
254 <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>" />
255 <meta http-equiv="Content-Script-Type" content="text/javascript" />
256 <link rel="stylesheet" href="<%= values["style_url"] %>" type="text/css" media="screen" />
257 <script type="text/javascript">
260 function popupCode( url ) {
261 window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
264 function toggleCode( id ) {
265 if ( document.getElementById )
266 elem = document.getElementById( id );
267 else if ( document.all )
268 elem = eval( "document.all." + id );
272 elemStyle = elem.style;
274 if ( elemStyle.display != "block" ) {
275 elemStyle.display = "block"
277 elemStyle.display = "none"
283 // Make codeblocks hidden by default
284 document.writeln( "<style type=\\"text/css\\">div.method-source-code { display: none }</style>" )
293 #####################################################################
294 ### C O N T E X T C O N T E N T T E M P L A T E
295 #####################################################################
300 #####################################################################
301 ### F O O T E R T E M P L A T E
302 #####################################################################
305 <div id="validator-badges">
306 <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
314 #####################################################################
315 ### F I L E P A G E H E A D E R T E M P L A T E
316 #####################################################################
319 <div id="fileHeader">
320 <h1><%= values["short_name"] %></h1>
321 <table class="header-table">
322 <tr class="top-aligned-row">
323 <td><strong>Path:</strong></td>
324 <td><%= values["full_path"] %>
325 <% if values["cvsurl"] then %>
326 (<a href="<%= values["cvsurl"] %>"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
330 <tr class="top-aligned-row">
331 <td><strong>Last Update:</strong></td>
332 <td><%= values["dtm_modified"] %></td>
338 #####################################################################
339 ### C L A S S P A G E H E A D E R T E M P L A T E
340 #####################################################################
343 <div id="classHeader">
344 <table class="header-table">
345 <tr class="top-aligned-row">
346 <td><strong><%= values["classmod"] %></strong></td>
347 <td class="class-name-in-header"><%= values["full_name"] %></td>
349 <tr class="top-aligned-row">
350 <td><strong>In:</strong></td>
352 <% values["infiles"].each do |infiles| %>
353 <% if infiles["full_path_url"] then %>
354 <a href="<%= infiles["full_path_url"] %>">
356 <%= infiles["full_path"] %>
357 <% if infiles["full_path_url"] then %>
360 <% if infiles["cvsurl"] then %>
361 (<a href="<%= infiles["cvsurl"] %>"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
364 <% end %><%# values["infiles"] %>
368 <% if values["parent"] then %>
369 <tr class="top-aligned-row">
370 <td><strong>Parent:</strong></td>
372 <% if values["par_url"] then %>
373 <a href="<%= values["par_url"] %>">
375 <%= values["parent"] %>
376 <% if values["par_url"] then %>
386 #####################################################################
387 ### M E T H O D L I S T T E M P L A T E
388 #####################################################################
391 <div id="contextContent">
392 <% if values["diagram"] then %>
394 <%= values["diagram"] %>
398 if values["description"] then %>
399 <div id="description">
400 <%= values["description"] %>
404 if values["requires"] then %>
405 <div id="requires-list">
406 <h3 class="section-bar">Required files</h3>
408 <div class="name-list">
409 <% values["requires"].each do |requires| %>
410 <%= href requires["aref"], requires["name"] %>
411 <% end %><%# values["requires"] %>
416 if values["toc"] then %>
417 <div id="contents-list">
418 <h3 class="section-bar">Contents</h3>
420 <% values["toc"].each do |toc| %>
421 <li><a href="#<%= toc["href"] %>"><%= toc["secname"] %></a></li>
422 <% end %><%# values["toc"] %>
427 <% if values["methods"] then %>
428 <div id="method-list">
429 <h3 class="section-bar">Methods</h3>
431 <div class="name-list">
432 <% values["methods"].each do |methods| %>
433 <%= href methods["aref"], methods["name"] %>
434 <% end %><%# values["methods"] %>
441 <% if values["includes"] then %>
443 <h3 class="section-bar">Included Modules</h3>
445 <div id="includes-list">
446 <% values["includes"].each do |includes| %>
447 <span class="include-name"><%= href includes["aref"], includes["name"] %></span>
448 <% end %><%# values["includes"] %>
453 values["sections"].each do |sections| %>
455 <% if sections["sectitle"] then %>
456 <h2 class="section-title"><a name="<%= sections["secsequence"] %>"><%= sections["sectitle"] %></a></h2>
457 <% if sections["seccomment"] then %>
458 <div class="section-comment">
459 <%= sections["seccomment"] %>
464 if sections["classlist"] then %>
465 <div id="class-list">
466 <h3 class="section-bar">Classes and Modules</h3>
468 <%= sections["classlist"] %>
472 if sections["constants"] then %>
473 <div id="constants-list">
474 <h3 class="section-bar">Constants</h3>
476 <div class="name-list">
477 <table summary="Constants">
478 <% sections["constants"].each do |constants| %>
479 <tr class="top-aligned-row context-row">
480 <td class="context-item-name"><%= constants["name"] %></td>
482 <td class="context-item-value"><%= constants["value"] %></td>
483 <% if sections["desc"] then %>
484 <td width="3em"> </td>
485 <td class="context-item-desc"><%= constants["desc"] %></td>
488 <% end %><%# sections["constants"] %>
494 if sections["aliases"] then %>
495 <div id="aliases-list">
496 <h3 class="section-bar">External Aliases</h3>
498 <div class="name-list">
499 <table summary="aliases">
500 <% sections["aliases"].each do |aliases| %>
501 <tr class="top-aligned-row context-row">
502 <td class="context-item-name"><%= aliases["old_name"] %></td>
504 <td class="context-item-value"><%= aliases["new_name"] %></td>
506 <% if aliases["desc"] then %>
507 <tr class="top-aligned-row context-row">
509 <td colspan="2" class="context-item-desc"><%= aliases["desc"] %></td>
512 end %><%# sections["aliases"] %>
518 <% if sections["attributes"] then %>
519 <div id="attribute-list">
520 <h3 class="section-bar">Attributes</h3>
522 <div class="name-list">
524 <% sections["attributes"].each do |attribute| %>
525 <tr class="top-aligned-row context-row">
526 <td class="context-item-name"><%= attribute["name"] %></td>
527 <% if attribute["rw"] then %>
528 <td class="context-item-value"> [<%= attribute["rw"] %>] </td>
530 unless attribute["rw"] then %>
531 <td class="context-item-value"> </td>
533 <td class="context-item-desc"><%= attribute["a_desc"] %></td>
535 <% end %><%# sections["attributes"] %>
541 <!-- if method_list -->
542 <% if sections["method_list"] then %>
544 <% sections["method_list"].each do |method_list|
545 if method_list["methods"] then %>
546 <h3 class="section-bar"><%= method_list["type"] %> <%= method_list["category"] %> methods</h3>
548 <% method_list["methods"].each do |methods| %>
549 <div id="method-<%= methods["aref"] %>" class="method-detail">
550 <a name="<%= methods["aref"] %>"></a>
552 <div class="method-heading">
553 <% if methods["codeurl"] then %>
554 <a href="<%= methods["codeurl"] %>" target="Code" class="method-signature"
555 onclick="popupCode('<%= methods["codeurl"] %>');return false;">
557 if methods["sourcecode"] then %>
558 <a href="#<%= methods["aref"] %>" class="method-signature">
560 if methods["callseq"] then %>
561 <span class="method-name"><%= methods["callseq"] %></span>
563 unless methods["callseq"] then %>
564 <span class="method-name"><%= methods["name"] %></span><span class="method-args"><%= methods["params"] %></span>
566 if methods["codeurl"] then %>
569 if methods["sourcecode"] then %>
574 <div class="method-description">
575 <% if methods["m_desc"] then %>
576 <%= methods["m_desc"] %>
578 if methods["sourcecode"] then %>
579 <p><a class="source-toggle" href="#"
580 onclick="toggleCode('<%= methods["aref"] %>-source');return false;">[Source]</a></p>
581 <div class="method-source-code" id="<%= methods["aref"] %>-source">
583 <%= methods["sourcecode"] %>
590 <% end %><%# method_list["methods"] %><%
592 end %><%# sections["method_list"] %>
596 <% end %><%# values["sections"] %>
599 #####################################################################
600 ### B O D Y T E M P L A T E
601 #####################################################################
605 <%= template_include %> <!-- banner header -->
607 <div id="bodyContent">
615 #####################################################################
616 ### S O U R C E C O D E T E M P L A T E
617 #####################################################################
619 SRC_PAGE = XHTML_PREAMBLE + <<-EOF
622 <title><%= values["title"] %></title>
623 <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>" />
624 <link rel="stylesheet" href="<%= values["style_url"] %>" type="text/css" media="screen" />
626 <body class="standalone-code">
627 <pre><%= values["code"] %></pre>
633 #####################################################################
634 ### I N D E X F I L E T E M P L A T E S
635 #####################################################################
638 <%= template_include %>
641 FILE_INDEX = XHTML_PREAMBLE + <<-EOF
644 <%= values["list_title"] %>
647 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
649 <title><%= values["list_title"] %></title>
650 <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>" />
651 <link rel="stylesheet" href="<%= values["style_url"] %>" type="text/css" />
652 <base target="docwin" />
656 <h1 class="section-bar"><%= values["list_title"] %></h1>
657 <div id="index-entries">
658 <% values["entries"].each do |entries| %>
659 <a href="<%= entries["href"] %>"><%= entries["name"] %></a><br />
660 <% end %><%# values["entries"] %>
667 CLASS_INDEX = FILE_INDEX
668 METHOD_INDEX = FILE_INDEX
671 <?xml version="1.0" encoding="<%= values["charset"] %>"?>
673 PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
674 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
678 <%= values["title"] %>
681 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
683 <title><%= values["title"] %></title>
684 <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>" />
686 <frameset rows="20%, 80%">
687 <frameset cols="25%,35%,45%">
688 <frame src="fr_file_index.html" title="Files" name="Files" />
689 <frame src="fr_class_index.html" name="Classes" />
690 <frame src="fr_method_index.html" name="Methods" />
692 <frame src="<%= values["initial_page"] %>" name="docwin" />