mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
refactor: latex: Initialize 'logofilename' on context
This commit is contained in:
parent
db02ae1b81
commit
a2ec232c71
1
CHANGES
1
CHANGES
@ -90,6 +90,7 @@ Deprecated
|
||||
* ``sphinx.writers.text.TextTranslator._make_depart_admonition()``
|
||||
* template variables for LaTeX template
|
||||
|
||||
- ``logo``
|
||||
- ``pageautorefname``
|
||||
- ``translatablestrings``
|
||||
|
||||
|
@ -198,6 +198,9 @@ class LaTeXBuilder(Builder):
|
||||
self.context['date'] = format_date(self.config.today_fmt or _('%b %d, %Y'),
|
||||
language=self.config.language)
|
||||
|
||||
if self.config.latex_logo:
|
||||
self.context['logofilename'] = path.basename(self.config.latex_logo)
|
||||
|
||||
# for compatibilities
|
||||
self.context['indexname'] = _('Index')
|
||||
if self.config.release:
|
||||
|
@ -48,7 +48,11 @@
|
||||
\date{<%= date %>}
|
||||
\release{<%= release %>}
|
||||
\author{<%= author %>}
|
||||
\newcommand{\sphinxlogo}{<%= logo %>}
|
||||
<%- if logofilename %>
|
||||
\newcommand{\sphinxlogo}{\sphinxincludegraphics{<%= logofilename %>}\par}
|
||||
<%- else %>
|
||||
\newcommand{\sphinxlogo}{\vbox{}}
|
||||
<%- endif %>
|
||||
<%- if releasename or release %>
|
||||
\renewcommand{\releasename}{<%= releasename or _('Release') | e %>}
|
||||
<%- else %>
|
||||
|
@ -157,7 +157,6 @@ DEFAULT_SETTINGS = {
|
||||
'title': '',
|
||||
'release': '',
|
||||
'author': '',
|
||||
'logo': '\\vbox{}',
|
||||
'releasename': '',
|
||||
'makeindex': '\\makeindex',
|
||||
'shorthandoff': '',
|
||||
@ -578,11 +577,6 @@ class LaTeXTranslator(SphinxTranslator):
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
if self.config.latex_logo:
|
||||
# no need for \\noindent here, used in flushright
|
||||
self.elements['logo'] = '\\sphinxincludegraphics{%s}\\par' % \
|
||||
path.basename(self.config.latex_logo)
|
||||
|
||||
if (self.config.language not in {None, 'en', 'ja'} and
|
||||
'fncychap' not in self.config.latex_elements):
|
||||
# use Sonny style if any language specified (except English)
|
||||
|
Loading…
Reference in New Issue
Block a user