Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

adding methods and style

  • Loading branch information...
commit 7d11fbf70092c45f5913a7f26604c0f0da146812 1 parent 1a4f628
Aaron Patterson authored
3  lib/paddle.rb
... ... @@ -1,5 +1,8 @@
1 1 ###
2 2 # Paddle is an RDoc template that will emit iPad compatible books!
3 3 module Paddle
  4 + # Test Attribute
  5 + attr_accessor :foo
  6 +
4 7 VERSION = '1.0.0'
5 8 end
12 lib/rdoc/generator/paddle.rb
@@ -95,6 +95,18 @@ def emit_title
95 95
96 96 def emit_classfiles
97 97 @classes.each do |klass|
  98 + klass_methods = []
  99 + instance_methods = []
  100 +
  101 + klass.method_list.each do |method|
  102 + next if 'private' == method.visibility.to_s
  103 + if method.type == 'class'
  104 + klass_methods << method
  105 + else
  106 + instance_methods << method
  107 + end
  108 + end
  109 +
98 110 template = ERB.new File.read(File.join(TEMPLATE_DIR, 'classfile.html.erb')),
99 111 nil, '<>'
100 112
73 lib/templates/classfile.html.erb
@@ -5,6 +5,19 @@
5 5 <title>
6 6 <%= klass.name %>
7 7 </title>
  8 + <style>
  9 + dt, dd {
  10 + margin: 0;
  11 + }
  12 + dt.name {
  13 + float: left;
  14 + }
  15 + dd.explanation {
  16 + clear: both;
  17 + margin-bottom: 0.5em;
  18 + margin-left: 1.5em;
  19 + }
  20 + </style>
8 21 </head>
9 22 <body>
10 23 <h1>
@@ -35,7 +48,65 @@
35 48 <% end %>
36 49 </h1>
37 50 <% if klass.description && !klass.description.empty? %>
38   - <%= klass.description %>
  51 + <div id="description" class="alt">
  52 + <%= klass.description.strip.gsub(/<pre>\s*<\/pre>/, '') %>
  53 + </div>
39 54 <% end %>
  55 +
  56 + <!-- Constants -->
  57 + <% unless klass.constants.empty? %>
  58 + <h3>Constants</h3>
  59 + <% klass.constants.sort_by { |x| x.name }.each do |const| %>
  60 + <dl>
  61 + <dt class="name">
  62 + <%= const.name %>
  63 + </dt>
  64 + <dd class="explanation"><%= const.description %></dd>
  65 + </dl>
  66 + <% end %>
  67 + <% end %>
  68 +
  69 + <!-- Attributes -->
  70 + <% unless klass.attributes.empty? %>
  71 + <h3>Attributes</h3>
  72 + <% klass.attributes.sort_by { |x| x.name }.each do |attr| %>
  73 + <dl>
  74 + <dt class="name">
  75 + <%= attr.name %>
  76 + <span class="optional"><%= attr.rw %></span>
  77 + </dt>
  78 + <dd class="explanation"><%= attr.description.strip %></dd>
  79 + </dl>
  80 + <% end %>
  81 + <% end %>
  82 +
  83 + <!-- Class Methods -->
  84 + <% unless klass_methods.empty? %>
  85 + <h3>Public Class Methods</h3>
  86 + <% klass_methods.each do |method| %>
  87 + <dl class="method">
  88 + <dt class="name">
  89 + <a name="<%= method.aref %>" ></a>
  90 + <%= method.name %><%= method.params %>
  91 + </dt>
  92 + <dd class="explanation"><%= method.description %></dd>
  93 + </dl>
  94 + <% end %>
  95 + <% end %>
  96 +
  97 + <!-- Instance Methods -->
  98 + <% unless instance_methods.empty? %>
  99 + <h3>Public Instance Methods</h3>
  100 + <% instance_methods.each do |method| %>
  101 + <dl class="method">
  102 + <dt class="name">
  103 + <a name="<%= method.aref %>" ></a>
  104 + <%= method.name %><%= method.params %>
  105 + </dt>
  106 + <dd class="explanation"><%= method.description %></dd>
  107 + </dl>
  108 + <% end %>
  109 + <% end %>
  110 +
40 111 </body>
41 112 </html>
2  lib/templates/toc.ncx.erb
@@ -24,7 +24,7 @@
24 24 </navLabel>
25 25 <content src="doc/title.html"/>
26 26 </navPoint>
27   - <% @classes.each_with_index do |klass, i| %>
  27 + <% @classes.sort_by { |x| x.full_name }.each_with_index do |klass, i| %>
28 28 <navPoint id="navPoint-<%= i + 3 %>" playOrder="<%= i + 3 %>">
29 29 <navLabel>
30 30 <text><%= klass.full_name %></text>

0 comments on commit 7d11fbf

Please sign in to comment.
Something went wrong with that request. Please try again.