Skip to content

Commit

Permalink
Use different file instead of ifconfig
Browse files Browse the repository at this point in the history
Unfortunately, Sphinx did not regard ifconfig when parsing the toc,
so it could not be used. Instead, we simply copy a different file.
  • Loading branch information
Cito committed Feb 6, 2016
1 parent 5e7bf13 commit 92bf320
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 24 deletions.
7 changes: 6 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import sys
import os
import shlex
import shutil

# Import Cloud theme (this will also automatically add the theme directory).
# Note: We add a navigation bar to the cloud them using a custom layout.
Expand All @@ -27,6 +28,8 @@
except ImportError:
use_cloud_theme = False

shutil.copyfile('start.txt' if use_cloud_theme else 'toc.txt', 'index.rst')

# 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
# documentation root, use os.path.abspath to make it absolute, like shown here.
Expand Down Expand Up @@ -142,7 +145,9 @@

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = None if use_cloud_theme else 'PyGreSQL %s' % version
html_title = 'PyGreSQL %s' % version
if use_cloud_theme:
html_title += ' documentation'

# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
Expand Down
32 changes: 9 additions & 23 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
.. PyGreSQL documentation master file
.. PyGreSQL index page without toc (for use with cloud theme)
Welcome to PyGreSQL
===================

.. ifconfig:: html_theme != 'cloud'
.. toctree::
:hidden:

.. toctree::
:maxdepth: 2
copyright
announce
download/index
contents/index
community/index

about
copyright
announce
download/index
contents/index
community/index

.. ifconfig:: html_theme == 'cloud'

.. toctree::
:hidden:

copyright
announce
download/index
contents/index
community/index

.. include:: about.txt
.. include:: about.txt
15 changes: 15 additions & 0 deletions docs/start.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.. PyGreSQL index page without toc (for use with cloud theme)

Welcome to PyGreSQL
===================

.. toctree::
:hidden:

copyright
announce
download/index
contents/index
community/index

.. include:: about.txt
14 changes: 14 additions & 0 deletions docs/toc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.. PyGreSQL index page with toc (for use without cloud theme)

Welcome to PyGreSQL
===================

.. toctree::
:maxdepth: 2

about
copyright
announce
download/index
contents/index
community/index

0 comments on commit 92bf320

Please sign in to comment.