Merge branch 'master' into fix-459

This commit is contained in:
Aaron Carlisle 2017-12-21 16:55:14 -05:00 committed by GitHub
commit 813a321117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 106 additions and 192 deletions

View File

@ -4,8 +4,16 @@ python:
- 3.4 - 3.4
- 3.5 - 3.5
- 3.6 - 3.6
matrix:
include:
- python: 2.7
env: TOXENV=docs
sudo: false sudo: false
install: install:
- pip install tox-travis - pip install tox-travis
script: script:
- tox - tox
branches:
only:
- master

View File

@ -6,7 +6,7 @@
.. _wyrm: http://www.github.com/snide/wyrm/ .. _wyrm: http://www.github.com/snide/wyrm/
.. _grunt: http://www.gruntjs.com .. _grunt: http://www.gruntjs.com
.. _node: http://www.nodejs.com .. _node: http://www.nodejs.com
.. _demo: http://docs.readthedocs.org .. _demo: https://sphinx-rtd-theme.readthedocs.io/en/latest/
.. _hidden: http://sphinx-doc.org/markup/toctree.html .. _hidden: http://sphinx-doc.org/markup/toctree.html
.. image:: https://img.shields.io/pypi/v/sphinx_rtd_theme.svg .. image:: https://img.shields.io/pypi/v/sphinx_rtd_theme.svg
@ -16,12 +16,16 @@
.. image:: https://img.shields.io/pypi/l/sphinx_rtd_theme.svg .. image:: https://img.shields.io/pypi/l/sphinx_rtd_theme.svg
:target: https://pypi.python.org/pypi/sphinx_rtd_theme/ :target: https://pypi.python.org/pypi/sphinx_rtd_theme/
:alt: license :alt: license
.. image:: https://readthedocs.org/projects/sphinx-rtd-theme/badge/?version=latest
:target: http://sphinx-rtd-theme.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
************************** **************************
Read the Docs Sphinx Theme Read the Docs Sphinx Theme
************************** **************************
.. contents:: .. contents::
:backlinks: none
View a working demo_ over on readthedocs.org_. View a working demo_ over on readthedocs.org_.
@ -31,9 +35,6 @@ If you'd like to update the theme,
please make your edits to the SASS files here, please make your edits to the SASS files here,
rather than the .css files on checked into the repo. rather than the .css files on checked into the repo.
.. image:: demo_docs/source/static/screen_mobile.png
:width: 100%
Installation Installation
============ ============

View File

@ -1,153 +0,0 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/SphinxRTDthemedemo.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/SphinxRTDthemedemo.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/SphinxRTDthemedemo"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/SphinxRTDthemedemo"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

20
docs/Makefile Normal file
View File

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = ReadtheDocsSphinxTheme
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

View File

@ -14,8 +14,11 @@
import sys import sys
import os import os
sys.path.append(os.path.abspath('.'))
sys.path.append(os.path.abspath('./test_py_module')) sys.path.append(os.path.abspath('..'))
sys.path.append(os.path.abspath('./demo/'))
from sphinx_rtd_theme import __version__
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
@ -52,17 +55,17 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
project = u'Sphinx RTD theme demo' project = u'Read the Docs Sphinx Theme'
copyright = u'2013, Dave Snider' copyright = u'Read the Docs, Inc & contributors'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '0.2.4' version = __version__
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '0.2.4' release = __version__
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
@ -126,7 +129,7 @@ html_theme_path = ["../.."]
# The name of an image file (relative to this directory) to place at the top # The name of an image file (relative to this directory) to place at the top
# of the sidebar. # of the sidebar.
html_logo = "static/logo-wordmark-light.svg" html_logo = "demo/static/logo-wordmark-light.svg"
# The name of an image file (within the static path) to use as favicon of the # The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32

View File

@ -1,7 +1,5 @@
Read the Docs Theme Demo
***************************** ************************
Read the Docs Theme Demo Docs
*****************************
These documents are used to test and stress test the Read the Docs Theme. These documents are used to test and stress test the Read the Docs Theme.

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 137 KiB

View File

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 84 KiB

View File

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

13
docs/index.rst Normal file
View File

@ -0,0 +1,13 @@
.. include:: ../README.rst
Content
=======
.. toctree::
:caption: Theme
.. toctree::
:caption: Demo
demo/index

