Skip to content
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
59 changes: 29 additions & 30 deletions sphinx_bootstrap_theme/bootstrap/static/bootstrap-sphinx.css_t
Original file line number Diff line number Diff line change
Expand Up @@ -117,56 +117,55 @@ td.field-body {

/* First level of nav */
.bs-sidenav {
top: 80px;
// margin-top: 30px;
// margin-bottom: 30px;
// padding-top: 10px;
// padding-bottom: 10px;
// text-shadow: 0 1px 0 #fff;
// background-color: #f7f5fa;
// border-radius: 5px;
margin-top: 30px;
margin-bottom: 30px;
padding-top: 10px;
padding-bottom: 10px;
text-shadow: 0 1px 0 #fff;
background-color: #f7f5fa;
border-radius: 5px;
}

/* All levels of nav */
.bs-sidenav .nav > li > a {
// display: block;
// color: #716b7a;
// padding: 5px 20px;
display: block;
color: #716b7a;
padding: 5px 20px;
}
.bs-sidenav .nav > li > a:hover,
.bs-sidenav .nav > li > a:focus {
// text-decoration: none;
// background-color: #e5e3e9;
// border-right: 1px solid #dbd8e0;
text-decoration: none;
background-color: #e5e3e9;
border-right: 1px solid #dbd8e0;
}
.bs-sidenav .nav > .active > a,
.bs-sidenav .nav > .active:hover > a,
.bs-sidenav .nav > .active:focus > a {
// font-weight: bold;
// color: #563d7c;
// background-color: transparent;
// border-right: 1px solid #563d7c;
font-weight: bold;
color: #563d7c;
background-color: transparent;
border-right: 1px solid #563d7c;
}

.bs-sidenav .nav .nav > li > a {
// padding-top: 3px;
// padding-bottom: 3px;
// padding-left: 30px;
// font-size: 90%;
padding-top: 3px;
padding-bottom: 3px;
padding-left: 30px;
font-size: 90%;
}

.bs-sidenav .nav .nav .nav > li > a {
// padding-top: 3px;
// padding-bottom: 3px;
// padding-left: 40px;
// font-size: 90%;
padding-top: 3px;
padding-bottom: 3px;
padding-left: 40px;
font-size: 90%;
}

.bs-sidenav .nav .nav .nav .nav > li > a {
// padding-top: 3px;
// padding-bottom: 3px;
// padding-left: 50px;
// font-size: 90%;
padding-top: 3px;
padding-bottom: 3px;
padding-left: 50px;
font-size: 90%;
}

/* Show and affix the side nav when space allows it */
Expand Down
2 changes: 1 addition & 1 deletion sphinx_bootstrap_theme/example_module.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding=utf-8
"""Example Module to show of :py:mod:`sphinx.autodoc` features with **Twitter Bootstrap**.
"""Example Module to show off :py:mod:`sphinx.autodoc` features with **Bootstrap**.

.. moduleauthor:: Torbjörn Klatt <[email protected]>
"""
Expand Down
48 changes: 42 additions & 6 deletions sphinx_bootstrap_theme/html_bootstrap_translator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding=utf-8
"""A custom Sphinx HTML Translator for *Twitter Bootstrap* layout
"""A custom Sphinx HTML Translator for *Bootstrap* layout

.. moduleauthor:: Torbjörn Klatt <[email protected]>
"""
Expand Down Expand Up @@ -68,12 +68,12 @@ def debug_print(node):


class BootstrapTranslator(HTMLTranslator):
"""Custom HTML Translator for a Bootstrap-ifyied Sphinx layout
"""Custom HTML Translator for a Bootstrap-ified Sphinx layout

This is a specialization of the default HTML Translator of the docutils
package.
Only a couple of functions have been overridden to produce valid HTML to be
directly styled with *Twitter Bootstrap*.
directly styled with *Bootstrap*.
"""

# overridden
Expand Down Expand Up @@ -143,9 +143,9 @@ def visit_paragraph(self, node):
def visit_attribution(self, node):
"""Attribution line (e.g. in block quotes)

With *Twitter Bootstrap* we are able to style a special attribution
paragraph (read "*footer*") at the end of block quotes with the ReST
directive ``epigraph``.
With *Bootstrap* we are able to style a special attribution paragraph
(read "*footer*") at the end of block quotes with the ReST directive
``epigraph``.

.. admonition:: Example

Expand Down Expand Up @@ -341,6 +341,21 @@ def visit_list_item(self, node):
if len(node):
node[0]['classes'].append('first')

# overridden
def visit_hlist(self, node):
"""A hlist. Compact version of a list.
"""
atts = {'class': 'hlist'}
self.body.append(self.starttag(node, 'div', **atts))

def depart_hlist(self, node):
self.body.append('</div>')

def visit_hlistcol(self, node):
pass
def depart_hlistcol(self, node):
pass

# overridden
def visit_definition_list(self, node):
"""Bootstrap-ified Definition List
Expand Down Expand Up @@ -441,6 +456,12 @@ def depart_table(self, node):
self.compact_p = self.context.pop()
self.body.append('</table>\n')

# LaTeX only
def visit_tabular_col_spec(self, node):
pass
def depart_tabular_col_spec(self, node):
pass

def visit_desc(self, node):
self.body.append(
self.starttag(node, 'div',
Expand Down Expand Up @@ -768,3 +789,18 @@ def depart_literal(self, node):
if node.parent.tagname != 'reference':
self.protect_literal_text -= 1
self.body.append('</code>')

# autosummary extension
def visit_autosummary_table(self, node):
from sphinx.ext.autosummary import autosummary_table_visit_html
autosummary_table_visit_html(self, node)

def depart_autosummary_table(self, node):
pass

def visit_autosummary_toc(self, node):
from sphinx.ext.autosummary import autosummary_toc_visit_html
autosummary_toc_visit_html(self, node)

def depart_autosummary_toc(self, node):
pass