summaryrefslogtreecommitdiff
path: root/sphinx/directives/code.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2011-09-23 11:03:23 +0200
committerGeorg Brandl <georg@python.org>2011-09-23 11:03:23 +0200
commit4abbe95a9c6b82ec644ea7fc81fd0198edf7831e (patch)
tree370b12cba4f2d19a7405c4efef31c408108def8f /sphinx/directives/code.py
parent25d41d8ed10aed0d8f497679f7426cecb429ac20 (diff)
parent69f7e0768114fde9ccabc4bf7d56f765743612a6 (diff)
downloadsphinx-git-4abbe95a9c6b82ec644ea7fc81fd0198edf7831e.tar.gz
Merge with 1.0
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r--sphinx/directives/code.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py
index f41ca3a69..c45e1b368 100644
--- a/sphinx/directives/code.py
+++ b/sphinx/directives/code.py
@@ -15,6 +15,7 @@ from docutils.parsers.rst import Directive, directives
from sphinx import addnodes
from sphinx.util import parselinenos
+from sphinx.util.nodes import set_source_info
class Highlight(Directive):
@@ -77,7 +78,7 @@ class CodeBlock(Directive):
literal['linenos'] = 'linenos' in self.options
if hl_lines is not None:
literal['highlight_args'] = {'hl_lines': hl_lines}
- literal.line = self.lineno
+ set_source_info(self, literal)
return [literal]
@@ -197,8 +198,7 @@ class LiteralInclude(Directive):
if self.options.get('tab-width'):
text = text.expandtabs(self.options['tab-width'])
retnode = nodes.literal_block(text, text, source=filename)
- retnode.line = 1
- retnode.attributes['line_number'] = self.lineno
+ set_source_info(self, retnode)
if self.options.get('language', ''):
retnode['language'] = self.options['language']
if 'linenos' in self.options: