Skip to content

Commit 7146f62

Browse files
authored
Merge pull request #185 from jchanvfx/cherry_pick_gh-pages
documentation theme update.
2 parents 75fe723 + 9e3a918 commit 7146f62

32 files changed

+8190
-14
lines changed

docs/_templates/layout.html

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/_templates/localtoc.html

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"""
2+
Sphinx Read the Docs theme.
3+
4+
From https://github.com/ryan-roemer/sphinx-bootstrap-theme.
5+
"""
6+
7+
from os import path
8+
9+
from sphinx import version_info
10+
from sphinx.locale import _
11+
12+
try:
13+
# Avaliable from Sphinx 1.6
14+
from sphinx.util.logging import getLogger
15+
except ImportError:
16+
from logging import getLogger
17+
18+
19+
__version__ = '0.5.0'
20+
__version_full__ = __version__
21+
22+
logger = getLogger(__name__)
23+
24+
25+
def get_html_theme_path():
26+
"""Return list of HTML theme paths."""
27+
cur_dir = path.abspath(path.dirname(path.dirname(__file__)))
28+
return cur_dir
29+
30+
31+
def config_initiated(app, config):
32+
theme_options = config.html_theme_options or {}
33+
if theme_options.get('canonical_url'):
34+
logger.warning(
35+
_('The canonical_url option is deprecated, use the html_baseurl option from Sphinx instead.')
36+
)
37+
38+
39+
# See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package
40+
def setup(app):
41+
if version_info >= (1, 6, 0):
42+
# Register the theme that can be referenced without adding a theme path
43+
app.add_html_theme('sphinx_rtd_theme', path.abspath(path.dirname(__file__)))
44+
45+
if version_info >= (1, 8, 0):
46+
# Add Sphinx message catalog for newer versions of Sphinx
47+
# See http://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_message_catalog
48+
rtd_locale_path = path.join(path.abspath(path.dirname(__file__)), 'locale')
49+
app.add_message_catalog('sphinx', rtd_locale_path)
50+
app.connect('config-inited', config_initiated)
51+
52+
return {'parallel_read_safe': True, 'parallel_write_safe': True}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{# Support for Sphinx 1.3+ page_source_suffix, but don't break old builds. #}
2+
3+
{% if page_source_suffix %}
4+
{% set suffix = page_source_suffix %}
5+
{% else %}
6+
{% set suffix = source_suffix %}
7+
{% endif %}
8+
9+
{% if meta is defined and meta is not none %}
10+
{% set check_meta = True %}
11+
{% else %}
12+
{% set check_meta = False %}
13+
{% endif %}
14+
15+
{% if check_meta and 'github_url' in meta %}
16+
{% set display_github = True %}
17+
{% endif %}
18+
19+
{% if check_meta and 'bitbucket_url' in meta %}
20+
{% set display_bitbucket = True %}
21+
{% endif %}
22+
23+
{% if check_meta and 'gitlab_url' in meta %}
24+
{% set display_gitlab = True %}
25+
{% endif %}
26+
27+
{% set display_vcs_links = display_vcs_links if display_vcs_links is defined else True %}
28+
29+
<div role="navigation" aria-label="breadcrumbs navigation">
30+
31+
<ul class="wy-breadcrumbs">
32+
{% block breadcrumbs %}
33+
<li><a href="{{ pathto(master_doc) }}" class="icon icon-home"></a> &raquo;</li>
34+
{% for doc in parents %}
35+
<li><a href="{{ doc.link|e }}">{{ doc.title }}</a> &raquo;</li>
36+
{% endfor %}
37+
<li>{{ title }}</li>
38+
{% endblock %}
39+
{% block breadcrumbs_aside %}
40+
<li class="wy-breadcrumbs-aside">
41+
{% if hasdoc(pagename) and display_vcs_links %}
42+
{% if display_github %}
43+
{% if check_meta and 'github_url' in meta %}
44+
<!-- User defined GitHub URL -->
45+
<a href="{{ meta['github_url'] }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
46+
{% else %}
47+
<a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/{{ theme_vcs_pageview_mode or "blob" }}/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
48+
{% endif %}
49+
{% elif display_bitbucket %}
50+
{% if check_meta and 'bitbucket_url' in meta %}
51+
<!-- User defined Bitbucket URL -->
52+
<a href="{{ meta['bitbucket_url'] }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
53+
{% else %}
54+
<a href="https://bitbucket.org/{{ bitbucket_user }}/{{ bitbucket_repo }}/src/{{ bitbucket_version}}{{ conf_py_path }}{{ pagename }}{{ suffix }}?mode={{ theme_vcs_pageview_mode or "view" }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
55+
{% endif %}
56+
{% elif display_gitlab %}
57+
{% if check_meta and 'gitlab_url' in meta %}
58+
<!-- User defined GitLab URL -->
59+
<a href="{{ meta['gitlab_url'] }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
60+
{% else %}
61+
<a href="https://{{ gitlab_host|default("gitlab.com") }}/{{ gitlab_user }}/{{ gitlab_repo }}/{{ theme_vcs_pageview_mode or "blob" }}/{{ gitlab_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
62+
{% endif %}
63+
{% elif show_source and source_url_prefix %}
64+
<a href="{{ source_url_prefix }}{{ pagename }}{{ suffix }}">{{ _('View page source') }}</a>
65+
{% elif show_source and has_source and sourcename %}
66+
<a href="{{ pathto('_sources/' + sourcename, true)|e }}" rel="nofollow"> {{ _('View page source') }}</a>
67+
{% endif %}
68+
{% endif %}
69+
</li>
70+
{% endblock %}
71+
</ul>
72+
73+
{% if (theme_prev_next_buttons_location == 'top' or theme_prev_next_buttons_location == 'both') and (next or prev) %}
74+
<div class="rst-breadcrumbs-buttons" role="navigation" aria-label="breadcrumb navigation">
75+
{% if next %}
76+
<a href="{{ next.link|e }}" class="btn btn-neutral float-right" title="{{ next.title|striptags|e }}" accesskey="n">{{ _('Next') }} <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
77+
{% endif %}
78+
{% if prev %}
79+
<a href="{{ prev.link|e }}" class="btn btn-neutral float-left" title="{{ prev.title|striptags|e }}" accesskey="p"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> {{ _('Previous') }}</a>
80+
{% endif %}
81+
</div>
82+
{% endif %}
83+
<hr/>
84+
</div>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<footer>
2+
{%- if (theme_prev_next_buttons_location == 'bottom' or theme_prev_next_buttons_location == 'both') and (next or prev) %}
3+
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
4+
{%- if next %}
5+
<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>
6+
{%- endif %}
7+
{%- if prev %}
8+
<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>
9+
{%- endif %}
10+
</div>
11+
{%- endif %}
12+
13+
<hr/>
14+
15+
<div role="contentinfo">
16+
{%- block contentinfo %}
17+
<p>
18+
{%- if show_copyright %}
19+
{%- if hasdoc('copyright') %}
20+
{% trans path=pathto('copyright'), copyright=copyright|e %}&#169; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
21+
{%- else %}
22+
{% trans copyright=copyright|e %}&#169; Copyright {{ copyright }}.{% endtrans %}
23+
{%- endif %}
24+
{%- endif %}
25+
26+
{%- if build_id and build_url %}
27+
<span class="build">
28+
{# Translators: Build is a noun, not a verb #}
29+
{% trans %}Build{% endtrans %}
30+
<a href="{{ build_url }}">{{ build_id }}</a>.
31+
</span>
32+
{%- elif commit %}
33+
<span class="commit">
34+
{# Translators: the phrase "revision" comes from Git, referring to a commit #}
35+
{% trans %}Revision{% endtrans %} <code>{{ commit }}</code>.
36+
</span>
37+
{%- endif %}
38+
{%- if last_updated %}
39+
<span class="lastupdated">
40+
{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
41+
</span>
42+
{%- endif %}
43+
44+
</p>
45+
{%- endblock %}
46+
</div>
47+
48+
{%- if show_sphinx %}
49+
{% set sphinx_web = '<a href="https://www.sphinx-doc.org/">Sphinx</a>' %}
50+
{% set readthedocs_web = '<a href="https://readthedocs.org">Read the Docs</a>' %}
51+
{# Translators: the variable "sphinx_web" is a link to the Sphinx project documentation with the text "Sphinx" #}
52+
{% trans sphinx_web=sphinx_web, readthedocs_web=readthedocs_web %}Built with {{ sphinx_web }} using a{% endtrans %}
53+
{# Translators: "theme" refers to a theme for Sphinx, which alters the appearance of the generated documenation #}
54+
<a href="https://github.com/readthedocs/sphinx_rtd_theme">{% trans %}theme{% endtrans %}</a>
55+
{# 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. #}
56+
{% trans %}provided by {{ readthedocs_web }}{% endtrans %}.
57+
{%- endif %}
58+
59+
{%- block extrafooter %} {% endblock %}
60+
61+
</footer>

0 commit comments

Comments
 (0)