diff options
author | Georg Brandl <georg@python.org> | 2014-01-19 11:04:12 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-01-19 11:04:12 +0100 |
commit | 2458e5731afbc1eda73548b8b0945fa38c73f517 (patch) | |
tree | aa235cc5ff5232c4db1f153b5c5470151af5ede1 /sphinx/directives/code.py | |
parent | 883b960cb1c8e2abc6407dd373f57c0b0fef711c (diff) | |
download | sphinx-git-2458e5731afbc1eda73548b8b0945fa38c73f517.tar.gz |
Add :filename: also for literalinclude. Changelog entry.
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r-- | sphinx/directives/code.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py index bfe6c48e9..6900ea6b6 100644 --- a/sphinx/directives/code.py +++ b/sphinx/directives/code.py @@ -115,6 +115,7 @@ class LiteralInclude(Directive): 'prepend': directives.unchanged_required, 'append': directives.unchanged_required, 'emphasize-lines': directives.unchanged_required, + 'filename': directives.unchanged, } def run(self): @@ -216,6 +217,11 @@ class LiteralInclude(Directive): retnode['language'] = self.options['language'] retnode['linenos'] = 'linenos' in self.options or \ 'lineno-start' in self.options + filename = self.options.get('filename') + if filename is not None: + if not filename: + filename = self.arguments[0] + retnode['filename'] = filename extra_args = retnode['highlight_args'] = {} if hl_lines is not None: extra_args['hl_lines'] = hl_lines |