Changes to PDoc template to fix issues relating to sections.
This commit is contained in:
parent
deb3df525e
commit
15b936af91
|
@ -61,6 +61,24 @@ div#footer {
|
|||
text-decoration: underline;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
div.copyright,
|
||||
div.credits {
|
||||
width: 360px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.copyright .cc {
|
||||
width: 115px;
|
||||
margin-right: 5px;
|
||||
text-align: center;
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.copyright .copyright-about {
|
||||
width: 235px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
||||
.page-title span.type {
|
||||
|
|
|
@ -60,11 +60,23 @@ module PDoc
|
|||
end
|
||||
|
||||
def path_to(obj)
|
||||
path = path_prefix << [obj.section.name].concat(obj.namespace_string.downcase.split('.')).join("/")
|
||||
return path_to_section(obj) if obj.is_a?(Documentation::Section)
|
||||
path = path_prefix << [obj.section.name.downcase].concat(obj.namespace_string.downcase.split('.')).join("/")
|
||||
has_own_page?(obj) ? "#{path}/#{obj.id.downcase}.html" : "#{path}.html##{dom_id(obj)}"
|
||||
end
|
||||
|
||||
def path_to_section(obj)
|
||||
"#{path_prefix}#{obj.id.gsub(/\s/, '_')}.html"
|
||||
end
|
||||
|
||||
def section_from_name(name)
|
||||
root.sections.find { |section| section.name == name }
|
||||
end
|
||||
|
||||
def auto_link(obj, short = true, attributes = {})
|
||||
if obj.is_a?(String) && obj =~ /\ssection$/
|
||||
obj = section_from_name(obj.gsub(/\ssection$/, ''))
|
||||
end
|
||||
obj = root.find_by_name(obj) || obj if obj.is_a?(String)
|
||||
return nil if obj.nil?
|
||||
return obj if obj.is_a?(String)
|
||||
|
@ -77,6 +89,12 @@ module PDoc
|
|||
end
|
||||
|
||||
def auto_link_content(content)
|
||||
content.gsub!(/\[\[([a-zA-Z]+)\s+section\]\]/) do |m|
|
||||
puts; puts m; puts
|
||||
result = auto_link(section_from_name($1), false)
|
||||
puts; puts result; puts
|
||||
result
|
||||
end
|
||||
content.gsub(/\[\[([a-zA-Z$\.#]+)(?:\s+([^\]]+))?\]\]/) do |m|
|
||||
if doc_instance = root.find_by_name($1)
|
||||
$2 ? link_to($2, path_to(doc_instance)) :
|
||||
|
|
|
@ -16,8 +16,10 @@
|
|||
<ul class="section-list">
|
||||
<% @root.sections.each do |section| %>
|
||||
<li>
|
||||
<h4><%= auto_link(section.name) %></h4>
|
||||
<p><%= section.short_description %></p>
|
||||
<h4>
|
||||
<a href="<%= path_to_section(section) %>"><%= section.name %></a>
|
||||
</h4>
|
||||
<p><%= htmlize(section.short_description) %></p>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -52,8 +52,21 @@
|
|||
|
||||
<div id="footer">
|
||||
|
||||
<div class="about">
|
||||
<p>Generated by <a href="http://pdoc.org">PDoc</a>. Uses <a href="http://famfamfam.com/lab/icons/silk/" title="famfamfam.com: Silk Icons">Silk Icons</a>.</p>
|
||||
<div class="about clearfix">
|
||||
<div class="copyright clearfix">
|
||||
<div class="cc">
|
||||
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://creativecommons.org/images/public/somerights20.png" /></a>
|
||||
</div> <!-- .cc -->
|
||||
<div class="copyright-about">
|
||||
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 Unported License</a>.
|
||||
</div> <!-- .copyright-about -->
|
||||
</div> <!-- .copyright -->
|
||||
|
||||
<div class="credits">
|
||||
<p>Generated by <a href="http://pdoc.org">PDoc</a>. Uses <a href="http://famfamfam.com/lab/icons/silk/" title="famfamfam.com: Silk Icons">Silk Icons</a>.</p>
|
||||
|
||||
</div> <!-- .credits -->
|
||||
|
||||
</div> <!-- .about -->
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<% # Does it have a description? %>
|
||||
|
||||
<% if d.description %>
|
||||
<% if d.description && !d.description.empty? %>
|
||||
<div class="section section-description">
|
||||
|
||||
<div class="section-title">
|
||||
|
|
|
@ -49,9 +49,18 @@
|
|||
</div> <!-- .section-title -->
|
||||
|
||||
<div class="section-content">
|
||||
<ul class="method-list">
|
||||
<ul class="method-details-list">
|
||||
<% namespaces.each do |namespace| %>
|
||||
<li><%= auto_link_code(namespace) %></li>
|
||||
<li class="method-description">
|
||||
<h4>
|
||||
<a href="<%= path_to(namespace) %>"><%= namespace.full_name %></a>
|
||||
</h4>
|
||||
|
||||
<% unless namespace.short_description.nil? %>
|
||||
<p><%= htmlize(namespace.short_description) %></p>
|
||||
<% end %>
|
||||
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div> <!-- .section-content -->
|
||||
|
|
Loading…
Reference in New Issue