Skip to content

Commit

Permalink
escaping stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Apr 12, 2010
1 parent 375911d commit 37b3d60
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.rdoc
@@ -1,6 +1,6 @@
= paddle = paddle


* FIX (url) * http://tenderlovemaking.com/


== DESCRIPTION: == DESCRIPTION:


Expand Down
8 changes: 7 additions & 1 deletion lib/rdoc/generator/paddle.rb
Expand Up @@ -28,7 +28,9 @@ def initialize options


def generate top_levels def generate top_levels
@files = 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)) FileUtils.mkdir_p(File.join(@odir, class_dir))


Expand All @@ -55,6 +57,10 @@ def identifier
end end


private private
def h string
string.strip.gsub(/<pre>\s*<\/pre>/, '').gsub(/&/, '&amp;').gsub(/<</, '&lt;&lt;')
end

def copy_images def copy_images
imgs = File.join @odir, 'images' imgs = File.join @odir, 'images'
FileUtils.mkdir_p imgs FileUtils.mkdir_p imgs
Expand Down
21 changes: 12 additions & 9 deletions lib/templates/classfile.html.erb
Expand Up @@ -17,6 +17,9 @@
margin-bottom: 0.5em; margin-bottom: 0.5em;
margin-left: 1.5em; margin-left: 1.5em;
} }
dt.name {
font-weight: bold;
}
</style> </style>
</head> </head>
<body> <body>
Expand Down Expand Up @@ -49,7 +52,7 @@
</h1> </h1>
<% if klass.description && !klass.description.empty? %> <% if klass.description && !klass.description.empty? %>
<div id="description" class="alt"> <div id="description" class="alt">
<%= klass.description.strip.gsub(/<pre>\s*<\/pre>/, '') %> <%= h klass.description %>
</div> </div>
<% end %> <% end %>


Expand All @@ -59,9 +62,9 @@
<% klass.constants.sort_by { |x| x.name }.each do |const| %> <% klass.constants.sort_by { |x| x.name }.each do |const| %>
<dl> <dl>
<dt class="name"> <dt class="name">
<%= const.name %> <%= h const.name %>
</dt> </dt>
<dd class="explanation"><%= const.description %></dd> <dd class="explanation"><%= h const.description %></dd>
</dl> </dl>
<% end %> <% end %>
<% end %> <% end %>
Expand All @@ -72,10 +75,10 @@
<% klass.attributes.sort_by { |x| x.name }.each do |attr| %> <% klass.attributes.sort_by { |x| x.name }.each do |attr| %>
<dl> <dl>
<dt class="name"> <dt class="name">
<%= attr.name %> <%= h attr.name %>
<span class="optional"><%= attr.rw %></span> <span class="optional"><%= attr.rw %></span>
</dt> </dt>
<dd class="explanation"><%= attr.description.strip %></dd> <dd class="explanation"><%= h attr.description %></dd>
</dl> </dl>
<% end %> <% end %>
<% end %> <% end %>
Expand All @@ -87,9 +90,9 @@
<dl class="method"> <dl class="method">
<dt class="name"> <dt class="name">
<a name="<%= method.aref %>" ></a> <a name="<%= method.aref %>" ></a>
<%= method.name %><%= method.params %> <%= h method.name %><%= h method.params %>
</dt> </dt>
<dd class="explanation"><%= method.description %></dd> <dd class="explanation"><%= h method.description %></dd>
</dl> </dl>
<% end %> <% end %>
<% end %> <% end %>
Expand All @@ -101,9 +104,9 @@
<dl class="method"> <dl class="method">
<dt class="name"> <dt class="name">
<a name="<%= method.aref %>" ></a> <a name="<%= method.aref %>" ></a>
<%= method.name %><%= method.params %> <%= h method.name %><%= h method.params %>
</dt> </dt>
<dd class="explanation"><%= method.description %></dd> <dd class="explanation"><%= h method.description %></dd>
</dl> </dl>
<% end %> <% end %>
<% end %> <% end %>
Expand Down

0 comments on commit 37b3d60

Please sign in to comment.