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
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ your "conf.py" file::
# Choose Bootstrap version.
# Values: "3" (default) or "2" (in quotes)
'bootstrap_version': "3",

# Use Bootstrap3 panels instead of alerts for admonitions
# Values: "true" or "false" (default)
admonition_use_panel: false,
}

Note for the navigation bar title that if you don't specify a theme option of
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def read_file(name):
setup(
name="sphinx-bootstrap-theme",
version=__version__,
use_2to3=True,
#use_2to3=True,
description="Sphinx Bootstrap Theme.",
long_description=read_file("README"),
url="http://ryan-roemer.github.com/sphinx-bootstrap-theme/README.html",
Expand Down
21 changes: 21 additions & 0 deletions sphinx_bootstrap_theme/bootstrap/static/bootstrap-sphinx.css_t
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,27 @@
height: 100%;
}

{% if theme_admonition_use_panel|tobool %}

p.admonition-title {
margin: 0px;
}

div.admonition {
padding: 0px;
}

.panel-body {
padding-top: 10px;
padding-bottom: 5px;
}

.panel-heading {
font-weight: bold;
}

{% endif %}

.page-top {
top: 0px;
}
Expand Down
22 changes: 21 additions & 1 deletion sphinx_bootstrap_theme/bootstrap/static/bootstrap-sphinx.js_t
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,33 @@
patchTables();

// Add Note, Warning styles. (BS v2,3 compatible).
$(".admonition").addClass("alert alert-info")
{% if theme_admonition_use_panel|tobool and theme_bootstrap_version == "3" %}
$(".admonition-title")
.addClass("panel-heading").end();
$(".admonition")
.addClass("panel panel-info")
.filter(".warning, .caution")
.removeClass("panel-info")
.addClass("panel-warning").end()
.filter(".error, .danger")
.removeClass("panel-info")
.addClass("panel-danger").end()
.each(function() {
$(this)
.children()
.not(".panel-heading")
.wrapAll("<div class='panel-body'></div>").end();
});
{% else %}
$(".admonition")
.addClass("alert alert-info")
.filter(".warning, .caution")
.removeClass("alert-info")
.addClass("alert-warning").end()
.filter(".error, .danger")
.removeClass("alert-info")
.addClass("alert-danger alert-error").end();
{% endif %}

// Inline code styles to Bootstrap style.
$("tt.docutils.literal").not(".xref").each(function (i, e) {
Expand Down
4 changes: 4 additions & 0 deletions sphinx_bootstrap_theme/bootstrap/theme.conf
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@ bootswatch_theme =
# Switch Bootstrap version?
# Values: "3" (default) or "2"
bootstrap_version = 3

# Use Bootstrap3 panels instead of alerts for admonitions
# Values: "true" or "false" (default)
admonition_use_panel = false