lib/templates/classfile.md.erb in rdoc-markdown-0.2.1 vs lib/templates/classfile.md.erb in rdoc-markdown-0.3
- old
+ new
@@ -1,23 +1,31 @@
-# <% if klass.type == 'class' %><%= klass.type.capitalize %>: **<%= klass.full_name %>**<% if klass.superclass %> < <% end %><% unless String === klass.superclass %><%= klass.superclass&.name %> <% else %> <%= klass.superclass %> <% end %> <% else %> <%= klass.type.capitalize %>: <%= klass&.name %> <% end %>
+# <%= klass.type %> <%= klass.full_name.strip %> [](#<%= klass.aref.strip %>) [](#top)
<%= h klass.description %>
-<% unless klass.constants.empty? %>
-| Constants | Description |
-| ------------- | ------------- |
-<% klass.constants.sort_by { |x| x.name }.each do |const| %> |**[<%= const.name %>](#<%= ActiveSupport::Inflector.parameterize const.name%>)** | <%= h const.description %> |
-<% end %><% end %>
-<% unless klass.attributes.empty? %>
+<% klass.each_section do |section, constants, attributes| %>
+ <% if section.title %>## <%= section.title.strip %> <% end %>
+ <% if section.comment %> <%=h section.description %><% end%>
+ <% unless klass.constants.empty? %>
+## Constants
+ <% klass.constants.each do |const| %>
+### <%= const.name.strip %>[](#<%= const.name.strip %>)
+<% if const.comment %> <%= h const.description %> <%else%> (Not documented) <% end %>
+ <% end %>
+ <% end %>
+ <% unless attributes&.empty? %>
## Attributes
-<% klass.attributes.sort_by { |x| x.name }.each do |attr| %>
- [[**<%= attr.rw %>**] <%= attr.name %>](#<%= attr.aref %>)
-<% end %><% end %>
-<% unless klass_methods.empty? %>
-## Public Class Methods
-***
-<% klass_methods.each do |method| %>### [<%= method.name %><%= method.params %>](#<%= method.aref %>)
-
-<%= h method.description %><% end %><% end %>
-<% unless instance_methods.empty? %>
-## Public Instance Methods
-<% instance_methods.each do |method| %>### [<%= method.name %><%= method.params %>](#<%= method.aref %>)
-
-<%= h method.description %><% end %><% end %>
+ <% attributes.each do |attr| %>
+### <%= attr.rw %><%=h attr.name.strip %>[](#<%= attr.aref.strip %>)
+<% if attr.comment %> <%= h attr.description %> <%else%> (Not documented) <% end %>
+ <% end %>
+ <% end %>
+ <% klass.methods_by_type(section).each do |type, visibilities| %>
+ <% next if visibilities.empty? %>
+ <% visibilities.each do |visibility, methods| %>
+ <% next if methods.empty? %>
+## <%= visibility.capitalize %> <%= type.capitalize %> Methods
+ <% methods.each do |method|%>
+### <%= method.name.strip %><%= method.param_seq.strip %> [](#<%= method.aref.strip %>)
+<% if method.comment %> <%= h method.description %> <% else %> (Not documented) <%end%>
+ <% end %>
+ <% end %>
+ <% end %>
+<% end %>