Show warnings if unknown key is specified to latex_elements (ref: 2637)

This commit is contained in:
Takeshi KOMIYA
2016-06-08 01:27:22 +09:00
parent 368277f10a
commit e3b817da2f
2 changed files with 8 additions and 0 deletions
+1
View File
@@ -17,6 +17,7 @@ Features added
* #2463, #2516: Add keywords of "meta" directive to search index
* ``:maxdepth:`` option of toctree affects ``secnumdepth`` (ref: #2547)
* #2575: Now ``sphinx.ext.graphviz`` allows ``:align:`` option
* Show warnings if unknown key is specified to `latex_elements`
Bugs fixed
----------
+7
View File
@@ -458,6 +458,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.elements['contentsname'] = \
self.babel_renewcommand('\\contentsname', document.settings.contentsname)
# allow the user to override them all
self.check_latex_elements()
self.elements.update(builder.config.latex_elements)
if self.elements['extraclassoptions']:
self.elements['classoptions'] += ',' + \
@@ -505,6 +506,12 @@ class LaTeXTranslator(nodes.NodeVisitor):
def pop_hyperlink_ids(self, figtype):
return self.next_hyperlink_ids.pop(figtype, set())
def check_latex_elements(self):
for key in self.builder.config.latex_elements:
if key not in self.elements:
msg = _("Unknown configure key: latex_elements[%r] is ignored.")
self.builder.warn(msg % key)
def restrict_footnote(self, node):
if self.footnote_restricted is False:
self.footnote_restricted = node