Merge pull request #7589 from tk0miya/7588_autosummary_template_suffix

Fix #7588: autosummary: allow any template suffix
This commit is contained in:
Takeshi KOMIYA 2020-05-02 10:42:35 +09:00 committed by GitHub
commit d184859ccd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,11 +158,11 @@ class AutosummaryRenderer:
def render(self, template_name: str, context: Dict) -> str:
"""Render a template file."""
if template_name.endswith('.rst'):
try:
template = self.env.get_template(template_name)
else:
# objtype is given as template_name
except TemplateNotFound:
try:
# objtype is given as template_name
template = self.env.get_template('autosummary/%s.rst' % template_name)
except TemplateNotFound:
# fallback to base.rst