Ensure API docs work with links at first level

This commit is contained in:
Tom Christie 2017-03-07 12:58:49 +00:00
parent 4013a2e789
commit 065bb275a4
3 changed files with 5 additions and 3 deletions

View File

@ -15,8 +15,10 @@
</div> </div>
{% for section_key, section in document.data.items %} {% for section_key, section in document.data.items %}
{% if section_key %}
<h2 id="{{ section_key }}" class="coredocs-section-title">{{ section_key }} <a href="#{{ section_key }}"><i class="fa fa-link" aria-hidden="true"></i> <h2 id="{{ section_key }}" class="coredocs-section-title">{{ section_key }} <a href="#{{ section_key }}"><i class="fa fa-link" aria-hidden="true"></i>
</a></h2> </a></h2>
{% endif %}
{% for link_key, link in section.links.items %} {% for link_key, link in section.links.items %}
{% include "rest_framework/docs/link.html" %} {% include "rest_framework/docs/link.html" %}

View File

@ -6,9 +6,9 @@
<ul id="menu-content" class="menu-content collapse out"> <ul id="menu-content" class="menu-content collapse out">
{% for section_key, section in document.data.items %} {% for section_key, section in document.data.items %}
<li data-toggle="collapse" data-target="#{{ section_key }}-dropdown" class="collapsed"> <li data-toggle="collapse" data-target="#{{ section_key }}-dropdown" class="collapsed">
<a><i class="fa fa-dot-circle-o fa-lg"></i> {{ section_key }} <span class="arrow"></span></a> <a><i class="fa fa-dot-circle-o fa-lg"></i> {% if section_key %}{{ section_key }}{% else %}API Endpoints{% endif %} <span class="arrow"></span></a>
</li> </li>
<ul class="sub-menu collapse" id="{{ section_key }}-dropdown"> <ul class="sub-menu {% if section_key %}collapse{% endif %}" id="{{ section_key }}-dropdown">
{% for link_key, link in section.links.items %} {% for link_key, link in section.links.items %}
<li><a href="#{{ section_key }}-{{ link_key }}">{{ link.title|default:link_key }}</a></li> <li><a href="#{{ section_key }}-{{ link_key }}">{{ link.title|default:link_key }}</a></li>
{% endfor %} {% endfor %}

View File

@ -39,7 +39,7 @@ class CodeNode(template.Node):
def render(self, context): def render(self, context):
text = self.nodelist.render(context) text = self.nodelist.render(context)
return pygments_highlight(text) return pygments_highlight(text, self.lang, self.style)
@register.filter() @register.filter()