Skip to content

Commit

Permalink
Include method arguments in documentation
Browse files Browse the repository at this point in the history
This makes it obvious what the code blocks refer to in the
documentation.

See #75, rubygems/rubygems#786
  • Loading branch information
drbrain committed Jan 23, 2014
1 parent a2753e9 commit 99f306b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions rdoc/generator/template/jekdoc/classpage.rhtml
Expand Up @@ -46,10 +46,22 @@ next: /command-reference

# <%= section.title %>
<% methods.sort_by(&:first).each do |name, method| %>
<% methods.sort_by(&:first).each do |name, method|
params =
if method.params then
params = method.params.delete '()'

if params.empty? then
''
else
params = params.split(',').map { |param| "`#{param.strip}`" }.join ', '
"(#{params})"
end
end
%>

<a id="<%= name %>"> </a>
## <%= name %>
## <%= name %><%= params %>
<% description = method.description.strip
description.gsub! %r%<a\shref=(["'])Specification\.html#.*?\1>(.*?)</a>%m, '\2'
description.gsub! %r%<a\shref=(["'])Specification\.html\1>Specification</a>%,
Expand Down

0 comments on commit 99f306b

Please sign in to comment.