diff options
| author | Georg Brandl <georg@python.org> | 2010-01-08 18:36:58 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2010-01-08 18:36:58 +0100 |
| commit | 1be1668cf717e78a1bca86df8d1f6493fe33dac4 (patch) | |
| tree | 418ff1742f47efccf5a26775ce869c4011d81d47 /sphinx/directives/code.py | |
| parent | a1614c9b15a76e7218b00dacde6e11889b17648b (diff) | |
| download | sphinx-1be1668cf717e78a1bca86df8d1f6493fe33dac4.tar.gz | |
Added ``tab-width`` option to ``literalinclude`` directive.
Diffstat (limited to 'sphinx/directives/code.py')
| -rw-r--r-- | sphinx/directives/code.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py index 1ae8b3a8..6535bdf5 100644 --- a/sphinx/directives/code.py +++ b/sphinx/directives/code.py @@ -81,6 +81,7 @@ class LiteralInclude(Directive): final_argument_whitespace = False option_spec = { 'linenos': directives.flag, + 'tab-width': int, 'language': directives.unchanged_required, 'encoding': directives.encoding, 'pyobject': directives.unchanged_required, @@ -174,6 +175,8 @@ class LiteralInclude(Directive): lines.append(append + '\n') text = ''.join(lines) + if self.options.get('tab-width'): + text = text.expandtabs(self.options['tab-width']) retnode = nodes.literal_block(text, text, source=fn) retnode.line = 1 if self.options.get('language', ''): |