2
docs/requirements.txt Normal file
View File

@ -0,0 +1,2 @@
sphinxcontrib.httpdomain
sphinx

View File

@ -15,17 +15,22 @@ function ThemeNav () {
isRunning: false isRunning: false
}; };
nav.enable = function () { nav.enable = function (withStickyNav) {
var self = this; var self = this;
if (!self.isRunning) { if (self.isRunning) {
self.isRunning = true; // Only allow enabling nav logic once
jQuery(function ($) { return;
self.init($); }
self.reset(); self.isRunning = true;
self.win.on('hashchange', self.reset); jQuery(function ($) {
self.init($);
self.reset();
self.win.on('hashchange', self.reset);
if (withStickyNav) {
// Set scroll monitor // Set scroll monitor
self.win.on('scroll', function () { self.win.on('scroll', function () {
if (!self.linkScroll) { if (!self.linkScroll) {
@ -35,18 +40,23 @@ function ThemeNav () {
} }
} }
}); });
}
// Set resize monitor // Set resize monitor
self.win.on('resize', function () { self.win.on('resize', function () {
if (!self.winResize) { if (!self.winResize) {
self.winResize = true; self.winResize = true;
requestAnimationFrame(function() { self.onResize(); }); requestAnimationFrame(function() { self.onResize(); });
} }
});
self.onResize();
}); });
};
self.onResize();
});
};
nav.enableSticky = function() {
this.enable(true);
}; };
nav.init = function ($) { nav.init = function ($) {
@ -176,7 +186,7 @@ function ThemeNav () {
module.exports.ThemeNav = ThemeNav(); module.exports.ThemeNav = ThemeNav();
if (typeof(window) != 'undefined') { if (typeof(window) != 'undefined') {
window.SphinxRtdTheme = { StickyNav: module.exports.ThemeNav }; window.SphinxRtdTheme = { Navigation: module.exports.ThemeNav };
} }

View File

@ -161,7 +161,10 @@
// These are the little citation links [1] that show up within paragraphs. // These are the little citation links [1] that show up within paragraphs.
.footnote-reference, .citation-reference .footnote-reference, .citation-reference
vertical-align: super vertical-align: baseline
position: relative
top: -0.4em
line-height: 0
font-size: 90% font-size: 90%
// Tables! Sphinx LOVES TABLES. Most of wyrm assumes you're only going to use a table as a table // Tables! Sphinx LOVES TABLES. Most of wyrm assumes you're only going to use a table as a table

View File

@ -209,14 +209,15 @@
<script type="text/javascript" src="{{ pathto('_static/js/theme.js', 1) }}"></script> <script type="text/javascript" src="{{ pathto('_static/js/theme.js', 1) }}"></script>
{% endif %} {% endif %}
{# STICKY NAVIGATION #}
{% if theme_sticky_navigation|tobool %}
<script type="text/javascript"> <script type="text/javascript">
jQuery(function () { jQuery(function () {
SphinxRtdTheme.StickyNav.enable(); {% if theme_sticky_navigation|tobool %}
SphinxRtdTheme.Navigation.enableSticky();
{% else %}
SphinxRtdTheme.Navigation.enable();
{% endif %}
}); });
</script> </script>
{% endif %}
{%- block footer %} {% endblock %} {%- block footer %} {% endblock %}

10
tox.ini
View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist = py{27,34,35,36}-sphinx{13,14,15} envlist = py{27,34,35,36}-sphinx{13,14,15,16}, docs
[tox:travis] [tox:travis]
2.7 = py27-sphinx{13,14,15} 2.7 = py27-sphinx{13,14,15}
@ -17,5 +17,13 @@ deps =
sphinx13: Sphinx < 1.4 sphinx13: Sphinx < 1.4
sphinx14: Sphinx < 1.5 sphinx14: Sphinx < 1.5
sphinx15: Sphinx < 1.6 sphinx15: Sphinx < 1.6
sphinx16: Sphinx < 1.7
commands = commands =
py.test {posargs} py.test {posargs}
[testenv:docs]
changedir = {toxinidir}/docs
deps =
-r{toxinidir}/docs/requirements.txt
commands =
sphinx-build -b html -d {envtmpdir}/doctrees . {envtmpdir}/html