Fix #1794: custom theme extended from alabaster or sphinx_rtd_theme can't find base theme.

This commit is contained in:
shimizukawa 2015-04-05 15:10:49 +09:00
parent 9d2ec40d8b
commit ccd7e73c19
2 changed files with 22 additions and 19 deletions

View File

@ -8,6 +8,9 @@ Bugs fixed
* #1789: ``:pyobject:`` option of ``literalinclude`` directive includes following * #1789: ``:pyobject:`` option of ``literalinclude`` directive includes following
lines after class definitions lines after class definitions
* #1790: ``literalinclude`` strips empty lines at the head and tail * #1790: ``literalinclude`` strips empty lines at the head and tail
* #1802: load plugin themes automatically when theme.conf use it as 'inherit'. Thanks to
Takayuki Hirai.
* #1794: custom theme extended from alabaster or sphinx_rtd_theme can't find base theme.
Release 1.3.1 (released Mar 17, 2015) Release 1.3.1 (released Mar 17, 2015)

View File

@ -71,28 +71,28 @@ class Theme(object):
@classmethod @classmethod
def load_extra_theme(cls, name): def load_extra_theme(cls, name):
if name == 'alabaster': if name in ('alabaster', 'sphinx_rtd_theme'):
cls.themes[name] = (os.path.join(alabaster.get_path(), name), None) if name == 'alabaster':
# alabaster theme also requires 'alabaster' extension, it will be loaded at themedir = alabaster.get_path()
# sphinx.******* module. # alabaster theme also requires 'alabaster' extension, it will be loaded
return # at sphinx.application module.
elif name == 'sphinx_rtd_theme':
themedir = sphinx_rtd_theme.get_html_theme_path()
else:
raise NotImplementedError('Programming Error')
if name == 'sphinx_rtd_theme': else:
cls.themes[name] = ( for themedir in load_theme_plugins():
os.path.join(sphinx_rtd_theme.get_html_theme_path(), name), None) if path.isfile(path.join(themedir, name, THEMECONF)):
return break
else:
for themedir in load_theme_plugins(): # specified theme is not found
if not path.isdir(themedir):
continue
for theme in os.listdir(themedir):
if theme != name:
continue
if not path.isfile(path.join(themedir, theme, THEMECONF)):
continue
cls.themes[theme] = (path.join(themedir, theme), None)
return return
cls.themepath.append(themedir)
cls.themes[name] = (path.join(themedir, name), None)
return
def __init__(self, name, warn=None): def __init__(self, name, warn=None):
if name not in self.themes: if name not in self.themes:
self.load_extra_theme(name) self.load_extra_theme(name)