mirror of
https://github.com/readthedocs/sphinx_rtd_theme.git
synced 2025-02-25 18:55:21 -06:00
Merge branch 'master' into use-bumpversion
This commit is contained in:
7
docs/_static/debug.js
vendored
Normal file
7
docs/_static/debug.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Add debug actions to flyout menu
|
||||
|
||||
$(function () {
|
||||
$("[data-toggle='rst-debug-badge']").on("click", function () {
|
||||
$("[data-toggle='rst-versions']").toggleClass("rst-badge");
|
||||
});
|
||||
})
|
||||
55
docs/_templates/layout.html
vendored
Normal file
55
docs/_templates/layout.html
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
{%- extends "!layout.html" %}
|
||||
|
||||
{#
|
||||
|
||||
This template exists as a way to implement a version menu without changing what
|
||||
the theme normally renders the menu on local builds and on builds on Read the
|
||||
Docs. This is for local testing purposes only.
|
||||
|
||||
#}
|
||||
|
||||
{% block footer %}
|
||||
{% if not READTHEDOCS %}
|
||||
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
|
||||
<span class="rst-current-version" data-toggle="rst-current-version">
|
||||
<span class="fa fa-book"> Read the Docs</span>
|
||||
v: latest
|
||||
<span class="fa fa-caret-down"></span>
|
||||
</span>
|
||||
<div class="rst-other-versions">
|
||||
<dl>
|
||||
<dt>{{ _('Versions') }}</dt>
|
||||
{% if test_versions %}
|
||||
{% for version in test_versions %}
|
||||
<dd><a href="#">{{ version }}</a></dd>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<dd><a href="#">latest</a></dd>
|
||||
<dd><a href="#">1.0</a></dd>
|
||||
<dd><a href="#">1.1</a></dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{{ _('Downloads') }}</dt>
|
||||
<dd><a href="#">PDF</a></dd>
|
||||
<dd><a href="#">ePub</a></dd>
|
||||
<dd><a href="#">HTML</a></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
{# Translators: The phrase "Read the Docs" is not translated #}
|
||||
<dt>{{ _('On Read the Docs') }}</dt>
|
||||
<dd>
|
||||
<a href="#">{{ _('Project Home') }}</a>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="#">{{ _('Builds') }}</a>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>Debug</dt>
|
||||
<dd><a href="#" data-toggle="rst-debug-badge">Swap badge position</a></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
@@ -20,6 +20,7 @@ Other Changes
|
||||
* Added Spanish translation
|
||||
* Added i18n support using Babel
|
||||
* Moved build system from Grunt and friends to Webpack
|
||||
* Remove Modernizr, but keep html5shiv (#724, #525)
|
||||
|
||||
0.4.3
|
||||
======
|
||||
|
||||
33
docs/conf.py
33
docs/conf.py
@@ -4,10 +4,24 @@ import sys
|
||||
import os
|
||||
import re
|
||||
|
||||
if not 'READTHEDOCS' in os.environ:
|
||||
# If we are building locally, or the build on Read the Docs looks like a PR
|
||||
# build, prefer to use the version of the theme in this repo, not the installed
|
||||
# version of the theme.
|
||||
def is_development_build():
|
||||
# PR builds have an interger version
|
||||
re_version = re.compile(r'^[\d]+$')
|
||||
if 'READTHEDOCS' in os.environ:
|
||||
version = os.environ.get('READTHEDOCS_VERSION', '')
|
||||
if re_version.match(version):
|
||||
return True
|
||||
return False
|
||||
return True
|
||||
|
||||
if is_development_build():
|
||||
sys.path.insert(0, os.path.abspath('..'))
|
||||
sys.path.append(os.path.abspath('./demo/'))
|
||||
|
||||
import sphinx_rtd_theme
|
||||
from sphinx.locale import _
|
||||
|
||||
project = u'Read the Docs Sphinx Theme'
|
||||
@@ -44,14 +58,27 @@ intersphinx_mapping = {
|
||||
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_theme_options = {
|
||||
'logo_only': True
|
||||
'logo_only': True,
|
||||
'navigation_depth': 5,
|
||||
}
|
||||
html_theme_path = ["../.."]
|
||||
html_context = {}
|
||||
|
||||
if not 'READTHEDOCS' in os.environ:
|
||||
html_static_path = ['_static/']
|
||||
html_js_files = ['debug.js']
|
||||
|
||||
# Add fake versions for local QA of the menu
|
||||
html_context['test_versions'] = list(map(
|
||||
lambda x: str(x / 10),
|
||||
range(1, 100)
|
||||
))
|
||||
|
||||
html_logo = "demo/static/logo-wordmark-light.svg"
|
||||
html_show_sourcelink = True
|
||||
|
||||
htmlhelp_basename = slug
|
||||
|
||||
|
||||
latex_documents = [
|
||||
('index', '{0}.tex'.format(slug), project, author, 'manual'),
|
||||
]
|
||||
|
||||
@@ -98,10 +98,8 @@ Miscellaneous options
|
||||
|
||||
:type: string
|
||||
|
||||
Change the Google Analytics ID that is included on pages.
|
||||
|
||||
.. warning::
|
||||
This configuration option is not yet used.
|
||||
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:: canonical_url
|
||||
|
||||
|
||||
@@ -24,13 +24,13 @@ Set up your environment
|
||||
|
||||
.. code:: console
|
||||
|
||||
pip install -e '.[dev]'
|
||||
$ pip install -e '.[dev]'
|
||||
|
||||
#. Install Webpack_, node-sass_, and theme dependencies locally.
|
||||
|
||||
.. code:: console
|
||||
|
||||
npm install
|
||||
$ npm install
|
||||
|
||||
Making changes
|
||||
--------------
|
||||
@@ -39,7 +39,7 @@ Changes to the theme can be compiled and tested with Webpack_:
|
||||
|
||||
.. code:: console
|
||||
|
||||
npm run dev
|
||||
$ npm run dev
|
||||
|
||||
This script will do the following:
|
||||
|
||||
@@ -54,7 +54,7 @@ can be used to test built assets:
|
||||
|
||||
.. code:: console
|
||||
|
||||
npm run build
|
||||
$ npm run build
|
||||
|
||||
.. _Webpack: https://webpack.js.org/
|
||||
.. _node-sass: https://github.com/sass/node-sass
|
||||
@@ -76,7 +76,7 @@ the following:
|
||||
|
||||
.. code:: console
|
||||
|
||||
python setup.py update_translations
|
||||
$ python setup.py update_translations
|
||||
|
||||
This will extract new messages, upload the messages to Transifex, and will
|
||||
update our local translation files. Changes can be checked in to a branch and
|
||||
@@ -99,17 +99,19 @@ To release a new version of the theme, core team will take the following steps:
|
||||
run ``bump2version --allow-dirty releast`` to update the release to an ``rc``
|
||||
release. If this is a final release, run the command again.
|
||||
#. Update the changelog (``docs/changelog.rst``) with the version information.
|
||||
#. Run ``python setup.py build`` to rebuild all the theme assets.
|
||||
#. Run ``python setup.py update_translations`` to compile new translation files and update Transifex
|
||||
#. Commit that change.
|
||||
#. Run ``python setup.py update_translations`` to compile new translation files
|
||||
and update Transifex.
|
||||
#. Run ``python setup.py build`` to rebuild all the theme assets and the Python
|
||||
package.
|
||||
#. Commit these changes.
|
||||
#. Tag the release in git: ``git tag $NEW_VERSION``.
|
||||
#. Push the tag to GitHub: ``git push --tags origin``.
|
||||
#. Upload the package to PyPI:
|
||||
|
||||
.. code:: console
|
||||
|
||||
rm -rf dist/
|
||||
python setup.py sdist bdist_wheel
|
||||
twine upload --sign --identity security@readthedocs.org dist/*
|
||||
$ rm -rf dist/
|
||||
$ python setup.py sdist bdist_wheel
|
||||
$ twine upload --sign --identity security@readthedocs.org dist/*
|
||||
|
||||
.. _PEP440: https://www.python.org/dev/peps/pep-0440/
|
||||
|
||||
@@ -6,7 +6,7 @@ Install the package (or add it to your ``requirements.txt`` file):
|
||||
|
||||
.. code:: console
|
||||
|
||||
pip install sphinx_rtd_theme
|
||||
$ pip install sphinx_rtd_theme
|
||||
|
||||
In your ``conf.py`` file:
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
sphinx
|
||||
sphinx>=3.0
|
||||
sphinxcontrib-httpdomain
|
||||
|
||||
Reference in New Issue
Block a user