diff options
author | tk0miya <i.tkomiya@gmail.com> | 2014-08-11 22:36:31 +0900 |
---|---|---|
committer | tk0miya <i.tkomiya@gmail.com> | 2014-08-11 22:36:31 +0900 |
commit | 3e1667290b9e52c52d249abcc5f00eacfb42def4 (patch) | |
tree | 65cfb48e382a27b2a229673aeef9e6b7b42d9854 /sphinx/directives/code.py | |
parent | 1d65d9cdc600677002ed17e7f07b285dc2925f22 (diff) | |
download | sphinx-git-3e1667290b9e52c52d249abcc5f00eacfb42def4.tar.gz |
Rename :filename: option of code-block directive to :caption:
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r-- | sphinx/directives/code.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py index 7f08b8142..c0b27dff2 100644 --- a/sphinx/directives/code.py +++ b/sphinx/directives/code.py @@ -74,7 +74,7 @@ class CodeBlock(Directive): 'dedent': int, 'lineno-start': int, 'emphasize-lines': directives.unchanged_required, - 'filename': directives.unchanged_required, + 'caption': directives.unchanged_required, } def run(self): @@ -98,9 +98,9 @@ class CodeBlock(Directive): literal = nodes.literal_block(code, code) literal['language'] = self.arguments[0] - filename = self.options.get('filename') - if filename: - literal['filename'] = filename + caption = self.options.get('caption') + if caption: + literal['caption'] = caption literal['linenos'] = 'linenos' in self.options or \ 'lineno-start' in self.options extra_args = literal['highlight_args'] = {} @@ -137,7 +137,7 @@ class LiteralInclude(Directive): 'prepend': directives.unchanged_required, 'append': directives.unchanged_required, 'emphasize-lines': directives.unchanged_required, - 'filename': directives.unchanged, + 'caption': directives.unchanged, } def run(self): @@ -240,11 +240,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 + caption = self.options.get('caption') + if caption is not None: + if not caption: + caption = self.arguments[0] + retnode['caption'] = caption extra_args = retnode['highlight_args'] = {} if hl_lines is not None: extra_args['hl_lines'] = hl_lines |