mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
refactor: latex: Initialize 'date' on builder
This commit is contained in:
parent
3905cb8b7c
commit
db02ae1b81
@ -31,6 +31,7 @@ from sphinx.util import texescape, logging, status_iterator
|
||||
from sphinx.util.console import bold, darkgreen # type: ignore
|
||||
from sphinx.util.docutils import SphinxFileOutput, new_document
|
||||
from sphinx.util.fileutil import copy_asset_file
|
||||
from sphinx.util.i18n import format_date
|
||||
from sphinx.util.nodes import inline_all_toctrees
|
||||
from sphinx.util.osutil import SEP, make_filename
|
||||
from sphinx.util.template import LaTeXRenderer
|
||||
@ -191,6 +192,12 @@ class LaTeXBuilder(Builder):
|
||||
self.context['release'] = self.config.release
|
||||
self.context['use_xindy'] = self.config.latex_use_xindy
|
||||
|
||||
if self.config.today:
|
||||
self.context['date'] = self.config.today
|
||||
else:
|
||||
self.context['date'] = format_date(self.config.today_fmt or _('%b %d, %Y'),
|
||||
language=self.config.language)
|
||||
|
||||
# for compatibilities
|
||||
self.context['indexname'] = _('Index')
|
||||
if self.config.release:
|
||||
|
@ -30,7 +30,6 @@ from sphinx.errors import SphinxError
|
||||
from sphinx.locale import admonitionlabels, _, __
|
||||
from sphinx.util import split_into, logging
|
||||
from sphinx.util.docutils import SphinxTranslator
|
||||
from sphinx.util.i18n import format_date
|
||||
from sphinx.util.nodes import clean_astext
|
||||
from sphinx.util.template import LaTeXRenderer
|
||||
from sphinx.util.texescape import tex_escape_map, tex_replace_map
|
||||
@ -156,7 +155,6 @@ DEFAULT_SETTINGS = {
|
||||
'contentsname': '',
|
||||
'preamble': '',
|
||||
'title': '',
|
||||
'date': '',
|
||||
'release': '',
|
||||
'author': '',
|
||||
'logo': '\\vbox{}',
|
||||
@ -556,12 +554,6 @@ class LaTeXTranslator(SphinxTranslator):
|
||||
logger.warning(__('unknown %r toplevel_sectioning for class %r') %
|
||||
(self.config.latex_toplevel_sectioning, docclass))
|
||||
|
||||
if self.config.today:
|
||||
self.elements['date'] = self.config.today
|
||||
else:
|
||||
self.elements['date'] = format_date(self.config.today_fmt or _('%b %d, %Y'),
|
||||
language=self.config.language)
|
||||
|
||||
if self.config.numfig:
|
||||
self.numfig_secnum_depth = self.config.numfig_secnum_depth
|
||||
if self.numfig_secnum_depth > 0: # default is 1
|
||||
|
Loading…
Reference in New Issue
Block a user