Use the correct style name.

This commit is contained in:
Georg Brandl 2009-01-05 20:40:15 +01:00
parent 4480cadccc
commit 9673be44f3
3 changed files with 21 additions and 4 deletions

View File

@ -136,6 +136,11 @@ class StandaloneHTMLBuilder(Builder):
if self.config.html_use_modindex and self.env.modules: if self.config.html_use_modindex and self.env.modules:
rellinks.append(('modindex', _('Global Module Index'), 'M', _('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( self.globalcontext = dict(
embedded = self.embedded, embedded = self.embedded,
project = self.config.project, project = self.config.project,
@ -144,7 +149,6 @@ class StandaloneHTMLBuilder(Builder):
last_updated = self.last_updated, last_updated = self.last_updated,
copyright = self.config.copyright, copyright = self.config.copyright,
master_doc = self.config.master_doc, master_doc = self.config.master_doc,
style = self.config.html_style,
use_opensearch = self.config.html_use_opensearch, use_opensearch = self.config.html_use_opensearch,
docstitle = self.config.html_title, docstitle = self.config.html_title,
shorttitle = self.config.html_short_title, shorttitle = self.config.html_short_title,
@ -154,6 +158,7 @@ class StandaloneHTMLBuilder(Builder):
file_suffix = self.out_suffix, file_suffix = self.out_suffix,
script_files = self.script_files, script_files = self.script_files,
sphinx_version = __version__, sphinx_version = __version__,
style = stylename,
rellinks = rellinks, rellinks = rellinks,
builder = self.name, builder = self.name,
parents = [], parents = [],

View File

@ -59,7 +59,7 @@ class Config(object):
(self.project, self.release), (self.project, self.release),
False), False),
html_short_title = (lambda self: self.html_title, 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_logo = (None, False),
html_favicon = (None, False), html_favicon = (None, False),
html_static_path = ([], False), html_static_path = ([], False),

View File

@ -46,14 +46,18 @@ class Theme(object):
def __init__(self, name): def __init__(self, name):
if name not in self.themes: 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.name = name
self.themedir = self.themes[name] self.themedir = self.themes[name]
self.themeconf = ConfigParser.RawConfigParser() self.themeconf = ConfigParser.RawConfigParser()
self.themeconf.read(path.join(self.themedir, THEMECONF)) 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': if inherit == 'none':
self.base = None self.base = None
elif inherit not in self.themes: elif inherit not in self.themes:
@ -62,6 +66,14 @@ class Theme(object):
else: else:
self.base = Theme(inherit) 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): def get_dirchain(self):
""" """
Return a list of theme directories, beginning with this theme's, Return a list of theme directories, beginning with this theme's,