drop 'has_only_toc' meta
This commit is contained in:
parent
50bde37cf2
commit
f4847d02d0
23
conf.py
23
conf.py
@ -244,8 +244,6 @@ def setup(app):
|
||||
app.add_config_value('languages', None, 'env')
|
||||
app.connect('html-page-context', _generate_alternate_urls)
|
||||
|
||||
app.connect('doctree-resolved', tag_toctrees) # TODO ANVFE review + typo
|
||||
|
||||
|
||||
def _generate_alternate_urls(app, pagename, templatename, context, doctree):
|
||||
""" Add keys of required alternate URLs for the current document in the rendering context.
|
||||
@ -319,24 +317,3 @@ def _generate_alternate_urls(app, pagename, templatename, context, doctree):
|
||||
_canonicalize()
|
||||
_versionize()
|
||||
_localize()
|
||||
|
||||
|
||||
def tag_toctrees(app, doctree, docname):
|
||||
"""Add a 'has_only_toc' metadata entry to all documents containing only a toctree node"""
|
||||
# document
|
||||
# section
|
||||
# title
|
||||
# compound@toctree-wrapper
|
||||
# ....
|
||||
if not len(doctree.children) <= 1:
|
||||
return
|
||||
section = doctree.children[0]
|
||||
if len(section.children) < 2:
|
||||
return
|
||||
compound = section.children[1]
|
||||
if 'toctree-wrapper' not in compound['classes']:
|
||||
return
|
||||
|
||||
if 'show_content' not in app.env.metadata[docname]:
|
||||
# If page contains custom content: we have to show github link and local toc
|
||||
app.env.metadata[docname]['has_only_toc'] = True
|
||||
|
@ -1,4 +1,5 @@
|
||||
:show_content:
|
||||
:hide_page_toc:
|
||||
|
||||
============
|
||||
Applications
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
:show_content:
|
||||
:hide_page_toc:
|
||||
|
||||
=================================
|
||||
Contributing to the documentation
|
||||
|
@ -83,7 +83,7 @@
|
||||
{% set main_classes = main_classes + meta['classes'].split() %}
|
||||
{% endif %}
|
||||
|
||||
{% if 'has_only_toc' in meta or 'hide_page_toc' in meta %}
|
||||
{% if 'hide_page_toc' in meta %}
|
||||
{% set main_classes = main_classes + ['o_fullwidth_page'] %}
|
||||
{% endif %}
|
||||
|
||||
@ -101,7 +101,7 @@
|
||||
{% block body %} {% endblock %}
|
||||
</div>
|
||||
{# Do not show the edition link for pages without content #}
|
||||
{% if github_link and 'has_only_toc' not in meta and pagename != 'search' %}
|
||||
{% if github_link and pagename != 'search' %}
|
||||
<a href="{{ github_link(mode='edit') }}" class="o_git_link"><i class="i-edit"></i> Edit on GitHub</a>
|
||||
{% endif %}
|
||||
</article>
|
||||
|
Loading…
Reference in New Issue
Block a user