mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix autosummary template overloading cause infinite recursive function call. Closes #1335
This commit is contained in:
parent
dfaecb8779
commit
3d67be3dce
13
CHANGES
13
CHANGES
@ -1,6 +1,13 @@
|
||||
Release 1.2.1 (in development)
|
||||
==============================
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
* #1335: Fix autosummary template overloading like
|
||||
``{% extends "!autosummary/class.rst" %}`` cause infinite recursive function
|
||||
call. This caused by PR#181.
|
||||
|
||||
|
||||
Release 1.2 (released Dec 10, 2013)
|
||||
===================================
|
||||
@ -22,8 +29,10 @@ Bugs fixed
|
||||
|
||||
* Restore ``versionmodified`` CSS class for versionadded/changed and deprecated
|
||||
directives.
|
||||
* Fix: `html_theme_path=['.']` is a trigger of rebuild all documents always
|
||||
(This change keeps the current "theme changes cause a rebuild" feature).
|
||||
|
||||
* PR#181: Fix `html_theme_path=['.']` is a trigger of rebuild all documents
|
||||
always (This change keeps the current "theme changes cause a rebuild"
|
||||
feature).
|
||||
|
||||
* #1296: Fix invalid charset in HTML help generated HTML files for default
|
||||
locale.
|
||||
|
@ -95,9 +95,11 @@ class BuiltinTemplateLoader(TemplateBridge, BaseLoader):
|
||||
# then the theme parent paths
|
||||
loaderchain = pathchain + theme.themepath
|
||||
elif dirs:
|
||||
pathchain = loaderchain = list(dirs)
|
||||
pathchain = list(dirs)
|
||||
loaderchain = list(dirs)
|
||||
else:
|
||||
pathchain = loaderchain = []
|
||||
pathchain = []
|
||||
loaderchain = []
|
||||
|
||||
# prepend explicit template paths
|
||||
self.templatepathlen = len(builder.config.templates_path)
|
||||
|
@ -0,0 +1,8 @@
|
||||
{% extends "!autosummary/class.rst" %}
|
||||
|
||||
{% block methods %}
|
||||
|
||||
.. note:: autosummary/class.rst method block overloading
|
||||
|
||||
{{ super() }}
|
||||
{% endblock %}
|
6
tests/roots/test-templating/_templates/layout.html
Normal file
6
tests/roots/test-templating/_templates/layout.html
Normal file
@ -0,0 +1,6 @@
|
||||
{% extends "!layout.html" %}
|
||||
|
||||
{% block extrahead %}
|
||||
<!-- layout overloading -->
|
||||
{{ super() }}
|
||||
{% endblock %}
|
13
tests/roots/test-templating/autosummary_templating.txt
Normal file
13
tests/roots/test-templating/autosummary_templating.txt
Normal file
@ -0,0 +1,13 @@
|
||||
Autosummary templating test
|
||||
===========================
|
||||
|
||||
.. autosummary::
|
||||
:toctree: generated
|
||||
|
||||
sphinx.application.Sphinx
|
||||
|
||||
.. currentmodule:: sphinx.application
|
||||
|
||||
.. autoclass:: TemplateBridge
|
||||
|
||||
.. automethod:: render
|
11
tests/roots/test-templating/conf.py
Normal file
11
tests/roots/test-templating/conf.py
Normal file
@ -0,0 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
project = 'Sphinx templating <Tests>'
|
||||
source_suffix = '.txt'
|
||||
keep_warnings = True
|
||||
templates_path = ['_templates']
|
||||
release = version = '2013.120'
|
||||
|
||||
extensions = ['sphinx.ext.autosummary']
|
||||
autosummary_generate = ['autosummary_templating']
|
||||
|
7
tests/roots/test-templating/contents.txt
Normal file
7
tests/roots/test-templating/contents.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Welcome to Sphinx Tests's documentation!
|
||||
========================================
|
||||
|
||||
.. toctree::
|
||||
|
||||
autosummary_templating
|
||||
|
36
tests/test_templating.py
Normal file
36
tests/test_templating.py
Normal file
@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
test_templating
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
Test templating.
|
||||
|
||||
:copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
from util import test_roots, with_app
|
||||
|
||||
|
||||
def teardown_module():
|
||||
(test_roots / 'test-templating' / '_build').rmtree(True),
|
||||
|
||||
|
||||
@with_app(buildername='html', srcdir=(test_roots / 'test-templating'))
|
||||
def test_layout_overloading(app):
|
||||
app.builder.build_all()
|
||||
|
||||
result = (app.outdir / 'contents.html').text(encoding='utf-8')
|
||||
|
||||
assert '<!-- layout overloading -->' in result
|
||||
|
||||
|
||||
@with_app(buildername='html', srcdir=(test_roots / 'test-templating'))
|
||||
def test_autosummary_class_template_overloading(app):
|
||||
app.builder.build_all()
|
||||
|
||||
result = (app.outdir / 'generated' / 'sphinx.application.Sphinx.html').text(
|
||||
encoding='utf-8')
|
||||
|
||||
assert 'autosummary/class.rst method block overloading' in result
|
||||
|
Loading…
Reference in New Issue
Block a user