summaryrefslogtreecommitdiff
path: root/sphinx/directives/code.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-01-08 18:36:58 +0100
committerGeorg Brandl <georg@python.org>2010-01-08 18:36:58 +0100
commitc80f52dfbfaf2148d2ce1695b706b1e95b22f997 (patch)
tree418ff1742f47efccf5a26775ce869c4011d81d47 /sphinx/directives/code.py
parent2ca792f809cc0c2949d57464d95aea35269fd93e (diff)
downloadsphinx-git-c80f52dfbfaf2148d2ce1695b706b1e95b22f997.tar.gz
Added ``tab-width`` option to ``literalinclude`` directive.
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r--sphinx/directives/code.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py
index 1ae8b3a84..6535bdf56 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', ''):