1 # Based on Camping flipbook_rdoc by _why.
2 # http://code.whytheluckystiff.net/svn/camping/trunk/extras/flipbook_rdoc.rb
4 SITE_DIR = File.expand_path(File.dirname(__FILE__))
10 'allfiles' => gen_into_index(@files),
11 'allclasses' => gen_into_index(@classes),
12 "initial_page" => main_url,
13 'realtitle' => CGI.escapeHTML(@options.title),
14 'charset' => @options.charset
17 # the individual descriptions for files and classes
22 # this method is defined in the template file
23 write_extra_pages if defined? write_extra_pages
27 hsh = @files_and_classes.dup
31 hsh['root'] = item.path.split("/").map { ".." }[1..-1].join("/")
32 item.instance_variable_set("@values", hsh)
33 File.makedirs(File.dirname(op_file))
34 File.open(op_file, "w") { |file| item.write_on(file) }
39 def gen_into_index(list)
43 hsh['href'] = item.path
44 hsh['name'] = item.index_name
51 template = TemplatePage.new(RDoc::Page::INDEX)
52 File.open("index.html", "w") do |f|
53 values = @files_and_classes.dup
54 if @options.inline_source
55 values['inline_source'] = true
57 template.write_html_on(f, values)
59 ['logo.gif'].each do |img|
60 ipath = File.join(SITE_DIR, 'images', img)
70 ######################################################################
72 # The following is used for the -1 option
75 FONTS = "verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif"
77 STYLE = File.read(SITE_DIR + '/style.css')
85 <strong>Requires:</strong>
88 <a href="%aref%">%name%</a>
101 <tr><td>%name%</td><td>%rw%</td><td>%a_desc%</td></tr>
111 <li><a href="%aref%">%name%</a></li>
122 <h2 class="ruled">Methods</h2>
127 <span class="method-type" title="%type% %category% method">%type% %category%</span>
129 <strong><a name="%aref%" href="#%aref%" title="Permalink to %callseq%">%callseq%</a></strong>
132 <strong><a name="%aref%" href="#%aref%" title="Permalink to %type% %category% method: %name%">%name%%params%</a></strong>
141 <div class="sourcecode">
142 <p class="source-link">[ <a href="javascript:toggleSource('%aref%_source')" id="l_%aref%_source">show source</a> ]</p>
143 <div id="%aref%_source" class="dyn-source">
157 ############################################################################
161 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
166 %realtitle% » %title%
172 <meta http-equiv="Content-Type" content="text/html; charset=%charset%" />
173 <link rel="stylesheet" href="%style_url%" type="text/css" media="screen" />
174 <script language="JavaScript" type="text/javascript">
177 function toggleSource( id )
182 if( document.getElementById )
184 elem = document.getElementById( id )
185 link = document.getElementById( "l_" + id )
187 else if ( document.all )
189 elem = eval( "document.all." + id )
190 link = eval( "document.all.l_" + id )
195 if( elem.style.display == "block" )
197 elem.style.display = "none"
198 link.innerHTML = "show source"
202 elem.style.display = "block"
203 link.innerHTML = "hide source"
207 function openCode( url )
209 window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
216 <li><a href="/thin/">about</a></li>
217 <li><a href="/thin/download/">download</a></li>
218 <li><a href="/thin/usage/">usage</a></li>
219 <li><a href="/thin/doc/">doc</a></li>
220 <li><a href="http://groups.google.com/group/thin-ruby/">community</a></li>
226 <li><a href="%root%/%href%" value="%title%">%name%</a></li>
234 <li><a href="%root%/%href%" title="%title%">%name%</a></li>
241 <a href="/thin/" title="Home">
242 <img id="logo" src="%root%/logo.gif" />
244 <h2 id="tag_line">A fast and very simple Ruby web server</h2>
256 © <a href="http://macournoyer.com">Marc-André Cournoyer</a>
262 ###############################################################################
264 FILE_PAGE = <<_FILE_PAGE_
265 <div id="%full_path%" class="page_shade">
268 <div class="path">%full_path% / %dtm_modified%</div>
275 ###################################################################
278 <div id="%full_name%" class="page_shade">
281 <h3>%classmod% %full_name% < HREF:par_url:parent:</h3>
284 <h3>%classmod% %full_name%</h3>
288 <span class="path">(in files
290 HREF:full_path_url:full_path:
294 } + CONTENTS_XML + %{
299 ###################################################################
303 <div class="tablesubsubtitle">Included modules</div><br>
304 <div class="name-list">
306 <span class="method-name">HREF:aref:name:</span>
314 <table cellpadding=5 width="100%">
315 <tr><td class="tablesubtitle">%type% %category% methods</td></tr>
318 <table width="100%" cellspacing = 0 cellpadding=5 border=0>
319 <tr><td class="methodtitle">
325 <b>%name%</b>%params%
328 <a href="%codeurl%" target="source" class="srclink">src</a>
333 <div class="description">
339 This method is also aliased as
341 <a href="%aref%">%name%</a>
346 <div class="sourcecode">
347 <p class="source-link">[ <a href="javascript:toggleSource('%aref%_source')" id="l_%aref%_source">show source</a> ]</p>
348 <div id="%aref%_source" class="dyn-source">
362 ########################## Index ################################
371 <meta http-equiv="Content-Type" content="text/html; charset=%charset%">
375 background-color: #ddddff;
376 font-family: #{FONTS};
396 <base target="docwin">
399 <div class="banner">%list_title%</div>
401 <a href="%href%">%name%</a><br>
406 CLASS_INDEX = FILE_INDEX
407 METHOD_INDEX = FILE_INDEX
412 <META HTTP-EQUIV="refresh" content="0;URL=%initial_page%">
413 <TITLE>%realtitle%</TITLE>
416 Click <a href="%initial_page%">here</a> to open the Thin docs.