diff options
author | Takayuki Shimizukawa <shimizukawa@gmail.com> | 2014-08-24 11:02:36 +0900 |
---|---|---|
committer | Takayuki Shimizukawa <shimizukawa@gmail.com> | 2014-08-24 11:02:36 +0900 |
commit | 8536b4844e6f8c290ad84f2de233dec76ba9547f (patch) | |
tree | 664bc175d55372757afa2ba2ee05a244040570f4 /sphinx/directives/code.py | |
parent | 0633892fde35059a6e5e26307ae9cc9eea982406 (diff) | |
parent | 95fc3ce88817658db79cdc8b278e3fef42bcdb98 (diff) | |
download | sphinx-git-8536b4844e6f8c290ad84f2de233dec76ba9547f.tar.gz |
Merged in tk0miya/sphinx (pull request #266)
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 da7dc0caa..6ea525b0f 100644 --- a/sphinx/directives/code.py +++ b/sphinx/directives/code.py @@ -77,7 +77,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): @@ -101,9 +101,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'] = {} @@ -140,7 +140,7 @@ class LiteralInclude(Directive): 'prepend': directives.unchanged_required, 'append': directives.unchanged_required, 'emphasize-lines': directives.unchanged_required, - 'filename': directives.unchanged, + 'caption': directives.unchanged, 'diff': directives.unchanged_required, } @@ -269,11 +269,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 |