Skip to content

Commit

Permalink
Add new RDoc feature: Render mixed-in methods and constants
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinem committed Oct 18, 2024
1 parent a2679f7 commit 0aa9ba1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/rdoc/generator/template/rorvswild/class.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@
<%- constants.each do |const| -%>
<dt id="<%= const.name %>"><%= const.name %></dt>
<%- if const.comment then -%>
<dd><%= const.description.strip %></dd>
<dd>
<%- if const.mixin_from then -%>
<div class="mixin-from">
Included from <a href="<%= klass.aref_to(const.mixin_from.path)%>"><%= const.mixin_from.full_name %></a>
</div>
<%- end -%>
<%= const.description.strip %>
</dd>
<%- else -%>
<dd class="missing-docs">(Not documented)</dd>
<%- end -%>
Expand All @@ -54,6 +61,11 @@
</div>

<div class="method-description">
<%- if attrib.mixin_from then -%>
<div class="mixin-from">
<%= attrib.singleton ? "Extended" : "Included" %> from <a href="<%= klass.aref_to(attrib.mixin_from.path)%>"><%= attrib.mixin_from.full_name %></a>
</div>
<%- end -%>
<%- if attrib.comment then -%>
<%= attrib.description.strip %>
<%- else -%>
Expand Down Expand Up @@ -107,6 +119,11 @@

<%- unless method.skip_description? then -%>
<div class="method-description">
<%- if method.mixin_from then -%>
<div class="mixin-from">
<%= method.singleton ? "Extended" : "Included" %> from <a href="<%= klass.aref_to(method.mixin_from.path)%>"><%= method.mixin_from.full_name %></a>
</div>
<%- end -%>
<%- if method.comment then -%>
<%= method.description.strip %>
<%- else -%>
Expand Down
6 changes: 6 additions & 0 deletions lib/rdoc/generator/template/rorvswild/css/rdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,12 @@ pre + .toggle-source { margin-top: 0.5rem; }
.method-description p { margin: 0; }

.method-description ul { margin-left: 1.5em; }

main .mixin-from {
font-size: 0.823em;
font-style: italic;
margin-bottom: 0.75em;
}

#attribute-method-details .method-detail:hover {
background-color: transparent;
Expand Down

0 comments on commit 0aa9ba1

Please sign in to comment.