diff --git a/README.rst b/README.rst index e5973e57..e9488bab 100644 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/setup.py b/setup.py index 90509cfa..a469c9ba 100644 --- a/setup.py +++ b/setup.py @@ -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", diff --git a/sphinx_bootstrap_theme/bootstrap/static/bootstrap-sphinx.css_t b/sphinx_bootstrap_theme/bootstrap/static/bootstrap-sphinx.css_t index eafb2807..5ba9b570 100644 --- a/sphinx_bootstrap_theme/bootstrap/static/bootstrap-sphinx.css_t +++ b/sphinx_bootstrap_theme/bootstrap/static/bootstrap-sphinx.css_t @@ -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; } diff --git a/sphinx_bootstrap_theme/bootstrap/static/bootstrap-sphinx.js_t b/sphinx_bootstrap_theme/bootstrap/static/bootstrap-sphinx.js_t index 25050653..af5e0fa8 100644 --- a/sphinx_bootstrap_theme/bootstrap/static/bootstrap-sphinx.js_t +++ b/sphinx_bootstrap_theme/bootstrap/static/bootstrap-sphinx.js_t @@ -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("
").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) { diff --git a/sphinx_bootstrap_theme/bootstrap/theme.conf b/sphinx_bootstrap_theme/bootstrap/theme.conf index 173f694b..13c3a14c 100644 --- a/sphinx_bootstrap_theme/bootstrap/theme.conf +++ b/sphinx_bootstrap_theme/bootstrap/theme.conf @@ -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