mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 13:34:17 +02:00
parent
478e0fc710
commit
7ae4b858b3
4 changed files with 41 additions and 8 deletions
|
@ -795,4 +795,22 @@ class RDoc::Generator::Darkfish
|
|||
|
||||
extracted_text[0...150].gsub(/\n/, " ").squeeze(" ")
|
||||
end
|
||||
|
||||
def generate_ancestor_list(ancestors, klass)
|
||||
return '' if ancestors.empty?
|
||||
|
||||
ancestor = ancestors.shift
|
||||
content = +'<ul><li>'
|
||||
|
||||
if ancestor.is_a?(RDoc::NormalClass)
|
||||
content << "<a href=\"#{klass.aref_to ancestor.path}\">#{ancestor.full_name}</a>"
|
||||
else
|
||||
content << ancestor.to_s
|
||||
end
|
||||
|
||||
# Recursively call the method for the remaining ancestors
|
||||
content << generate_ancestor_list(ancestors, klass)
|
||||
|
||||
content << '</li></ul>'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
<%- if klass.type == 'class' then %>
|
||||
<%- if klass.type == 'class' && (ancestors = klass.super_classes).any? -%>
|
||||
<div id="parent-class-section" class="nav-section">
|
||||
<h3>Parent</h3>
|
||||
|
||||
<%- if klass.superclass and not String === klass.superclass then -%>
|
||||
<p class="link"><a href="<%= klass.aref_to klass.superclass.path %>"><%= klass.superclass.full_name %></a>
|
||||
<%- else -%>
|
||||
<p class="link"><%= klass.superclass %>
|
||||
<%- end -%>
|
||||
<h3>Ancestors</h3>
|
||||
<%= generate_ancestor_list(ancestors, klass) %>
|
||||
</div>
|
||||
<%- end -%>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue