Compare commits

...
30 Commits
Author SHA1 Message Date
Aaron Carlisle 8a2b2611d3 HTML Search: Use sphinx's built in search template file
Instead of using our own template uses sphinx's basic search.html 
instead.
This change is almost identical except for the new search page includes 
a search box. As a result, the search box is hidden on the search page.
2020-12-01 15:58:27 -05:00
Aaron Carlisle 562bc2a35d Cleanup: Make Copyright template match sphinx's basic (#933)
This matches https://github.com/sphinx-doc/sphinx/blob/3.x/sphinx/themes/basic/layout.html
2020-11-30 12:56:05 -05:00
David FischerandAaron Carlisle 24ceb6d93d Hide the search box on any "singlehtml" like builder (#975)
- This applies to the RTD builders readthedocssinglehtml
  and readthedocssinglehtmllocalmedia

Co-authored-by: Aaron Carlisle <carlisle.b3d@gmail.com>
2020-11-28 01:59:59 -05:00
Santos Gallegos e2b10425ef CI: switch to circleci (#1020) 2020-11-25 18:51:19 -05:00
Santos Gallegos 38752d455f Fix vcs_pageview_mode (#1010)
Fixes https://github.com/readthedocs/sphinx_rtd_theme/issues/701
2020-11-25 17:39:51 -05:00
e2b60d7e7b Add analytics_anonymize_ip option to theme (#889)
* Add analytics_anonymize_ip option to theme

* Fix typo and use tobool filter

Co-Authored-By: Jesse Tan <jessetan@users.noreply.github.com>

* Simplify analytics_anonymize_ip description

* Update changelog.rst

Co-authored-by: Jesse Tan <jessetan@users.noreply.github.com>
Co-authored-by: Aaron Carlisle <carlisle.b3d@gmail.com>
2020-10-08 19:28:19 -04:00
Santos Gallegos 4366e9e3f8 Merge pull request #1012 from readthedocs/test-more
Test with more versions of sphinx/python
2020-10-08 17:57:23 -05:00
Santos Gallegos 33a9df7185 Tests with more versions of sphinx/python 2020-10-08 17:46:26 -05:00
Santos Gallegos f8ce9db72a Merge pull request #1005 from readthedocs/include-preinstall
Packaging: include bin/preinstall.js
2020-10-08 17:19:28 -05:00
Santos Gallegos 9d451fb079 Merge branch 'master' into include-preinstall 2020-10-08 17:11:39 -05:00
Santos Gallegos 80cc791120 Merge pull request #1011 from readthedocs/link-license
Link to sphinx license
2020-10-08 17:11:26 -05:00
Santos Gallegos cf6da7632d Link to sphinx license
Closes https://github.com/readthedocs/sphinx_rtd_theme/issues/283
2020-10-08 17:02:21 -05:00
Santos Gallegos 3d2453b3fd Merge branch 'master' into include-preinstall 2020-10-08 13:47:13 -05:00
Santos Gallegos b5cafe8e44 Merge pull request #1007 from readthedocs/mark-icons
Make nex/prev icons as aria-hidden
2020-10-08 13:46:41 -05:00
Santos Gallegos ca9a8e256e Merge branch 'master' into mark-icons 2020-10-08 13:41:57 -05:00
Santos Gallegos 1485644386 Merge pull request #1006 from readthedocs/use-well-formed-xml
Use well-formed XML syntax
2020-10-08 09:47:40 -05:00
Santos Gallegos 939584e54f Make nex/prev icons as aria-hidden
Fixes https://github.com/readthedocs/sphinx_rtd_theme/issues/954
2020-10-07 17:29:50 -05:00
Santos Gallegos f6c4e9cb62 Use well-formed XML syntax
Fixes https://github.com/readthedocs/sphinx_rtd_theme/issues/985

ref https://github.com/sphinx-doc/sphinx/commit/267eeabc008ce7ab1a0034cc9c7ce2eafc52514b
2020-10-07 16:42:21 -05:00
Santos Gallegos 58f07c0be0 Packaging: include bin/preinstall.js
Closes https://github.com/readthedocs/sphinx_rtd_theme/issues/990
2020-10-07 16:29:11 -05:00
Santos Gallegos 006cd2162a Merge pull request #1002 from benjaoming/patch-1
Use just python3 in .readthedocs.yml
2020-10-07 10:05:03 -05:00
Benjamin Balder Bach 79fd7487f0 Use latest python3 on build server
Tested this to work on a local RTD server with Python 3.7. Consider this as a better default than pinning specific Python 3 versions, which makes it harder for the central RTD server to get rid of these versions.
2020-10-07 16:45:41 +02:00
Santos Gallegos 00f402f8e9 Merge pull request #1001 from sylvestre/patch-1
Update the url to the "readthedocs" one
2020-09-30 09:16:44 -05:00
Sylvestre Ledru 6c943265c1 Update the url to the "readthedocs" one
To avoid a redirect
2020-09-30 16:11:14 +02:00
Anthony 1d85625667 Merge pull request #897 from mgeier/commit-and-date
Footer: show both "commit" and "last_updated" (if available)
2020-07-23 15:27:52 -06:00
Matthias Geier d5ed3d0ba1 Footer: show both "commit" and "last_updated" (if available)
Closes #238.
2020-07-07 17:37:33 +02:00
Anders Kaseorg 7df2524941 Revert "Add more localized strings" (#961)
The alt attribute is only valid on the <area>, <img>, and <input>
elements, not <a>.

https://html.spec.whatwg.org/multipage/indices.html#attributes-3:attr-area-alt

This reverts commit 8f327360a5 (#806).

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2020-06-26 19:53:42 -04:00
Santos Gallegos fd83875eef Merge pull request #935 from readthedocs/search-hide-edit-links
Search page: don't show "edit on" links
2020-06-22 15:00:09 -05:00
Santos Gallegos ecc58ad802 Merge branch 'master' into search-hide-edit-links 2020-06-22 14:34:33 -05:00
Nikita Titov aa71fd6cde fix broken link in footer (#947) 2020-06-19 17:06:49 -04:00
Santos Gallegos bdd77df7bb Search page: don't show "edit on" links
This page is autogenerated, so it doesn't have "a real page".

Fixes https://github.com/readthedocs/sphinx_rtd_theme/issues/934
2020-06-01 14:02:08 -05:00
15 changed files with 108 additions and 102 deletions

No files matched your search

+54
View File
@@ -0,0 +1,54 @@
version: 2.1
commands:
run-tox:
description: "Run tox"
parameters:
version:
type: string
steps:
- checkout
- run: pip install --user tox
- run: tox -e "<<parameters.version>>-sphinx{16,17,18,20,21,22,23,24,30,31,32}"
jobs:
py27:
docker:
- image: 'cimg/python:2.7'
steps:
- run-tox:
version: py27
py36:
docker:
- image: 'cimg/python:3.6'
steps:
- run-tox:
version: py36
py37:
docker:
- image: 'cimg/python:3.7'
steps:
- run-tox:
version: py37
py38:
docker:
- image: 'cimg/python:3.8'
steps:
- run-tox:
version: py38
py39:
docker:
- image: 'cimg/python:3.9'
steps:
- run-tox:
version: py39
workflows:
version: 2
tests:
jobs:
- py39
- py38
- py37
- py36
- py27
+5 -1
View File
@@ -1,5 +1,9 @@
version: 2
python:
version: 3.6
version: 3
install:
- requirements: docs/requirements.txt
sphinx:
configuration: docs/conf.py
-14
View File
@@ -1,14 +0,0 @@
language: python
python:
- 2.7
- 3.6
- 3.7
install:
- pip install tox-travis
- pip install sphinx
script:
- tox
branches:
only:
- master
+1
View File
@@ -1,6 +1,7 @@
include *.txt
include babel.cfg
include LICENSE
include bin/preinstall.js
recursive-include sphinx_rtd_theme *.conf
recursive-include sphinx_rtd_theme *.css
recursive-include sphinx_rtd_theme *.eot
+2 -2
View File
@@ -5,9 +5,9 @@ Read the Docs Sphinx Theme
.. image:: https://img.shields.io/pypi/v/sphinx_rtd_theme.svg
:target: https://pypi.python.org/pypi/sphinx_rtd_theme
:alt: Pypi Version
.. image:: https://travis-ci.org/readthedocs/sphinx_rtd_theme.svg?branch=master
:target: https://travis-ci.org/readthedocs/sphinx_rtd_theme
.. image:: https://circleci.com/gh/readthedocs/sphinx_rtd_theme.svg?style=svg
:alt: Build Status
:target: https://circleci.com/gh/readthedocs/sphinx_rtd_theme
.. image:: https://img.shields.io/pypi/l/sphinx_rtd_theme.svg
:target: https://pypi.python.org/pypi/sphinx_rtd_theme/
:alt: License
+5
View File
@@ -5,6 +5,11 @@ Changelog
master
======
New Features
------------
* New theme option to enable anonymous ip addresses when using Google Analytics (#889)
v0.5.0
======
+8
View File
@@ -15,6 +15,7 @@ For example:
html_theme_options = {
'canonical_url': '',
'analytics_id': 'UA-XXXXXXX-1', # Provided by Google in your dashboard
'analytics_anonymize_ip': False,
'logo_only': False,
'display_version': True,
'prev_next_buttons_location': 'bottom',
@@ -101,6 +102,13 @@ Miscellaneous options
If specified, Google Analytics' javascript is included in your pages.
Set the value to the ID provided to you by google (like ``UA-XXXXXXX``).
.. confval:: analytics_anonymize_ip
:type: boolean
:default: ``False``
Anonymize visitor IP addresses in Google Analytics.
.. confval:: canonical_url
:type: URL
+2 -2
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""`sphinx_rtd_theme` lives on `Github`_.
.. _github: https://github.com/rtfd/sphinx_rtd_theme
.. _github: https://github.com/readthedocs/sphinx_rtd_theme
"""
@@ -86,7 +86,7 @@ class TransifexCommand(distutils.cmd.Command):
setup(
name='sphinx_rtd_theme',
version='0.5.0',
url='https://github.com/rtfd/sphinx_rtd_theme/',
url='https://github.com/readthedocs/sphinx_rtd_theme',
license='MIT',
author='Dave Snider, Read the Docs, Inc. & contributors',
author_email='dev@readthedocs.org',
+9 -7
View File
@@ -24,6 +24,8 @@
{% set display_gitlab = True %}
{% endif %}
{% set display_vcs_links = display_vcs_links if display_vcs_links is defined else True %}
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
@@ -36,27 +38,27 @@
{% endblock %}
{% block breadcrumbs_aside %}
<li class="wy-breadcrumbs-aside">
{% if hasdoc(pagename) %}
{% if display_github %}
{% if hasdoc(pagename) and display_vcs_links %}
{% if display_github %}
{% if check_meta and 'github_url' in meta %}
<!-- User defined GitHub URL -->
<a href="{{ meta['github_url'] }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
{% else %}
<a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/{{ theme_vcs_pageview_mode|default("blob") }}/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
<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>
{% endif %}
{% elif display_bitbucket %}
{% if check_meta and 'bitbucket_url' in meta %}
<!-- User defined Bitbucket URL -->
<a href="{{ meta['bitbucket_url'] }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
{% else %}
<a href="https://bitbucket.org/{{ bitbucket_user }}/{{ bitbucket_repo }}/src/{{ bitbucket_version}}{{ conf_py_path }}{{ pagename }}{{ suffix }}?mode={{ theme_vcs_pageview_mode|default("view") }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
<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>
{% endif %}
{% elif display_gitlab %}
{% if check_meta and 'gitlab_url' in meta %}
<!-- User defined GitLab URL -->
<a href="{{ meta['gitlab_url'] }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
{% else %}
<a href="https://{{ gitlab_host|default("gitlab.com") }}/{{ gitlab_user }}/{{ gitlab_repo }}/{{ theme_vcs_pageview_mode|default("blob") }}/{{ gitlab_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
<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>
{% endif %}
{% elif show_source and source_url_prefix %}
<a href="{{ source_url_prefix }}{{ pagename }}{{ suffix }}">{{ _('View page source') }}</a>
@@ -71,10 +73,10 @@
{% if (theme_prev_next_buttons_location == 'top' or theme_prev_next_buttons_location == 'both') and (next or prev) %}
<div class="rst-breadcrumbs-buttons" role="navigation" aria-label="breadcrumb navigation">
{% if next %}
<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"></span></a>
<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>
{% endif %}
{% if prev %}
<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"></span> {{ _('Previous') }}</a>
<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>
{% endif %}
</div>
{% endif %}
+8 -10
View File
@@ -2,10 +2,10 @@
{% 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 %}
<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>
<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 %}
{% 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"></span> {{ _('Previous') }}</a>
<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 %}
</div>
{% endif %}
@@ -16,12 +16,9 @@
<p>
{%- if show_copyright %}
{%- if hasdoc('copyright') %}
{% set path = pathto('copyright') %}
{% set copyright = copyright|e %}
&copy; <a href="{{ path }}">{% trans %}Copyright{% endtrans %}</a> {{ copyright }}
{% trans path=pathto('copyright'), copyright=copyright|e %}&#169; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
{%- else %}
{% set copyright = copyright|e %}
&copy; {% trans %}Copyright{% endtrans %} {{ copyright }}
{% trans copyright=copyright|e %}&#169; Copyright {{ copyright }}.{% endtrans %}
{%- endif %}
{%- endif %}
@@ -36,7 +33,8 @@
{# Translators: the phrase "revision" comes from Git, referring to a commit #}
{% trans %}Revision{% endtrans %} <code>{{ commit }}</code>.
</span>
{%- elif last_updated %}
{%- endif %}
{%- if last_updated %}
<span class="lastupdated">
{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
</span>
@@ -46,12 +44,12 @@
</div>
{%- if show_sphinx %}
{% set sphinx_web = '<a href="http://sphinx-doc.org/">Sphinx</a>' %}
{% 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 documenation #}
<a href="https://github.com/rtfd/sphinx_rtd_theme">{% trans %}theme{% endtrans %}</a>
<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 %}
+6 -3
View File
@@ -12,9 +12,9 @@
<!DOCTYPE html>
<html class="{{ sphinx_writer }}" lang="{{ lang_attr }}" >
<head>
<meta charset="utf-8">
<meta charset="utf-8" />
{{ metatags }}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{% block htmltitle %}
<title>{{ title|striptags|e }}{{ titlesuffix }}</title>
{% endblock %}
@@ -118,7 +118,7 @@
{% if logo and theme_logo_only %}
<a href="{{ pathto(master_doc) }}">
{% else %}
<a href="{{ pathto(master_doc) }}" class="icon icon-home" alt="{{ _("Documentation Home") }}"> {{ project }}
<a href="{{ pathto(master_doc) }}" class="icon icon-home"> {{ project }}
{% endif %}
{% if logo %}
@@ -229,6 +229,9 @@
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{ theme_analytics_id }}', 'auto');
{% if theme_analytics_anonymize_ip|tobool %}
ga('set', 'anonymizeIp', true);
{% endif %}
ga('send', 'pageview');
</script>
-54
View File
@@ -1,54 +0,0 @@
{#
basic/search.html
~~~~~~~~~~~~~~~~~
Template for the search page.
:copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
#}
{%- extends "layout.html" %}
{% set title = _('Search') %}
{%- block scripts %}
{{ super() }}
<script type="text/javascript" src="{{ pathto('_static/searchtools.js', 1) }}"></script>
{%- endblock %}
{% block footer %}
<script type="text/javascript">
jQuery(function() { Search.loadIndex("{{ pathto('searchindex.js', 1) }}"); });
</script>
{# this is used when loading the search index using $.ajax fails,
such as on Chrome for documents on localhost #}
<script type="text/javascript" id="searchindexloader"></script>
{{ super() }}
{% endblock %}
{% block body %}
<noscript>
<div id="fallback" class="admonition warning">
<p class="last">
{% trans trimmed %}Please activate JavaScript to enable the search
functionality.{% endtrans %}
</p>
</div>
</noscript>
{% if search_performed %}
{# Translators: Search is a noun, not a verb #}
<h2>{{ _('Search Results') }}</h2>
{% if not search_results %}
<p>{{ _('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.') }}</p>
{% endif %}
{% endif %}
<div id="search-results">
{% if search_results %}
<ul>
{% for href, caption, context in search_results %}
<li>
<a href="{{ pathto(item.href) }}">{{ caption }}</a>
<p class="context">{{ context|e }}</p>
</li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endblock %}
+1 -1
View File
@@ -1,4 +1,4 @@
{%- if builder != 'singlehtml' %}
{%- if pagename != "search" and 'singlehtml' not in builder %}
<div role="search">
<form id="rtd-search-form" class="wy-form" action="{{ pathto('search') }}" method="get">
<input type="text" name="q" placeholder="{{ _('Search docs') }}" />
+3 -1
View File
@@ -6,6 +6,7 @@ pygments_style = default
[options]
canonical_url =
analytics_id =
analytics_anonymize_ip = False
collapse_navigation = True
sticky_navigation = True
navigation_depth = 4
@@ -15,4 +16,5 @@ logo_only =
display_version = True
prev_next_buttons_location = bottom
style_external_links = False
style_nav_header_background =
style_nav_header_background =
vcs_pageview_mode =
+4 -7
View File
@@ -1,10 +1,5 @@
[tox]
envlist = py{27,36,37}-sphinx{16,17,18,20,21,22,23,24,30}
[tox:travis]
2.7 = py27-sphinx{16,17,18,20,21,22,23,24,30}
3.6 = py36-sphinx{16,17,18,20,21,22,23,24,30}
3.7 = py37-sphinx{16,17,18,20,21,22,23,24,30}
envlist = py{27,36,37,38,39}-sphinx{16,17,18,20,21,22,23,24,30,31,32}
[testenv]
setev =
@@ -23,6 +18,8 @@ deps =
sphinx23: Sphinx < 2.4
sphinx24: Sphinx < 2.5
sphinx30: Sphinx < 3.1
sphinx31: Sphinx < 3.2
sphinx32: Sphinx < 3.3
commands =
py.test {posargs} tests/
pytest {posargs} tests/
sphinx-build -b html -d {envtmpdir}/doctrees docs/ {envtmpdir}/html