Skip to content

Commit 8ba9c8a

Browse files
authored
Templates: Cleanup Whitespace (#1060)
While not perfect this cuts it down a lot and makes the html output much cleaner
1 parent 331ba4e commit 8ba9c8a

File tree

4 files changed

+151
-155
lines changed

4 files changed

+151
-155
lines changed

docs/_templates/layout.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{%- extends "!layout.html" %}
22

3-
{#
3+
{#-
44

55
This template exists as a way to implement a version menu without changing what
66
the theme normally renders the menu on local builds and on builds on Read the
77
Docs. This is for local testing purposes only.
88

99
#}
1010

11-
{% block footer %}
12-
{% if not READTHEDOCS %}
11+
{%- block footer %}
12+
{%- if not READTHEDOCS %}
1313
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="{{ _('Versions') }}">
1414
<span class="rst-current-version" data-toggle="rst-current-version">
1515
<span class="fa fa-book"> Read the Docs</span>
@@ -19,15 +19,15 @@
1919
<div class="rst-other-versions">
2020
<dl>
2121
<dt>{{ _('Versions') }}</dt>
22-
{% if test_versions %}
23-
{% for version in test_versions %}
22+
{%- if test_versions %}
23+
{%- for version in test_versions %}
2424
<dd><a href="#">{{ version }}</a></dd>
25-
{% endfor %}
26-
{% else %}
25+
{%- endfor %}
26+
{%- else %}
2727
<dd><a href="#">latest</a></dd>
2828
<dd><a href="#">1.0</a></dd>
2929
<dd><a href="#">1.1</a></dd>
30-
{% endif %}
30+
{%- endif %}
3131
</dl>
3232
<dl>
3333
<dt>{{ _('Downloads') }}</dt>
@@ -36,7 +36,7 @@
3636
<dd><a href="#">HTML</a></dd>
3737
</dl>
3838
<dl>
39-
{# Translators: The phrase "Read the Docs" is not translated #}
39+
{#- Translators: The phrase "Read the Docs" is not translated #}
4040
<dt>{{ _('On Read the Docs') }}</dt>
4141
<dd>
4242
<a href="#">{{ _('Project Home') }}</a>
@@ -51,5 +51,5 @@
5151
</dl>
5252
</div>
5353
</div>
54-
{% endif %}
55-
{% endblock %}
54+
{%- endif %}
55+
{%- endblock %}

sphinx_rtd_theme/breadcrumbs.html

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,83 @@
1-
{# Support for Sphinx 1.3+ page_source_suffix, but don't break old builds. #}
1+
{#- Support for Sphinx 1.3+ page_source_suffix, but don't break old builds. #}
22

3-
{% if page_source_suffix %}
4-
{% set suffix = page_source_suffix %}
5-
{% else %}
6-
{% set suffix = source_suffix %}
7-
{% endif %}
3+
{%- if page_source_suffix %}
4+
{%- set suffix = page_source_suffix %}
5+
{%- else %}
6+
{%- set suffix = source_suffix %}
7+
{%- endif %}
88

9-
{% if meta is defined and meta is not none %}
10-
{% set check_meta = True %}
11-
{% else %}
12-
{% set check_meta = False %}
13-
{% endif %}
9+
{%- if meta is defined and meta is not none %}
10+
{%- set check_meta = True %}
11+
{%- else %}
12+
{%- set check_meta = False %}
13+
{%- endif %}
1414

15-
{% if check_meta and 'github_url' in meta %}
16-
{% set display_github = True %}
17-
{% endif %}
15+
{%- if check_meta and 'github_url' in meta %}
16+
{%- set display_github = True %}
17+
{%- endif %}
1818

19-
{% if check_meta and 'bitbucket_url' in meta %}
20-
{% set display_bitbucket = True %}
21-
{% endif %}
19+
{%- if check_meta and 'bitbucket_url' in meta %}
20+
{%- set display_bitbucket = True %}
21+
{%- endif %}
2222

23-
{% if check_meta and 'gitlab_url' in meta %}
24-
{% set display_gitlab = True %}
25-
{% endif %}
23+
{%- if check_meta and 'gitlab_url' in meta %}
24+
{%- set display_gitlab = True %}
25+
{%- endif %}
2626

27-
{% set display_vcs_links = display_vcs_links if display_vcs_links is defined else True %}
27+
{%- set display_vcs_links = display_vcs_links if display_vcs_links is defined else True %}
2828

2929
<div role="navigation" aria-label="{{ _('Breadcrumbs') }}">
30-
3130
<ul class="wy-breadcrumbs">
32-
{% block breadcrumbs %}
31+
{%- block breadcrumbs %}
3332
<li><a href="{{ pathto(master_doc) }}" class="icon icon-home"></a> &raquo;</li>
34-
{% for doc in parents %}
33+
{%- for doc in parents %}
3534
<li><a href="{{ doc.link|e }}">{{ doc.title }}</a> &raquo;</li>
36-
{% endfor %}
35+
{%- endfor %}
3736
<li>{{ title }}</li>
38-
{% endblock %}
39-
{% block breadcrumbs_aside %}
37+
{%- endblock %}
38+
{%- block breadcrumbs_aside %}
4039
<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 %}
40+
{%- if hasdoc(pagename) and display_vcs_links %}
41+
{%- if display_github %}
42+
{%- if check_meta and 'github_url' in meta %}
4443
<!-- User defined GitHub URL -->
4544
<a href="{{ meta['github_url'] }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
46-
{% else %}
45+
{%- else %}
4746
<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 %}
47+
{%- endif %}
48+
{%- elif display_bitbucket %}
49+
{%- if check_meta and 'bitbucket_url' in meta %}
5150
<!-- User defined Bitbucket URL -->
5251
<a href="{{ meta['bitbucket_url'] }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
53-
{% else %}
52+
{%- else %}
5453
<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 %}
54+
{%- endif %}
55+
{%- elif display_gitlab %}
56+
{%- if check_meta and 'gitlab_url' in meta %}
5857
<!-- User defined GitLab URL -->
5958
<a href="{{ meta['gitlab_url'] }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
60-
{% else %}
59+
{%- else %}
6160
<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 %}
61+
{%- endif %}
62+
{%- elif show_source and source_url_prefix %}
6463
<a href="{{ source_url_prefix }}{{ pagename }}{{ suffix }}">{{ _('View page source') }}</a>
65-
{% elif show_source and has_source and sourcename %}
64+
{%- elif show_source and has_source and sourcename %}
6665
<a href="{{ pathto('_sources/' + sourcename, true)|e }}" rel="nofollow"> {{ _('View page source') }}</a>
67-
{% endif %}
68-
{% endif %}
66+
{%- endif %}
67+
{%- endif %}
6968
</li>
70-
{% endblock %}
69+
{%- endblock %}
7170
</ul>
7271

73-
{% if (theme_prev_next_buttons_location == 'top' or theme_prev_next_buttons_location == 'both') and (next or prev) %}
72+
{%- if (theme_prev_next_buttons_location == 'top' or theme_prev_next_buttons_location == 'both') and (next or prev) %}
7473
<div class="rst-breadcrumbs-buttons" role="navigation" aria-label="{{ _('Breadcrumbs') }}">
75-
{% if prev %}
74+
{%- if prev %}
7675
<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>
77-
{% endif %}
78-
{% if next %}
76+
{%- endif %}
77+
{%- if next %}
7978
<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>
80-
{% endif %}
79+
{%- endif %}
8180
</div>
82-
{% endif %}
81+
{%- endif %}
8382
<hr/>
8483
</div>

sphinx_rtd_theme/footer.html

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,44 +17,44 @@
1717
<p>
1818
{%- if show_copyright %}
1919
{%- if hasdoc('copyright') %}
20-
{% trans path=pathto('copyright'), copyright=copyright|e %}&#169; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
20+
{%- trans path=pathto('copyright'), copyright=copyright|e %}&#169; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
2121
{%- else %}
22-
{% trans copyright=copyright|e %}&#169; Copyright {{ copyright }}.{% endtrans %}
22+
{%- trans copyright=copyright|e %}&#169; Copyright {{ copyright }}.{% endtrans %}
2323
{%- endif %}
2424
{%- endif %}
2525

2626
{%- if build_id and build_url %}
2727
<span class="build">
28-
{# Translators: Build is a noun, not a verb #}
29-
{% trans %}Build{% endtrans %}
28+
{#- Translators: Build is a noun, not a verb -#}
29+
{%- trans %}Build{% endtrans -%}
3030
<a href="{{ build_url }}">{{ build_id }}</a>.
3131
</span>
3232
{%- elif commit %}
3333
<span class="commit">
34-
{# Translators: the phrase "revision" comes from Git, referring to a commit #}
35-
{% trans %}Revision{% endtrans %} <code>{{ commit }}</code>.
34+
{#- Translators: the phrase "revision" comes from Git, referring to a commit #}
35+
{%- trans %}Revision{% endtrans %} <code>{{ commit }}</code>.
3636
</span>
3737
{%- endif %}
3838
{%- if last_updated %}
3939
<span class="lastupdated">
40-
{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
40+
{%- trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
4141
</span>
42-
{%- endif %}
42+
{%- endif -%}
4343

4444
</p>
4545
{%- endblock %}
4646
</div>
4747

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 #}
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 #}
5454
<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 %}
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 %}
5858

5959
{%- block extrafooter %} {% endblock %}
6060

0 commit comments

Comments
 (0)