mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
#554: Add theme option `sidebarwidth` to the basic theme.
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -98,6 +98,8 @@ Release 1.1 (in development)
|
||||
* #594: :confval:`trim_doctest_flags` now also removes ``<BLANKLINE>``
|
||||
indicators.
|
||||
|
||||
* #554: Add theme option ``sidebarwidth`` to the basic theme.
|
||||
|
||||
* C++ domain now supports array definitions.
|
||||
|
||||
|
||||
|
||||
@@ -89,12 +89,15 @@ These themes are:
|
||||
|
||||
* **basic** -- This is a basically unstyled layout used as the base for the
|
||||
other themes, and usable as the base for custom themes as well. The HTML
|
||||
contains all important elements like sidebar and relation bar. There is one
|
||||
option (which is inherited by the other themes):
|
||||
contains all important elements like sidebar and relation bar. There are
|
||||
these options (which are inherited by the other themes):
|
||||
|
||||
- **nosidebar** (true or false): Don't include the sidebar. Defaults to
|
||||
false.
|
||||
|
||||
- **sidebarwidth** (an integer): Width of the sidebar in pixels. (Do not
|
||||
include ``px`` in the value.) Defaults to 230 pixels.
|
||||
|
||||
* **default** -- This is the default theme, which looks like `the Python
|
||||
documentation <http://docs.python.org/>`_. It can be customized via these
|
||||
options:
|
||||
@@ -142,7 +145,8 @@ These themes are:
|
||||
- **headfont** (CSS font-family): Font for headings.
|
||||
|
||||
* **sphinxdoc** -- The theme used for this documentation. It features a sidebar
|
||||
on the right side. There are currently no options beyond *nosidebar*.
|
||||
on the right side. There are currently no options beyond *nosidebar* and
|
||||
*sidebarwidth*.
|
||||
|
||||
* **scrolls** -- A more lightweight theme, based on `the Jinja documentation
|
||||
<http://jinja.pocoo.org/>`_. The following color options are available:
|
||||
@@ -176,10 +180,11 @@ These themes are:
|
||||
is ``justify``.
|
||||
|
||||
* **nature** -- A greenish theme. There are currently no options beyond
|
||||
*nosidebar*.
|
||||
*nosidebar* and *sidebarwidth*.
|
||||
|
||||
* **pyramid** -- A theme from the Pyramid web framework project, designed by
|
||||
Blaise Laflamme. THere are currently no options beyond *nosidebar*.
|
||||
Blaise Laflamme. THere are currently no options beyond *nosidebar* and
|
||||
*sidebarwidth*.
|
||||
|
||||
* **haiku** -- A theme without sidebar inspired by the `Haiku OS user guide
|
||||
<http://www.haiku-os.org/docs/userguide/en/contents.html>`_. The following
|
||||
@@ -193,7 +198,7 @@ These themes are:
|
||||
**hoverlinkcolor** (CSS colors): Colors for various body elements.
|
||||
|
||||
* **traditional** -- A theme resembling the old Python documentation. There are
|
||||
currently no options beyond *nosidebar*.
|
||||
currently no options beyond *nosidebar* and *sidebarwidth*.
|
||||
|
||||
* **epub** -- A theme for the epub builder. There are currently no options.
|
||||
This theme tries to save visual space which is a sparse resource on ebook
|
||||
|
||||
@@ -26,6 +26,12 @@ def _tobool(val):
|
||||
return val.lower() in ('true', '1', 'yes', 'on')
|
||||
return bool(val)
|
||||
|
||||
def _toint(val):
|
||||
try:
|
||||
return int(val)
|
||||
except ValueError:
|
||||
return 0
|
||||
|
||||
def accesskey(context, key):
|
||||
"""Helper to output each access key only once."""
|
||||
if '_accesskeys' not in context:
|
||||
@@ -100,6 +106,7 @@ class BuiltinTemplateLoader(TemplateBridge, BaseLoader):
|
||||
self.environment = SandboxedEnvironment(loader=self,
|
||||
extensions=extensions)
|
||||
self.environment.filters['tobool'] = _tobool
|
||||
self.environment.filters['toint'] = _toint
|
||||
self.environment.globals['debug'] = contextfunction(pformat)
|
||||
self.environment.globals['accesskey'] = contextfunction(accesskey)
|
||||
if use_i18n:
|
||||
|
||||
@@ -49,7 +49,7 @@ div.sphinxsidebarwrapper {
|
||||
|
||||
div.sphinxsidebar {
|
||||
float: left;
|
||||
width: 230px;
|
||||
width: {{ theme_sidebarwidth|toint }}px;
|
||||
margin-left: -100%;
|
||||
font-size: 90%;
|
||||
}
|
||||
@@ -5,3 +5,4 @@ pygments_style = none
|
||||
|
||||
[options]
|
||||
nosidebar = false
|
||||
sidebarwidth = 230
|
||||
@@ -32,7 +32,7 @@ div.documentwrapper {
|
||||
}
|
||||
|
||||
div.bodywrapper {
|
||||
margin: 0 0 0 230px;
|
||||
margin: 0 0 0 {{ theme_sidebarwidth|toint }}px;
|
||||
}
|
||||
|
||||
div.body {
|
||||
@@ -43,7 +43,7 @@ div.body {
|
||||
|
||||
{%- if theme_rightsidebar|tobool %}
|
||||
div.bodywrapper {
|
||||
margin: 0 230px 0 0;
|
||||
margin: 0 {{ theme_sidebarwidth|toint }}px 0 0;
|
||||
}
|
||||
{%- endif %}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ div.documentwrapper {
|
||||
}
|
||||
|
||||
div.bodywrapper {
|
||||
margin: 0 0 0 230px;
|
||||
margin: 0 0 0 {{ theme_sidebarwidth|toint }}px;
|
||||
}
|
||||
|
||||
hr {
|
||||
|
||||
@@ -28,7 +28,7 @@ div.documentwrapper {
|
||||
}
|
||||
|
||||
div.bodywrapper {
|
||||
margin: 0 0 0 230px;
|
||||
margin: 0 0 0 {{ theme_sidebarwidth }}px;
|
||||
}
|
||||
|
||||
hr {
|
||||
@@ -92,7 +92,7 @@ div.related a {
|
||||
}
|
||||
|
||||
div.related ul {
|
||||
padding-left: 240px;
|
||||
padding-left: {{ theme_sidebarwidth|toint + 10 }}px;
|
||||
}
|
||||
|
||||
div.sphinxsidebar {
|
||||
|
||||
@@ -38,7 +38,7 @@ div.document {
|
||||
}
|
||||
|
||||
div.bodywrapper {
|
||||
margin: 0 240px 0 0;
|
||||
margin: 0 {{ theme_sidebarwidth|toint + 10 }}px 0 0;
|
||||
border-right: 1px solid #ccc;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ div.sphinxsidebarwrapper {
|
||||
div.sphinxsidebar {
|
||||
margin: 0;
|
||||
padding: 0.5em 15px 15px 0;
|
||||
width: 210px;
|
||||
width: {{ theme_sidebarwidth|toint - 20 }}px;
|
||||
float: right;
|
||||
font-size: 1em;
|
||||
text-align: left;
|
||||
@@ -23,7 +23,7 @@ div.documentwrapper {
|
||||
}
|
||||
|
||||
div.bodywrapper {
|
||||
margin: 0 230px 0 0;
|
||||
margin: 0 {{ theme_sidebarwidth }}px 0 0;
|
||||
}
|
||||
|
||||
div.body {
|
||||
@@ -40,7 +40,7 @@ div.sphinxsidebarwrapper {
|
||||
div.sphinxsidebar {
|
||||
float: right;
|
||||
margin-left: -100%;
|
||||
width: 230px;
|
||||
width: {{ theme_sidebarwidth }}px;
|
||||
}
|
||||
|
||||
div.clearer {
|
||||
@@ -667,38 +667,6 @@ h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
form.comment {
|
||||
margin: 0;
|
||||
padding: 10px 30px 10px 30px;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
form.comment h3 {
|
||||
background-color: #326591;
|
||||
color: white;
|
||||
margin: -10px -30px 10px -30px;
|
||||
padding: 5px;
|
||||
font-size: 1.4em;
|
||||
}
|
||||
|
||||
form.comment input,
|
||||
form.comment textarea {
|
||||
border: 1px solid #ccc;
|
||||
padding: 2px;
|
||||
font-family: sans-serif;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
form.comment input[type="text"] {
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
form.comment textarea {
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* :::: PRINT :::: */
|
||||
@media print {
|
||||
div.documentwrapper {
|
||||
Reference in New Issue
Block a user