Skip to content

Commit

Permalink
Merge pull request #939 from gusthoff/topic/infrastructure/sphinx/str…
Browse files Browse the repository at this point in the history
…ucture/20231006

Sphinx: minor improvements to RTD theme integration
  • Loading branch information
gusthoff authored Oct 7, 2023
2 parents 62ecf48 + 1dd70cb commit 979062f
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 31 deletions.
Empty file.
86 changes: 56 additions & 30 deletions frontend/sphinx/_templates/footer.html
Original file line number Diff line number Diff line change
@@ -1,38 +1,32 @@
{%- macro nextprev(prev_but, next_but) %}
{% if (theme_prev_next_buttons_location == 'bottom' or theme_prev_next_buttons_location == 'both') and (next or prev) %}
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
{% if next and next_but %}
<a href="{{ next.link|e }}" class="btn btn-neutral float-right" title="{{ next.title|striptags|e }}" accesskey="n" rel="next">{{ _('Next') }} <span class="fa fa-arrow-circle-right"></span></a>
{% endif %}
{% if prev and prev_but %}
<a href="{{ prev.link|e }}" class="btn btn-neutral" title="{{ prev.title|striptags|e }}" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> {{ _('Previous') }}</a>
{% endif %}
</div>
{% endif %}
{%- endmacro %}


<footer>
{%- set next_state = '' %}
{%- set next_state_key = 'next_state' %}

{%- set prev_state = '' %}
{%- set prev_state_key = 'prev_state' %}

{%- if meta is defined and meta is not none %}
{% set next_but = not next_state_key in meta.keys() %}
{% set prev_but = not prev_state_key in meta.keys() %}

{{ nextprev(prev_but, next_but) }}
{%- else %}
{{ nextprev(true, true) }}
{%- if (theme_prev_next_buttons_location == 'bottom' or theme_prev_next_buttons_location == 'both') and (next or prev) %}
{#- Translators: This is an ARIA section label for the footer section of the page. -#}
<div class="rst-footer-buttons" role="navigation" aria-label="{{ _('Footer') }}">
{%- if prev %}
<a href="{{ prev.link|e }}" class="btn btn-neutral float-left" title="{{ prev.title|striptags|e }}" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> {{ _('Previous') }}</a>
{%- endif %}
{%- if next %}
<a href="{{ next.link|e }}" class="btn btn-neutral float-right" title="{{ next.title|striptags|e }}" accesskey="n" rel="next">{{ _('Next') }} <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
{%- endif %}
</div>
{%- endif %}


<hr/>

<div role="contentinfo">
{%- block contentinfo %}
<p>

<div class="legal">
Copyright &copy; {{ year }} AdaCore. All rights reserved.

{%- if show_copyright %}
{%- if hasdoc('copyright') %}
{%- trans path=pathto('copyright'), copyright=copyright|e %}&#169; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
{%- else %}
{%- trans copyright=copyright|e %}&#169; Copyright {{ copyright }}.{% endtrans %}
{%- endif %}
{%- endif %}

&nbsp;&nbsp;
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/80x15.png" /></a>
<br>
Expand All @@ -43,7 +37,39 @@
<a href="https://github.com/AdaCore/learn/issues">Report an Issue</a>
</div>

{%- if build_id and build_url %}
<span class="build">
{#- Translators: Build is a noun, not a verb -#}
{%- trans %}Build{% endtrans -%}
<a href="{{ build_url }}">{{ build_id }}</a>.
</span>
{%- elif commit %}
<span class="commit">
{#- Translators: the phrase "revision" comes from Git, referring to a commit #}
{%- trans %}Revision{% endtrans %} <code>{{ commit }}</code>.
</span>
{%- endif %}
{%- if last_updated %}
<span class="lastupdated">
{%- trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
</span>
{%- endif -%}

</p>
{%- endblock %}
</div>

{% if show_sphinx %}
{%- set sphinx_web = '<a href="https://www.sphinx-doc.org/">Sphinx</a>' %}
{%- set readthedocs_web = '<a href="https://readthedocs.org">Read the Docs</a>' %}
{#- Translators: the variable "sphinx_web" is a link to the Sphinx project documentation with the text "Sphinx" #}
{%- trans sphinx_web=sphinx_web, readthedocs_web=readthedocs_web %}Built with {{ sphinx_web }} using a{% endtrans %}
{#- Translators: "theme" refers to a theme for Sphinx, which alters the appearance of the generated documentation #}
<a href="https://github.com/readthedocs/sphinx_rtd_theme">{% trans %}theme{% endtrans %}</a>
{#- Translators: this is always used as "provided by Read the Docs", and should not imply Read the Docs is an author of the generated documentation. #}
{% trans %}provided by {{ readthedocs_web }}{% endtrans %}.
{% endif %}

{%- block extrafooter %} {% endblock %}

</footer>

7 changes: 6 additions & 1 deletion frontend/sphinx/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_file_from_conf_ini(path_to_file):
# -- Project information -----------------------------------------------------

project = u'learn.adacore.com'
copyright = u'2018 – 2022, AdaCore'
copyright = u'2018 – 2023, AdaCore. All rights reserved'
author = u'AdaCore' if not config.has_option('', 'author') else \
config['DEFAULT']['author']
title = u'Learn Ada (Complete)' if not config.has_option('', 'title') else \
Expand Down Expand Up @@ -229,10 +229,13 @@ def get_file_from_conf_ini(path_to_file):
#
html_theme_options = {
'logo_only': True,
# 'analytics_id': '',
# 'analytics_anonymize_ip': False,
'display_version': False,
'prev_next_buttons_location': 'bottom',
'style_external_links': False,
'vcs_pageview_mode': '',
# 'style_nav_header_background': 'white',
# Toc options
'collapse_navigation': False,
'sticky_navigation': False,
Expand All @@ -241,6 +244,8 @@ def get_file_from_conf_ini(path_to_file):
'titles_only': False
}

html_show_sphinx = False

html_logo = "img/logo.svg"

html_favicon = "img/favicon.ico"
Expand Down

0 comments on commit 979062f

Please sign in to comment.