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 visbility of each method's source with each click on the '[source]'
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 view
20 # a copy of this license, visit http://creativecommons.org/licenses/by/1.0/ or
21 # send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California
24 module RDoc::Generator::HTML::FRAMELESS
28 FONTS = "Verdana,Arial,Helvetica,sans-serif"
32 font-family: #{FONTS};
43 background: transparent;
57 text-decoration: none;
60 :link:hover, :visited:hover {
65 /* Override the base stylesheet's Anchor inside a table cell */
66 td > :link, td > :visited {
67 background: transparent;
69 text-decoration: none;
72 /* and inside a section title */
73 .section-title > :link, .section-title > :visited {
74 background: transparent;
76 text-decoration: none;
79 /* === Structural elements =================================== */
88 .index :link, .index :visited {
99 #classHeader, #fileHeader {
102 padding: 0.5em 1.5em 0.5em 1.5em;
105 border-bottom: 3px solid #006;
108 #classHeader :link, #fileHeader :link,
109 #classHeader :visited, #fileHeader :visited {
114 #classHeader td, #fileHeader td {
127 .class-name-in-header {
133 padding: 0 1.5em 0 1.5em;
137 padding: 0.5em 1.5em;
139 border: 1px dotted #999;
142 #description h1, #description h2, #description h3,
143 #description h4, #description h5, #description h6 {
145 background: transparent;
151 font: 0.75em sans-serif;
157 /* === Classes =================================== */
177 border-bottom: 1px solid #999;
187 border: 1px solid #999;
194 .bottom-aligned-row {
195 vertical-align: bottom
198 /* --- Context section classes ----------------------- */
203 font-family: monospace;
208 .context-item-value {
218 /* --- Method classes -------------------------- */
225 border: 1px dotted #ccc;
231 border-bottom: 1px solid #666;
232 padding: 0.2em 0.5em 0 0.5em;
248 .method-description {
249 padding: 0 0.5em 0 0.5em;
252 /* --- Source code sections -------------------- */
254 :link.source-toggle, :visited.source-toggle {
258 div.method-source-code {
263 border: 1px dashed #999;
267 div.method-source-code pre {
272 /* --- Ruby keyword styles --------------------- */
282 background: transparent;
287 background: transparent;
292 background: transparent;
297 background: transparent;
302 background: transparent;
307 background: transparent;
313 background: transparent;
318 background: transparent;
323 background: transparent;
331 XHTML_PREAMBLE = <<-EOF
332 <?xml version="1.0" encoding="<%= values["charset"] %>"?>
334 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
335 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
338 HEADER = XHTML_PREAMBLE + <<-EOF
339 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
341 <title><%= values["title"] %></title>
342 <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>" />
343 <meta http-equiv="Content-Script-Type" content="text/javascript" />
344 <link rel="stylesheet" href="<%= values["style_url"] %>" type="text/css" media="screen" />
345 <script type="text/javascript">
348 function popupCode( url ) {
349 window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
352 function toggleCode( id ) {
353 if ( document.getElementById )
354 elem = document.getElementById( id );
355 else if ( document.all )
356 elem = eval( "document.all." + id );
360 elemStyle = elem.style;
362 if ( elemStyle.display != "block" ) {
363 elemStyle.display = "block"
365 elemStyle.display = "none"
371 // Make codeblocks hidden by default
372 document.writeln( "<style type=\\"text/css\\">div.method-source-code { display: none }</style>" )
382 # Context content template
391 <div id="popupmenu" class="index">
393 <li class="index-entries section-bar">Classes
395 <% values["class_list"].each do |klass| %>
396 <li><a href="<%= klass["href"] %>"><%= klass["name"] %></a>
401 <li class="index-entries section-bar">Methods
403 <% values["method_list"].each do |file| %>
404 <li><a href="<%= file["href"] %>"><%= file["name"] %></a>
409 <li class="index-entries section-bar">Files
411 <% values["file_list"].each do |file| %>
412 <li><a href="<%= file["href"] %>"><%= file["name"] %></a>
424 # File page header template
427 <div id="fileHeader">
428 <h1><%= values["short_name"] %></h1>
430 <table class="header-table">
431 <tr class="top-aligned-row">
432 <td><strong>Path:</strong></td>
433 <td><%= values["full_path"] %>
434 <% if values["cvsurl"] then %>
435 (<a href="<%= values["cvsurl"] %>"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
440 <tr class="top-aligned-row">
441 <td><strong>Last Update:</strong></td>
442 <td><%= values["dtm_modified"] %></td>
449 # Class page header template
452 <div id="classHeader">
453 <table class="header-table">
454 <tr class="top-aligned-row">
455 <td><strong><%= values["classmod"] %></strong></td>
456 <td class="class-name-in-header"><%= values["full_name"] %></td>
459 <tr class="top-aligned-row">
460 <td><strong>In:</strong></td>
462 <% values["infiles"].each do |infiles| %>
463 <% if infiles["full_path_url"] then %>
464 <a href="<%= infiles["full_path_url"] %>">
466 <%= infiles["full_path"] %>
467 <% if infiles["full_path_url"] then %>
470 <% if infiles["cvsurl"] then %>
471 (<a href="<%= infiles["cvsurl"] %>"><acronym title="Concurrent Versioning System">CVS</acronym></a>)
474 <% end %><%# values["infiles"] %>
478 <% if values["parent"] then %>
479 <tr class="top-aligned-row">
480 <td><strong>Parent:</strong></td>
482 <% if values["par_url"] then %>
483 <a href="<%= values["par_url"] %>">
485 <%= values["parent"] %>
486 <% if values["par_url"] then %>
497 # Method list template
501 <div id="contextContent">
502 <% if values["diagram"] then %>
504 <%= values["diagram"] %>
508 <% if values["description"] then %>
509 <div id="description">
510 <%= values["description"] %>
514 <% if values["requires"] then %>
515 <div id="requires-list">
516 <h3 class="section-bar">Required files</h3>
518 <div class="name-list">
519 <% values["requires"].each do |requires| %>
520 <%= href requires["aref"], requires["name"] %>
521 <% end %><%# values["requires"] %>
526 <% if values["toc"] then %>
527 <div id="contents-list">
528 <h3 class="section-bar">Contents</h3>
530 <% values["toc"].each do |toc| %>
531 <li><a href="#<%= values["href"] %>"><%= values["secname"] %></a></li>
532 <% end %><%# values["toc"] %>
537 <% if values["methods"] then %>
538 <div id="method-list">
539 <h3 class="section-bar">Methods</h3>
541 <div class="name-list">
542 <% values["methods"].each do |methods| %>
543 <%= href methods["aref"], methods["name"] %>
544 <% end %><%# values["methods"] %>
553 <% if values["includes"] then %>
555 <h3 class="section-bar">Included Modules</h3>
557 <div id="includes-list">
558 <% values["includes"].each do |includes| %>
559 <span class="include-name"><%= href includes["aref"], includes["name"] %></span>
560 <% end %><%# values["includes"] %>
565 <% values["sections"].each do |sections| %>
567 <% if sections["sectitle"] then %>
568 <h2 class="section-title"><a name="<%= sections["secsequence"] %>"><%= sections["sectitle"] %></a></h2>
569 <% if sections["seccomment"] then %>
570 <div class="section-comment">
571 <%= sections["seccomment"] %>
576 <% if values["classlist"] then %>
577 <div id="class-list">
578 <h3 class="section-bar">Classes and Modules</h3>
580 <%= values["classlist"] %>
584 <% if values["constants"] then %>
585 <div id="constants-list">
586 <h3 class="section-bar">Constants</h3>
588 <div class="name-list">
589 <table summary="Constants">
590 <% values["constants"].each do |constants| %>
591 <tr class="top-aligned-row context-row">
592 <td class="context-item-name"><%= constants["name"] %></td>
594 <td class="context-item-value"><%= constants["value"] %></td>
595 <% if values["desc"] then %>
596 <td width="3em"> </td>
597 <td class="context-item-desc"><%= constants["desc"] %></td>
600 <% end %><%# values["constants"] %>
606 <% if values["aliases"] then %>
607 <div id="aliases-list">
608 <h3 class="section-bar">External Aliases</h3>
610 <div class="name-list">
611 <table summary="aliases">
612 <% values["aliases"].each do |aliases| $stderr.puts({ :aliases => aliases }.inspect) %>
613 <tr class="top-aligned-row context-row">
614 <td class="context-item-name"><%= values["old_name"] %></td>
616 <td class="context-item-value"><%= values["new_name"] %></td>
618 <% if values["desc"] then %>
619 <tr class="top-aligned-row context-row">
621 <td colspan="2" class="context-item-desc"><%= values["desc"] %></td>
624 <% end %><%# values["aliases"] %>
631 <% if values["attributes"] then %>
632 <div id="attribute-list">
633 <h3 class="section-bar">Attributes</h3>
635 <div class="name-list">
637 <% values["attributes"].each do |attributes| $stderr.puts({ :attributes => attributes }.inspect) %>
638 <tr class="top-aligned-row context-row">
639 <td class="context-item-name"><%= values["name"] %></td>
640 <% if values["rw"] then %>
641 <td class="context-item-value"> [<%= values["rw"] %>] </td>
643 <% unless values["rw"] then %>
644 <td class="context-item-value"> </td>
646 <td class="context-item-desc"><%= values["a_desc"] %></td>
648 <% end %><%# values["attributes"] %>
654 <!-- if method_list -->
655 <% if sections["method_list"] then %>
657 <% sections["method_list"].each do |method_list| %>
658 <% if method_list["methods"] then %>
659 <h3 class="section-bar"><%= method_list["type"] %> <%= method_list["category"] %> methods</h3>
661 <% method_list["methods"].each do |methods| %>
662 <div id="method-<%= methods["aref"] %>" class="method-detail">
663 <a name="<%= methods["aref"] %>"></a>
665 <div class="method-heading">
666 <% if methods["codeurl"] then %>
667 <a href="<%= methods["codeurl"] %>" target="Code" class="method-signature"
668 onclick="popupCode('<%= methods["codeurl"] %>');return false;">
670 <% if methods["sourcecode"] then %>
671 <a href="#<%= methods["aref"] %>" class="method-signature">
673 <% if methods["callseq"] then %>
674 <span class="method-name"><%= methods["callseq"] %></span>
676 <% unless methods["callseq"] then %>
677 <span class="method-name"><%= methods["name"] %></span><span class="method-args"><%= methods["params"] %></span>
679 <% if methods["codeurl"] then %>
682 <% if methods["sourcecode"] then %>
687 <div class="method-description">
688 <% if methods["m_desc"] then %>
689 <%= methods["m_desc"] %>
691 <% if methods["sourcecode"] then %>
692 <p><a class="source-toggle" href="#"
693 onclick="toggleCode('<%= methods["aref"] %>-source');return false;">[Source]</a></p>
694 <div class="method-source-code" id="<%= methods["aref"] %>-source">
696 <%= methods["sourcecode"] %>
703 <% end %><%# method_list["methods"] %>
705 <% end %><%# sections["method_list"] %>
709 <% end %><%# values["sections"] %>
717 <%= template_include %> <!-- banner header -->
719 <div id="bodyContent">
728 # Source code template
730 SRC_PAGE = XHTML_PREAMBLE + <<-EOF
733 <title><%= values["title"] %></title>
734 <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>" />
735 <link rel="stylesheet" href="<%= values["style_url"] %>" type="text/css" media="screen" />
737 <body class="standalone-code">
738 <pre><%= values["code"] %></pre>
744 # Index file templates
747 <%= template_include %>
750 FILE_INDEX = XHTML_PREAMBLE + <<-EOF
751 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
753 <title><%= values["list_title"] %></title>
754 <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>" />
755 <link rel="stylesheet" href="<%= values["style_url"] %>" type="text/css" />
756 <base target="docwin" />
760 <h1 class="section-bar"><%= values["list_title"] %></h1>
761 <div class="index-entries">
762 <% values["entries"].each do |entries| %>
763 <a href="<%= entries["href"] %>"><%= entries["name"] %></a><br />
764 <% end %><%# values["entries"] %>
771 CLASS_INDEX = FILE_INDEX
772 METHOD_INDEX = FILE_INDEX
775 <?xml version="1.0" encoding="<%= values["charset"] %>"?>
777 PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
778 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
779 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
781 <title><%= values["title"] %></title>
782 <meta http-equiv="Content-Type" content="text/html; charset=<%= values["charset"] %>" />
784 <frameset rows="20%, 80%">
785 <frameset cols="45%,55%">
786 <frame src="fr_class_index.html" name="Classes" />
787 <frame src="fr_method_index.html" name="Methods" />
789 <frame src="<%= values["initial_page"] %>" name="docwin" />