Skip to content

Commit

Permalink
Using caption with different toc sections instead of JS/CSS hack.
Browse files Browse the repository at this point in the history
This fits within the Sphinx construct and would allow our docs to
be built on readthedocs.org.
  • Loading branch information
dhermes committed Aug 4, 2015
1 parent 9f5b229 commit 865a78a
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 17 deletions.
12 changes: 12 additions & 0 deletions docs/_static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,18 @@ h2 .headerlink:hover {
margin-top: 2em;
}

.side-nav > ul > li.toctree-l1 {
padding-left: 2em;
}

p.caption {
padding-left: 2em;
}

span.caption-text {
font-weight: bold;
}

.external-links img {
margin-right: 0.3em;
opacity: 0.3;
Expand Down
10 changes: 0 additions & 10 deletions docs/_static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ $('.headerlink').parent().each(function() {
);
});

$('.side-nav').children('ul:nth-child(2)').children().each(function() {
var itemName = $(this).text();
if (itemName !== 'Datastore' &&
itemName !== 'Storage' &&
itemName !== 'Pub/Sub' &&
itemName !== 'BigQuery') {
$(this).css('padding-left','2em');
}
});

var apiQsSection;
// don't even ask me why
if ($('#cloud-datastore-in-10-seconds').length)
Expand Down
1 change: 0 additions & 1 deletion docs/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ <h1 class="page-title">Python</h1>
{% block body %} {% endblock %}
</section><!-- end of .content -->
<nav class="side-nav">
<ul><li><a href="{{ pathto('index') }}">gcloud</a></li></ul>
{{ toctree(includehidden=True, maxdepth=1, titles_only=True) }}
<ul class="external-links">
<li>
Expand Down
19 changes: 14 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
import sys
import urllib

import sphinx_rtd_theme


ON_READ_THE_DOCS = os.environ.get('READTHEDOCS', None) == 'True'
LOCAL_READ_THE_DOCS = os.environ.get('LOCAL_RTD', None) == 'True'

# 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 All @@ -38,7 +44,10 @@
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
if ON_READ_THE_DOCS or LOCAL_READ_THE_DOCS:
templates_path = []
else:
templates_path = ['_templates']

# The suffix of source filenames.
source_suffix = '.rst'
Expand Down Expand Up @@ -103,10 +112,10 @@

html_theme = 'classic'

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
html_style = 'default.css'
else:
if LOCAL_READ_THE_DOCS:
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
elif not ON_READ_THE_DOCS:
html_style = 'css/main.css'

# Theme options are theme-specific and customize the look and feel of a theme
Expand Down
25 changes: 25 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,23 +1,48 @@
.. toctree::
:maxdepth: 0
:hidden:
:caption: gcloud

gcloud-api

.. toctree::
:maxdepth: 0
:hidden:
:caption: Datastore

datastore-overview
datastore-client
datastore-entities
datastore-keys
datastore-queries
datastore-transactions
datastore-batches

.. toctree::
:maxdepth: 0
:hidden:
:caption: Storage

storage-api
storage-blobs
storage-buckets
storage-acl

.. toctree::
:maxdepth: 0
:hidden:
:caption: Pub/Sub

pubsub-api
pubsub-usage
pubsub-topic
pubsub-subscription

.. toctree::
:maxdepth: 0
:hidden:
:caption: BigQuery

bigquery-usage


Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ commands =
sphinx-build -W -b html -d docs/_build/doctrees docs docs/_build/html
deps =
Sphinx
passenv = {[testenv:system-tests]passenv} SPHINX_RELEASE
passenv = {[testenv:system-tests]passenv} SPHINX_RELEASE READTHEDOCS LOCAL_RTD

[pep8]
exclude = gcloud/datastore/_datastore_v1_pb2.py,docs/conf.py
Expand Down

0 comments on commit 865a78a

Please sign in to comment.