Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide entry_points for loading the theme #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,8 @@ Add the following to your conf.py:

.. code-block:: python

import guzzle_sphinx_theme

html_theme_path = guzzle_sphinx_theme.html_theme_path()
html_theme = 'guzzle_sphinx_theme'

# Register the theme as an extension to generate a sitemap.xml
extensions.append("guzzle_sphinx_theme")

# Guzzle theme options (see theme.conf for more information)
html_theme_options = {
# Set the name of the project to appear in the sidebar
Expand All @@ -41,14 +35,8 @@ example shows:

.. code-block:: python

import guzzle_sphinx_theme

html_theme_path = guzzle_sphinx_theme.html_theme_path()
html_theme = 'guzzle_sphinx_theme'

# Register the theme as an extension to generate a sitemap.xml
extensions.append("guzzle_sphinx_theme")

# Guzzle theme options (see theme.conf for more information)
html_theme_options = {

Expand Down
8 changes: 8 additions & 0 deletions guzzle_sphinx_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@

def setup(app):
"""Setup conntects events to the sitemap builder"""
app.require_sphinx('1.6') # For add_html_theme()
app.add_html_theme(
'guzzle_sphinx_theme',
os.path.abspath(os.path.join(os.path.dirname(__file__),
'guzzle_sphinx_theme')))
app.connect('html-page-context', add_html_link)
app.connect('build-finished', create_sitemap)
app.set_translator('html', HTMLTranslator)
app.sitemap_links = []
return {
'parallel_read_safe': True,
}


def add_html_link(app, pagename, templatename, context, doctree):
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
url='https://github.com/guzzle/guzzle_sphinx_theme',
packages=['guzzle_sphinx_theme'],
include_package_data=True,
install_requires=['Sphinx>1.3'],
install_requires=['Sphinx>=1.6'],
license="MIT",
classifiers=(
'Development Status :: 3 - Alpha',
Expand All @@ -19,4 +19,9 @@
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
),
entry_points={
'sphinx.html_themes': [
'guzzle_sphinx_theme = guzzle_sphinx_theme',
]
},
)