summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Chevallier <yves-chevallier@heig-vd.ch>2020-08-12 16:29:26 +0200
committerYves Chevallier <yves-chevallier@heig-vd.ch>2020-08-12 16:29:26 +0200
commit53a82a56303ae2e0be1e5613db0da3611b1aabb1 (patch)
tree417b9a88851d9e2a7c36fbf0e88f99f97340b75a
parent38b868cc0d0583d9a58496cd121f0bc345bf9eaa (diff)
downloadsphinx-git-53a82a56303ae2e0be1e5613db0da3611b1aabb1.tar.gz
Use node as location
-rw-r--r--sphinx/writers/html.py2
-rw-r--r--sphinx/writers/html5.py2
-rw-r--r--sphinx/writers/latex.py6
-rw-r--r--sphinx/writers/texinfo.py8
4 files changed, 9 insertions, 9 deletions
diff --git a/sphinx/writers/html.py b/sphinx/writers/html.py
index 4375bf326..8813c2d12 100644
--- a/sphinx/writers/html.py
+++ b/sphinx/writers/html.py
@@ -450,7 +450,7 @@ class HTMLTranslator(SphinxTranslator, BaseTranslator):
highlighted = self.highlighter.highlight_block(
node.rawsource, lang, opts=opts, linenos=linenos,
- location=(self.builder.current_docname, node.line), **highlight_args
+ location=node, **highlight_args
)
starttag = self.starttag(node, 'div', suffix='',
CLASS='highlight-%s notranslate' % lang)
diff --git a/sphinx/writers/html5.py b/sphinx/writers/html5.py
index c1252f4d0..4ceeaafdf 100644
--- a/sphinx/writers/html5.py
+++ b/sphinx/writers/html5.py
@@ -402,7 +402,7 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
highlighted = self.highlighter.highlight_block(
node.rawsource, lang, opts=opts, linenos=linenos,
- location=(self.builder.current_docname, node.line), **highlight_args
+ location=node, **highlight_args
)
starttag = self.starttag(node, 'div', suffix='',
CLASS='highlight-%s notranslate' % lang)
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index 73a22a76b..b77202951 100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -651,7 +651,7 @@ class LaTeXTranslator(SphinxTranslator):
if len(node.children) != 1 and not isinstance(node.children[0],
nodes.Text):
logger.warning(__('document title is not a single Text node'),
- location=(self.curfilestack[-1], node.line))
+ location=node)
if not self.elements['title']:
# text needs to be escaped since it is inserted into
# the output literally
@@ -684,7 +684,7 @@ class LaTeXTranslator(SphinxTranslator):
else:
logger.warning(__('encountered title node not in section, topic, table, '
'admonition or sidebar'),
- location=(self.curfilestack[-1], node.line or ''))
+ location=node)
self.body.append('\\sphinxstyleothertitle{')
self.context.append('}\n')
self.in_title = 1
@@ -1762,7 +1762,7 @@ class LaTeXTranslator(SphinxTranslator):
hlcode = self.highlighter.highlight_block(
node.rawsource, lang, opts=opts, linenos=linenos,
- location=(self.curfilestack[-1], node.line), **highlight_args
+ location=node, **highlight_args
)
if self.in_footnote:
self.body.append('\n\\sphinxSetupCodeBlockInFootnote')
diff --git a/sphinx/writers/texinfo.py b/sphinx/writers/texinfo.py
index 8c52a0868..5ad2831dd 100644
--- a/sphinx/writers/texinfo.py
+++ b/sphinx/writers/texinfo.py
@@ -628,7 +628,7 @@ class TexinfoTranslator(SphinxTranslator):
elif not isinstance(parent, nodes.section):
logger.warning(__('encountered title node not in section, topic, table, '
'admonition or sidebar'),
- location=(self.curfilestack[-1], node.line))
+ location=node)
self.visit_rubric(node)
else:
try:
@@ -1186,7 +1186,7 @@ class TexinfoTranslator(SphinxTranslator):
self.body.append('\n@caption{')
else:
logger.warning(__('caption not inside a figure.'),
- location=(self.curfilestack[-1], node.line))
+ location=node)
def depart_caption(self, node: Element) -> None:
if (isinstance(node.parent, nodes.figure) or
@@ -1262,11 +1262,11 @@ class TexinfoTranslator(SphinxTranslator):
def unimplemented_visit(self, node: Element) -> None:
logger.warning(__("unimplemented node type: %r"), node,
- location=(self.curfilestack[-1], node.line))
+ location=node)
def unknown_visit(self, node: Node) -> None:
logger.warning(__("unknown node type: %r"), node,
- location=(self.curfilestack[-1], node.line))
+ location=node)
def unknown_departure(self, node: Node) -> None:
pass