Skip to content
Browse files

escaping stuff

  • Loading branch information...
1 parent 375911d commit 37b3d60767c1ddcb6f1f57b0d3c6b4294f309c10 @tenderlove committed
Showing with 20 additions and 11 deletions.
  1. +1 −1 README.rdoc
  2. +7 −1 lib/rdoc/generator/paddle.rb
  3. +12 −9 lib/templates/classfile.html.erb
View
2 README.rdoc
@@ -1,6 +1,6 @@
= paddle
-* FIX (url)
+* http://tenderlovemaking.com/
== DESCRIPTION:
View
8 lib/rdoc/generator/paddle.rb
@@ -28,7 +28,9 @@ def initialize options
def generate top_levels
@files = top_levels
- @classes = RDoc::TopLevel.all_classes_and_modules
+ @classes = RDoc::TopLevel.all_classes_and_modules.reject { |x|
+ x.name =~ /[<>]/
+ }
FileUtils.mkdir_p(File.join(@odir, class_dir))
@@ -55,6 +57,10 @@ def identifier
end
private
+ def h string
+ string.strip.gsub(/<pre>\s*<\/pre>/, '').gsub(/&/, '&amp;').gsub(/<</, '&lt;&lt;')
+ end
+
def copy_images
imgs = File.join @odir, 'images'
FileUtils.mkdir_p imgs
View
21 lib/templates/classfile.html.erb
@@ -17,6 +17,9 @@
margin-bottom: 0.5em;
margin-left: 1.5em;
}
+ dt.name {
+ font-weight: bold;
+ }
</style>
</head>
<body>
@@ -49,7 +52,7 @@
</h1>
<% if klass.description && !klass.description.empty? %>
<div id="description" class="alt">
- <%= klass.description.strip.gsub(/<pre>\s*<\/pre>/, '') %>
+ <%= h klass.description %>
</div>
<% end %>
@@ -59,9 +62,9 @@
<% klass.constants.sort_by { |x| x.name }.each do |const| %>
<dl>
<dt class="name">
- <%= const.name %>
+ <%= h const.name %>
</dt>
- <dd class="explanation"><%= const.description %></dd>
+ <dd class="explanation"><%= h const.description %></dd>
</dl>
<% end %>
<% end %>
@@ -72,10 +75,10 @@
<% klass.attributes.sort_by { |x| x.name }.each do |attr| %>
<dl>
<dt class="name">
- <%= attr.name %>
+ <%= h attr.name %>
<span class="optional"><%= attr.rw %></span>
</dt>
- <dd class="explanation"><%= attr.description.strip %></dd>
+ <dd class="explanation"><%= h attr.description %></dd>
</dl>
<% end %>
<% end %>
@@ -87,9 +90,9 @@
<dl class="method">
<dt class="name">
<a name="<%= method.aref %>" ></a>
- <%= method.name %><%= method.params %>
+ <%= h method.name %><%= h method.params %>
</dt>
- <dd class="explanation"><%= method.description %></dd>
+ <dd class="explanation"><%= h method.description %></dd>
</dl>
<% end %>
<% end %>
@@ -101,9 +104,9 @@
<dl class="method">
<dt class="name">
<a name="<%= method.aref %>" ></a>
- <%= method.name %><%= method.params %>
+ <%= h method.name %><%= h method.params %>
</dt>
- <dd class="explanation"><%= method.description %></dd>
+ <dd class="explanation"><%= h method.description %></dd>
</dl>
<% end %>
<% end %>

0 comments on commit 37b3d60

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