Fixes #1884: plug-in html themes cannot inherit another plug-in theme

Closes #1885: A part of code for this fix is from pull requeest #1885.
refs #1794
This commit is contained in:
shimizukawa 2015-11-22 00:13:42 +09:00
parent f0c390493b
commit 9d0ce7a6c1
7 changed files with 35 additions and 4 deletions

View File

@ -65,6 +65,8 @@ Bugs fixed
using `any` role and `sphinx.ext.intersphinx` in same time.
* #2121: multiple words search doesn't find pages when words across on the page title and
the page content.
* #1884, #1885: plug-in html themes cannot inherit another plug-in theme. Thanks to
Suzumizaki.
Release 1.3.1 (released Mar 17, 2015)
=====================================

View File

@ -136,9 +136,8 @@ class Theme(object):
except configparser.NoOptionError:
raise ThemeError('theme %r doesn\'t have "inherit" setting' % name)
if inherit in ['alabaster', 'sphinx_rtd_theme']:
# include 'alabaster' or 'sphinx_themes' automatically #1794
self.load_extra_theme(inherit)
# load inherited theme automatically #1794, #1884, #1885
self.load_extra_theme(inherit)
if inherit == 'none':
self.base = None

View File

@ -0,0 +1,2 @@
[theme]
inherit = basic

View File

@ -0,0 +1,2 @@
[theme]
inherit = base_theme1

View File

@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
import sys, os
templates_path = ['_templates']
master_doc = 'index'
html_theme = 'base_theme2'

View File

@ -0,0 +1,3 @@
============================
Test double inheriting theme
============================

View File

@ -14,7 +14,7 @@ import zipfile
from sphinx.theming import Theme, ThemeError
from util import with_app, raises, TestApp
from util import with_app, raises, mock, path
@with_app(confoverrides={'html_theme': 'ziptheme',
@ -79,3 +79,19 @@ def test_js_source(app, status, warning):
assert 'Underscore.js {v}'.format(v=v) in underscore_min, msg
underscore_src = (app.outdir / '_static' / 'underscore-{v}.js'.format(v=v)).text()
assert 'Underscore.js {v}'.format(v=v) in underscore_src, msg
def test_double_inheriting_theme():
from sphinx.theming import load_theme_plugins # load original before patching
def load_themes():
roots = path(__file__).abspath().parent / 'roots'
yield roots / 'test-double-inheriting-theme' / 'base_themes_dir'
for t in load_theme_plugins():
yield t
@mock.patch('sphinx.theming.load_theme_plugins', side_effect=load_themes)
@with_app(testroot='double-inheriting-theme')
def test_double_inheriting_theme_(app, status, warning, m_):
pass
yield test_double_inheriting_theme_