summaryrefslogtreecommitdiff
path: root/sphinx/directives/code.py
diff options
context:
space:
mode:
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', ''):