diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py
index 55cf2de2a..fd86e2fa5 100644
--- a/sphinx/builders/html.py
+++ b/sphinx/builders/html.py
@@ -136,6 +136,11 @@ class StandaloneHTMLBuilder(Builder):
if self.config.html_use_modindex and self.env.modules:
rellinks.append(('modindex', _('Global Module Index'), 'M', _('modules')))
+ if self.config.html_style is not None:
+ stylename = self.config.html_style
+ else:
+ stylename = self.theme.get_confstr('theme', 'stylesheet')
+
self.globalcontext = dict(
embedded = self.embedded,
project = self.config.project,
@@ -144,7 +149,6 @@ class StandaloneHTMLBuilder(Builder):
last_updated = self.last_updated,
copyright = self.config.copyright,
master_doc = self.config.master_doc,
- style = self.config.html_style,
use_opensearch = self.config.html_use_opensearch,
docstitle = self.config.html_title,
shorttitle = self.config.html_short_title,
@@ -154,6 +158,7 @@ class StandaloneHTMLBuilder(Builder):
file_suffix = self.out_suffix,
script_files = self.script_files,
sphinx_version = __version__,
+ style = stylename,
rellinks = rellinks,
builder = self.name,
parents = [],
diff --git a/sphinx/config.py b/sphinx/config.py
index a3ae34c51..768b69fdb 100644
--- a/sphinx/config.py
+++ b/sphinx/config.py
@@ -59,7 +59,7 @@ class Config(object):
(self.project, self.release),
False),
html_short_title = (lambda self: self.html_title, False),
- html_style = ('default.css', False), # XXX
+ html_style = (None, False),
html_logo = (None, False),
html_favicon = (None, False),
html_static_path = ([], False),
diff --git a/sphinx/theming.py b/sphinx/theming.py
index 9493481c2..7c96107c4 100644
--- a/sphinx/theming.py
+++ b/sphinx/theming.py
@@ -46,14 +46,18 @@ class Theme(object):
def __init__(self, name):
if name not in self.themes:
- raise ThemeError('no theme named %r found' % name)
+ raise ThemeError('no theme named %r found '
+ '(missing theme.conf?)' % name)
self.name = name
self.themedir = self.themes[name]
self.themeconf = ConfigParser.RawConfigParser()
self.themeconf.read(path.join(self.themedir, THEMECONF))
- inherit = self.themeconf.get('theme', 'inherit')
+ try:
+ inherit = self.themeconf.get('theme', 'inherit')
+ except ConfigParser.NoOptionError:
+ raise ThemeError('theme %r doesn\'t have "inherit" setting' % name)
if inherit == 'none':
self.base = None
elif inherit not in self.themes:
@@ -62,6 +66,14 @@ class Theme(object):
else:
self.base = Theme(inherit)
+ def get_confstr(self, section, name):
+ try:
+ return self.themeconf.get(section, name)
+ except ConfigParser.NoOptionError:
+ if self.base is not None:
+ return self.base.get_confstr(section, name)
+ raise
+
def get_dirchain(self):
"""
Return a list of theme directories, beginning with this theme's,