Permalink
Browse files

basic layouts are working

  • Loading branch information...
1 parent d2def88 commit ee2c65e7bbe0f41541fa907970b668c3b9a86c81 @tenderlove committed Jul 14, 2010
Showing with 73 additions and 56 deletions.
  1. +1 −0 Manifest.txt
  2. +8 −55 lib/app/views/files/show.html.erb
  3. +55 −0 lib/app/views/layouts/application.html.erb
  4. +9 −1 lib/rdoc/generator/horo.rb
View
1 Manifest.txt
@@ -7,6 +7,7 @@ lib/app/views/classes/index.html.erb
lib/app/views/classes/show.html.erb
lib/app/views/files/index.html.erb
lib/app/views/files/show.html.erb
+lib/app/views/layouts/application.html.erb
lib/app/views/methods/index.html.erb
lib/app/views/root/index.html.erb
lib/horo.rb
View
63 lib/app/views/files/show.html.erb
@@ -1,55 +1,3 @@
-<?xml version="1.0" encoding="<%= charset %>"?>
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
- <head>
- <title>File: <%= file.base_name %></title>
- <meta http-equiv="Content-Type" content="text/html; charset=<%= charset %>" />
- <link rel="stylesheet" href="<%= style_url %>" type="text/css" media="screen" />
-
- <script language="JavaScript" type="text/javascript">
- // <![CDATA[
-
- function toggleSource( id )
- {
- var elem
- var link
-
- if( document.getElementById )
- {
- elem = document.getElementById( id )
- link = document.getElementById( "l_" + id )
- }
- else if ( document.all )
- {
- elem = eval( "document.all." + id )
- link = eval( "document.all.l_" + id )
- }
- else
- return false;
-
- if( elem.style.display == "block" )
- {
- elem.style.display = "none"
- link.innerHTML = "show source"
- }
- else
- {
- elem.style.display = "block"
- link.innerHTML = "hide source"
- }
- }
-
- function openCode( url )
- {
- window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
- }
- // ]]>
- </script>
- </head>
-
- <body>
<table border='0' cellpadding='0' cellspacing='0' width="100%" class='banner'>
<tr><td>
<table width="100%" border='0' cellpadding='0' cellspacing='0'><tr>
@@ -69,6 +17,11 @@
</td></tr>
</table>
</td></tr>
-</table>
- </body>
-</html>
+</table><br />
+ <div id="bodyContent">
+ <div id="content">
+<% if file.description %>
+ <div class="description"><%= file.description %></div>
+<% end %>
+ </div>
+</div>
View
55 lib/app/views/layouts/application.html.erb
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="<%= charset %>"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+ <head>
+ <title>File: <%= file.base_name %></title>
+ <meta http-equiv="Content-Type" content="text/html; charset=<%= charset %>" />
+ <link rel="stylesheet" href="<%= style_url %>" type="text/css" media="screen" />
+
+ <script language="JavaScript" type="text/javascript">
+ // <![CDATA[
+
+ function toggleSource( id )
+ {
+ var elem
+ var link
+
+ if( document.getElementById )
+ {
+ elem = document.getElementById( id )
+ link = document.getElementById( "l_" + id )
+ }
+ else if ( document.all )
+ {
+ elem = eval( "document.all." + id )
+ link = eval( "document.all.l_" + id )
+ }
+ else
+ return false;
+
+ if( elem.style.display == "block" )
+ {
+ elem.style.display = "none"
+ link.innerHTML = "show source"
+ }
+ else
+ {
+ elem.style.display = "block"
+ link.innerHTML = "hide source"
+ }
+ }
+
+ function openCode( url )
+ {
+ window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
+ }
+ // ]]>
+ </script>
+ </head>
+
+ <body>
+ <%= yield %>
+ </body>
+</html>
View
10 lib/rdoc/generator/horo.rb
@@ -37,6 +37,11 @@ def generate top_levels
end
private
+ def layout name, ctx, &block
+ filename = File.join @app_root, 'app', 'views', 'layouts', name
+ ctx.eval(File.read(filename), filename, &block)
+ end
+
def write_files
filename = File.join @app_root, 'app', 'views', 'files', 'show.html.erb'
ctx = TemplateContext.new @options, @files
@@ -56,7 +61,10 @@ def write_files
ctx.style_url = File.join relative_path, 'rdoc-style.css'
File.open(file_path, 'wb') do |fh|
- fh.write ctx.eval File.read(filename), filename
+ src = layout 'application.html.erb', ctx do
+ ctx.eval File.read(filename), filename
+ end
+ fh.write src
end
end
end

0 comments on commit ee2c65e

Please sign in to comment.