[IMP] doc: handling of toc outside master_doc
* remove local toc sidebar in non-index documents with a toctree * change toctree rendering to only have links on leaf nodes (don't link to intermediate toctree'd documents)
This commit is contained in:
parent
812318dcba
commit
f94a667ed1
|
@ -49,6 +49,27 @@ def navbarify(node, navbar=None):
|
||||||
link.attributes['data-toggle'] = 'dropdown'
|
link.attributes['data-toggle'] = 'dropdown'
|
||||||
# list_item.bullet_list
|
# list_item.bullet_list
|
||||||
list_item.children[1]['classes'].append('dropdown-menu')
|
list_item.children[1]['classes'].append('dropdown-menu')
|
||||||
|
elif navbar is None:
|
||||||
|
for n in node.traverse(nodes.reference):
|
||||||
|
# list_item
|
||||||
|
# compact_paragraph
|
||||||
|
# reference <- starting point
|
||||||
|
# bullet_list
|
||||||
|
# list_item+
|
||||||
|
# if the current list item (GP of current node) has bullet list
|
||||||
|
# children, unref it
|
||||||
|
list_item = n.parent.parent
|
||||||
|
# only has a reference -> ignore
|
||||||
|
if len(list_item.children) < 2:
|
||||||
|
continue
|
||||||
|
# no subrefs -> ignore
|
||||||
|
if not list_item.children[1].children:
|
||||||
|
continue
|
||||||
|
# otherwise replace reference node by its own children
|
||||||
|
para = n.parent
|
||||||
|
para.remove(n)
|
||||||
|
para.extend(n.children)
|
||||||
|
|
||||||
|
|
||||||
def resolve_content_toctree(
|
def resolve_content_toctree(
|
||||||
environment, docname, builder, toctree, prune=True, maxdepth=0,
|
environment, docname, builder, toctree, prune=True, maxdepth=0,
|
||||||
|
|
|
@ -83,8 +83,7 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ toctree(titles_only=True, maxdepth=2, includehidden=True,
|
{{ toctree(titles_only=True, maxdepth=2, includehidden=True, collapse=False, navbar='main') }}
|
||||||
collapse=False, navbar='main') }}
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -99,6 +98,7 @@
|
||||||
<main class="{{ container }} {{ ' '.join(classes) }}">
|
<main class="{{ container }} {{ ' '.join(classes) }}">
|
||||||
{% if pagename != master_doc %}
|
{% if pagename != master_doc %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
{% if 'has-toc' not in meta %}
|
||||||
<aside>
|
<aside>
|
||||||
<div class="navbar-aside text-center">
|
<div class="navbar-aside text-center">
|
||||||
<div class="logo_box">
|
<div class="logo_box">
|
||||||
|
@ -113,7 +113,8 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
<article class="doc-body">
|
{% endif %}
|
||||||
|
<article class="doc-body {% if 'has-toc' in meta %}doc-toc{% endif %}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% block body %} {% endblock %}
|
{% block body %} {% endblock %}
|
||||||
{% if pagename != master_doc %}</article>
|
{% if pagename != master_doc %}</article>
|
||||||
|
|
|
@ -118,6 +118,9 @@ main{
|
||||||
padding-left: 30px;
|
padding-left: 30px;
|
||||||
@media (min-width: @w-size-medium) {
|
@media (min-width: @w-size-medium) {
|
||||||
width: 75%;
|
width: 75%;
|
||||||
|
&.doc-toc {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
> *{
|
> *{
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
|
|
@ -8599,6 +8599,9 @@ main article.doc-body {
|
||||||
main article.doc-body {
|
main article.doc-body {
|
||||||
width: 75%;
|
width: 75%;
|
||||||
}
|
}
|
||||||
|
main article.doc-body.doc-toc {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
main article.doc-body > * {
|
main article.doc-body > * {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
|
Loading…
Reference in New Issue