mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Added `tab-width option to literalinclude` directive.
This commit is contained in:
@@ -49,6 +49,16 @@ Literalinclude options
|
||||
:prepend: START CODE
|
||||
:append: END CODE
|
||||
|
||||
.. cssclass:: inc-tab3
|
||||
.. literalinclude:: tabs.inc
|
||||
:tab-width: 3
|
||||
:language: text
|
||||
|
||||
.. cssclass:: inc-tab8
|
||||
.. literalinclude:: tabs.inc
|
||||
:tab-width: 8
|
||||
:language: python
|
||||
|
||||
Test if dedenting before parsing works.
|
||||
|
||||
.. highlight:: python
|
||||
|
||||
5
tests/root/tabs.inc
Normal file
5
tests/root/tabs.inc
Normal file
@@ -0,0 +1,5 @@
|
||||
Tabs include file test
|
||||
----------------------
|
||||
|
||||
The next line has a tab:
|
||||
-| |-
|
||||
@@ -119,18 +119,22 @@ HTML_XPATH = {
|
||||
if pygments:
|
||||
HTML_XPATH['includes.html'].update({
|
||||
".//pre/span[@class='s']": u'üöä',
|
||||
".//div[@class='inc-pyobj1 highlight-text']/div/pre":
|
||||
".//div[@class='inc-pyobj1 highlight-text']//pre":
|
||||
r'^class Foo:\n pass\n\s*$',
|
||||
".//div[@class='inc-pyobj2 highlight-text']/div/pre":
|
||||
".//div[@class='inc-pyobj2 highlight-text']//pre":
|
||||
r'^ def baz\(\):\n pass\n\s*$',
|
||||
".//div[@class='inc-lines highlight-text']/div/pre":
|
||||
".//div[@class='inc-lines highlight-text']//pre":
|
||||
r'^class Foo:\n pass\nclass Bar:\n$',
|
||||
".//div[@class='inc-startend highlight-text']/div/pre":
|
||||
".//div[@class='inc-startend highlight-text']//pre":
|
||||
ur'^foo = u"Including Unicode characters: üöä"\n$',
|
||||
".//div[@class='inc-preappend highlight-text']/div/pre":
|
||||
".//div[@class='inc-preappend highlight-text']//pre":
|
||||
r'(?m)^START CODE$',
|
||||
".//div[@class='inc-pyobj-dedent highlight-python']/div/pre/span":
|
||||
".//div[@class='inc-pyobj-dedent highlight-python']//span":
|
||||
r'def',
|
||||
".//div[@class='inc-tab3 highlight-text']//pre":
|
||||
r'-| |-',
|
||||
".//div[@class='inc-tab8 highlight-python']//pre":
|
||||
r'-| |-',
|
||||
})
|
||||
HTML_XPATH['subdir/includes.html'].update({
|
||||
".//pre/span": 'line 1',
|
||||
|
||||
Reference in New Issue
Block a user