mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #1794: custom theme extended from alabaster or sphinx_rtd_theme can't find base theme.
This commit is contained in:
parent
9d2ec40d8b
commit
ccd7e73c19
3
CHANGES
3
CHANGES
@ -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)
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user