summaryrefslogtreecommitdiff
path: root/sphinx/directives/code.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-03-03 14:38:05 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-03-03 20:01:44 +0900
commit3f22d512ec407a7c19892a389d7547633e0c2f53 (patch)
tree0db5faa47bbc67e7778b2340334719993202e7cf /sphinx/directives/code.py
parent061c80dd880bb9e0a7a56cd9070104c8623fdd01 (diff)
downloadsphinx-git-3f22d512ec407a7c19892a389d7547633e0c2f53.tar.gz
Add a helper method ``SphinxDirective.set_source_info()``
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r--sphinx/directives/code.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py
index 73afac4ba..75ab61796 100644
--- a/sphinx/directives/code.py
+++ b/sphinx/directives/code.py
@@ -20,7 +20,6 @@ from sphinx.locale import __
from sphinx.util import logging
from sphinx.util import parselinenos
from sphinx.util.docutils import SphinxDirective
-from sphinx.util.nodes import set_source_info
if False:
# For type annotation
@@ -173,7 +172,7 @@ class CodeBlock(SphinxDirective):
extra_args['hl_lines'] = hl_lines
if 'lineno-start' in self.options:
extra_args['linenostart'] = self.options['lineno-start']
- set_source_info(self, literal)
+ self.set_source_info(literal)
caption = self.options.get('caption')
if caption:
@@ -446,7 +445,7 @@ class LiteralInclude(SphinxDirective):
text, lines = reader.read(location=location)
retnode = nodes.literal_block(text, text, source=filename) # type: nodes.Element
- set_source_info(self, retnode)
+ self.set_source_info(retnode)
if self.options.get('diff'): # if diff is set, set udiff
retnode['language'] = 'udiff'
elif 'language' in self.options: