diff options
author | Georg Brandl <georg@python.org> | 2011-01-07 11:16:55 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2011-01-07 11:16:55 +0100 |
commit | 33ed935df287f958097f018246e4bb7f17582d78 (patch) | |
tree | f5fbf460d248e8402823d03cbd36fb4d3e815a2c /sphinx/directives/code.py | |
parent | c50054c8dab65814c18c38b3f6ef60fc2e2d007f (diff) | |
download | sphinx-git-33ed935df287f958097f018246e4bb7f17582d78.tar.gz |
Add line numbers to newly generated nodes.
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r-- | sphinx/directives/code.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py index f72af912d..bfde48e58 100644 --- a/sphinx/directives/code.py +++ b/sphinx/directives/code.py @@ -64,6 +64,7 @@ class CodeBlock(Directive): literal = nodes.literal_block(code, code) literal['language'] = self.arguments[0] literal['linenos'] = 'linenos' in self.options + literal.line = self.lineno return [literal] @@ -180,6 +181,7 @@ class LiteralInclude(Directive): text = text.expandtabs(self.options['tab-width']) retnode = nodes.literal_block(text, text, source=fn) retnode.line = 1 + retnode.attributes['line_number'] = self.lineno if self.options.get('language', ''): retnode['language'] = self.options['language'] if 'linenos' in self.options: |