Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.

Commit 3a9e270

Browse files
committed
add the bootstrap them and update conf.py
1 parent de13b0c commit 3a9e270

File tree

77 files changed

+20099
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+20099
-13
lines changed

source/conf.py

Lines changed: 91 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
import sys
1818
import os
1919

20-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
20+
sys.path.insert(0, os.path.abspath('../'))
21+
import sphinx_bootstrap_theme
2122

2223
# If extensions (or modules to document with autodoc) are in another directory,
2324
# add these directories to sys.path here. If the directory is relative to the
@@ -32,7 +33,7 @@
3233
# Add any Sphinx extension module names here, as strings. They can be
3334
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3435
# ones.
35-
extensions = []
36+
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode']
3637

3738
# Add any paths that contain templates here, relative to this directory.
3839
templates_path = ['_templates']
@@ -59,9 +60,9 @@
5960
# built documents.
6061
#
6162
# The short X.Y version.
62-
version = '4'
63+
version = '4.5'
6364
# The full version, including alpha/beta/rc tags.
64-
release = '4.5'
65+
release = '4.5.0'
6566

6667
# The language for content autogenerated by Sphinx. Refer to documentation
6768
# for a list of supported languages.
@@ -105,14 +106,87 @@
105106

106107
# The theme to use for HTML and HTML Help pages. See the documentation for
107108
# a list of builtin themes.
108-
html_theme = 'default'
109-
if not on_rtd:
110-
try:
111-
import sphinx_rtd_theme
112-
html_theme = 'sphinx_rtd_theme'
113-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
114-
except ImportError:
115-
pass
109+
html_theme = 'bootstrap'
110+
html_theme_options = {
111+
# Navigation bar title. (Default: ``project`` value)
112+
'navbar_title': "Administration Guide",
113+
114+
# Tab name for entire site. (Default: "Site")
115+
'navbar_site_name': "Sections",
116+
117+
# Tab name for the current pages TOC. (Default: "Page")
118+
#'navbar_pagenav_name': "Page",
119+
'navbar_pagenav': "false",
120+
# A list of tuples containing pages or urls to link to.
121+
# Valid tuples should be in the following forms:
122+
# (name, page) # a link to a page
123+
# (name, "/aa/bb", 1) # a link to an arbitrary relative url
124+
# (name, "http://example.com", True) # arbitrary absolute url
125+
# Note the "1" or "True" value above as the third argument to indicate
126+
# an arbitrary url.
127+
# 'navbar_links': [
128+
# ("Examples", "examples"),
129+
# ("Link", "http://example.com", True),
130+
# ],
131+
132+
# Global TOC depth for "site" navbar tab. (Default: 1)
133+
# Switching to -1 shows all levels.
134+
'globaltoc_depth': 1,
135+
136+
# Include hidden TOCs in Site navbar?
137+
#
138+
# Note: If this is "false", you cannot have mixed ``:hidden:`` and
139+
# non-hidden ``toctree`` directives in the same page, or else the build
140+
# will break.
141+
#
142+
# Values: "true" (default) or "false"
143+
'globaltoc_includehidden': "false",
144+
145+
# HTML navbar class (Default: "navbar") to attach to <div> element.
146+
# For black navbar, do "navbar navbar-inverse"
147+
'navbar_class': "navbar",
148+
149+
# Fix navigation bar to top of page?
150+
# Values: "true" (default) or "false"
151+
'navbar_fixed_top': "true",
152+
153+
# Location of link to source.
154+
# Options are "nav" (default), "footer" or anything else to exclude.
155+
'source_link_position': "footer",
156+
157+
# Bootswatch (http://bootswatch.com/) theme.
158+
#
159+
# Options are nothing (default) or the name of a valid theme such
160+
# as "amelia" or "cosmo".
161+
#
162+
# Themes:
163+
# * amelia
164+
# * cerulean
165+
# * cosmo
166+
# * cyborg
167+
# * cupid (v3 only)
168+
# * flatly
169+
# * journal
170+
# * lumen (v3 only)
171+
# * readable
172+
# * simplex
173+
# * slate
174+
# * spacelab
175+
# * spruce (v2 only)
176+
# * superhero
177+
# * united
178+
# * yeti (v3 only)
179+
'bootswatch_theme': "flatly",
180+
181+
# Choose Bootstrap version.
182+
# Values: "3" (default) or "2" (in quotes)
183+
'bootstrap_version': "3",
184+
}
185+
186+
# Add any paths that contain custom themes here, relative to this directory.
187+
# ``get_html_theme_path`` returns a list, so you can concatenate with
188+
# any other theme directories you would like.
189+
html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()
116190

117191
# Theme options are theme-specific and customize the look and feel of a theme
118192
# further. For a list of options available for each theme, see the
@@ -158,6 +232,10 @@
158232

159233
# Custom sidebar templates, maps document names to template names.
160234
#html_sidebars = {}
235+
html_sidebars = {
236+
'**': ['localtoc.html'],
237+
'index': ['globaltoc.html']
238+
}
161239

162240
# Additional templates that should be rendered to pages, maps page names to
163241
# template names.
@@ -176,7 +254,7 @@
176254
#html_show_sourcelink = True
177255

178256
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
179-
#html_show_sphinx = True
257+
html_show_sphinx = False
180258

181259
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
182260
#html_show_copyright = True

sphinx_bootstrap_theme/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""Sphinx bootstrap theme."""
2+
import os
3+
4+
VERSION = (0, 4, 5)
5+
6+
__version__ = ".".join(str(v) for v in VERSION)
7+
__version_full__ = __version__
8+
9+
def get_html_theme_path():
10+
"""Return list of HTML theme paths."""
11+
cur_dir = os.path.abspath(os.path.dirname(__file__))
12+
return [cur_dir]

sphinx_bootstrap_theme/__init__.pyc

972 Bytes
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{ toctree(maxdepth=theme_globaltoc_depth|toint, collapse=False, includehidden=theme_globaltoc_includehidden|tobool) }}
2+
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
{% extends "basic/layout.html" %}
2+
3+
{% set theme_css_files = [] %}
4+
{% if theme_bootstrap_version == "3" %}
5+
{% set bootstrap_version, bootstrap_additional_css, navbar_version = "3.2.0", "theme", "" %}
6+
{% set bs_span_prefix = "col-md-" %}
7+
{% else %}
8+
{% set bootstrap_version, bootstrap_additional_css, navbar_version = "2.3.2", "responsive", "-2" %}
9+
{% set bs_span_prefix = "span" %}
10+
{% endif %}
11+
12+
{% if theme_bootswatch_theme and theme_bootswatch_theme != "\"\"" %}
13+
{# BS2 needs "bootstrap-responsive.css". BS3 doesn't. #}
14+
{% if theme_bootstrap_version == "3" %}
15+
{% set theme_css_files = theme_css_files + [
16+
'_static/bootswatch-' + bootstrap_version + '/' + theme_bootswatch_theme + '/bootstrap.min.css',
17+
'_static/bootstrap-sphinx.css'
18+
]
19+
%}
20+
{% else %}
21+
{% set theme_css_files = theme_css_files + [
22+
'_static/bootswatch-' + bootstrap_version + '/' + theme_bootswatch_theme + '/bootstrap.min.css',
23+
'_static/bootstrap-' + bootstrap_version + '/css/bootstrap-' + bootstrap_additional_css + '.min.css',
24+
'_static/bootstrap-sphinx.css'
25+
]
26+
%}
27+
{% endif %}
28+
{% else %}
29+
{% set theme_css_files = theme_css_files + [
30+
'_static/bootstrap-' + bootstrap_version + '/css/bootstrap.min.css',
31+
'_static/bootstrap-' + bootstrap_version + '/css/bootstrap-' + bootstrap_additional_css + '.min.css',
32+
'_static/bootstrap-sphinx.css'
33+
]
34+
%}
35+
{% endif %}
36+
37+
{% if not bootswatch_css_custom %}
38+
{% set bootswatch_css_custom = [] %}
39+
{% endif %}
40+
{% set css_files = css_files + theme_css_files + bootswatch_css_custom %}
41+
42+
{% set script_files = script_files + [
43+
'_static/js/jquery-1.11.0.min.js',
44+
'_static/js/jquery-fix.js',
45+
'_static/bootstrap-' + bootstrap_version + '/js/bootstrap.min.js',
46+
'_static/bootstrap-sphinx.js'
47+
]
48+
%}
49+
50+
{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) and sidebars %}
51+
52+
{%- set bs_content_width = render_sidebar and "9" or "12"%}
53+
54+
{%- block doctype -%}
55+
<!DOCTYPE html>
56+
{%- endblock %}
57+
58+
{# Sidebar: Rework into our Bootstrap nav section. #}
59+
{% macro navBar() %}
60+
{% include "navbar" + navbar_version + ".html" %}
61+
{% endmacro %}
62+
63+
{% if theme_bootstrap_version == "3" %}
64+
{%- macro bsidebar() %}
65+
{%- if render_sidebar %}
66+
<div class="{{ bs_span_prefix }}3">
67+
<div id="sidebar" class="bs-sidenav" role="complementary">
68+
{%- for sidebartemplate in sidebars %}
69+
{%- include sidebartemplate %}
70+
{%- endfor %}
71+
</div>
72+
</div>
73+
{%- endif %}
74+
{%- endmacro %}
75+
{% else %}
76+
{%- macro bsidebar() %}
77+
{%- if render_sidebar %}
78+
<div class="{{ bs_span_prefix }}3">
79+
<div id="sidebar" class="bs-sidenav well" data-spy="affix">
80+
{%- for sidebartemplate in sidebars %}
81+
{%- include sidebartemplate %}
82+
{%- endfor %}
83+
</div>
84+
</div>
85+
{%- endif %}
86+
{%- endmacro %}
87+
{% endif %}
88+
89+
{%- block extrahead %}
90+
<meta charset='utf-8'>
91+
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
92+
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
93+
<meta name="apple-mobile-web-app-capable" content="yes">
94+
{% endblock %}
95+
96+
{# Silence the sidebar's, relbar's #}
97+
{% block header %}{% endblock %}
98+
{% block relbar1 %}{% endblock %}
99+
{% block relbar2 %}{% endblock %}
100+
{% block sidebarsourcelink %}{% endblock %}
101+
102+
{%- block content %}
103+
{{ navBar() }}
104+
<div class="container">
105+
<div class="row">
106+
{%- block sidebar1 %}{{ bsidebar() }}{% endblock %}
107+
<div class="{{ bs_span_prefix }}{{ bs_content_width }}">
108+
{% block body %}{% endblock %}
109+
</div>
110+
{% block sidebar2 %} {# possible location for sidebar #} {% endblock %}
111+
</div>
112+
</div>
113+
{%- endblock %}
114+
115+
{%- block footer %}
116+
<footer class="footer">
117+
<div class="container">
118+
<p class="pull-right">
119+
<a href="#">Back to top</a>
120+
{%- if prev %}
121+
| <a href="{{ prev.link|e }}" title="{{ _('Previous Chapter: ') + prev.title|striptags }}">
122+
{%- if theme_bootstrap_version == "2" -%}<span class="icon-chevron-left visible-tablet"></span>{%- endif -%}
123+
{%- if theme_bootstrap_version == "3" -%}<span class="glyphicon glyphicon-chevron-left visible-sm"></span>{%- endif -%}
124+
<span class="hidden-sm hidden-tablet">{{ "&laquo;"|safe }} {{ prev.title|striptags|truncate(length=50, killwords=False) }}</span>
125+
</a>
126+
{%- endif %}
127+
{%- if next %}
128+
| <a href="{{ next.link|e }}" title="{{ _('Next Chapter: ') + next.title|striptags }}">
129+
{%- if theme_bootstrap_version == "2" -%}<span class="icon-chevron-right visible-tablet"></span>{%- endif -%}
130+
{%- if theme_bootstrap_version == "3" -%}<span class="glyphicon glyphicon-chevron-right visible-sm"></span>{%- endif -%}
131+
<span class="hidden-sm hidden-tablet">{{ next.title|striptags|truncate(length=50, killwords=False) }} {{ "&raquo;"|safe }}</span>
132+
</a>
133+
{%- endif %}
134+
{% if theme_source_link_position == "footer" %}
135+
<br/>
136+
{% include "sourcelink.html" %}
137+
{% endif %}
138+
</p>
139+
<p>
140+
{%- if show_copyright %}
141+
{%- if hasdoc('copyright') %}
142+
{% trans path=pathto('copyright'), copyright=copyright|e %}&copy; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}<br/>
143+
{%- else %}
144+
{% trans copyright=copyright|e %}&copy; Copyright {{ copyright }}.{% endtrans %}<br/>
145+
{%- endif %}
146+
{%- endif %}
147+
{%- if last_updated %}
148+
{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}<br/>
149+
{%- endif %}
150+
{%- if show_sphinx %}
151+
{% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx-doc.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}<br/>
152+
{%- endif %}
153+
</p>
154+
</div>
155+
</footer>
156+
{%- endblock %}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ toc }}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<div id="navbar" class="{{ theme_navbar_class }} {% if theme_navbar_fixed_top|tobool -%} navbar-fixed-top{%- endif -%}">
2+
<div class="navbar-inner">
3+
<div class="container">
4+
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
5+
<button class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
6+
<span class="icon-bar"></span>
7+
<span class="icon-bar"></span>
8+
<span class="icon-bar"></span>
9+
</button>
10+
11+
<a class="brand" href="{{ pathto(master_doc) }}">
12+
{%- block sidebarlogo %}
13+
{%- if logo %}<img src="{{ pathto('_static/' + logo, 1) }}">{%- endif %}
14+
{%- endblock %}
15+
{% if theme_navbar_title -%}{{ theme_navbar_title|e }}{%- else -%}{{ project|e }}{%- endif -%}
16+
</a>
17+
<span class="navbar-text pull-left"><b>{{ version|e }}</b></span>
18+
19+
<div class="nav-collapse">
20+
<ul class="nav">
21+
<li class="divider-vertical"></li>
22+
{% if theme_navbar_links %}
23+
{%- for link in theme_navbar_links %}
24+
<li><a href="{{ pathto(*link[1:]) }}">{{ link[0] }}</a></li>
25+
{%- endfor %}
26+
{% endif %}
27+
{% block navbartoc %}
28+
{% include "globaltoc.html" %}
29+
{% if theme_navbar_pagenav %}
30+
{% include "navbartoc.html" %}
31+
{% endif %}
32+
{% endblock %}
33+
{% if theme_navbar_sidebarrel %}
34+
{% block sidebarrel %}
35+
{% include "relations.html" %}
36+
{% endblock %}
37+
{% endif %}
38+
{% block navbarextra %}
39+
{% endblock %}
40+
{% if theme_source_link_position == "nav" %}
41+
<li>{% include "sourcelink.html" %}</li>
42+
{% endif %}
43+
</ul>
44+
45+
{% block navbarsearch %}
46+
{% include "navbarsearchbox.html" %}
47+
{% endblock %}
48+
</div>
49+
</div>
50+
</div>
51+
</div>

0 commit comments

Comments
 (0)