mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
add test and document about diff params in literalinclude.
This commit is contained in:
parent
ea37c01552
commit
4e70d364ba
@ -180,6 +180,16 @@ Includes
|
|||||||
``prepend`` and ``append`` option, respectively. This is useful e.g. for
|
``prepend`` and ``append`` option, respectively. This is useful e.g. for
|
||||||
highlighting PHP code that doesn't include the ``<?php``/``?>`` markers.
|
highlighting PHP code that doesn't include the ``<?php``/``?>`` markers.
|
||||||
|
|
||||||
|
|
||||||
|
If you want to show the diff of the code, you can specify the old
|
||||||
|
file by giving a ``diff`` option::
|
||||||
|
|
||||||
|
.. literalinclude:: example.py
|
||||||
|
:diff: example.py.orig
|
||||||
|
|
||||||
|
This shows the diff between example.py and example.py.orig with unified diff format.
|
||||||
|
|
||||||
|
|
||||||
.. versionadded:: 0.4.3
|
.. versionadded:: 0.4.3
|
||||||
The ``encoding`` option.
|
The ``encoding`` option.
|
||||||
.. versionadded:: 0.6
|
.. versionadded:: 0.6
|
||||||
@ -187,6 +197,8 @@ Includes
|
|||||||
as well as support for absolute filenames.
|
as well as support for absolute filenames.
|
||||||
.. versionadded:: 1.0
|
.. versionadded:: 1.0
|
||||||
The ``prepend`` and ``append`` options, as well as ``tab-width``.
|
The ``prepend`` and ``append`` options, as well as ``tab-width``.
|
||||||
|
.. versionadded:: 1.3
|
||||||
|
The ``diff`` option.
|
||||||
|
|
||||||
|
|
||||||
Showing a file name
|
Showing a file name
|
||||||
|
@ -58,6 +58,9 @@ Literalinclude options
|
|||||||
.. literalinclude:: literal.inc
|
.. literalinclude:: literal.inc
|
||||||
:end-before: class Foo
|
:end-before: class Foo
|
||||||
|
|
||||||
|
.. literalinclude:: literal.inc
|
||||||
|
:diff: literal.inc.orig
|
||||||
|
|
||||||
.. cssclass:: inc-tab3
|
.. cssclass:: inc-tab3
|
||||||
.. literalinclude:: tabs.inc
|
.. literalinclude:: tabs.inc
|
||||||
:tab-width: 3
|
:tab-width: 3
|
||||||
|
13
tests/root/literal.inc.orig
Normal file
13
tests/root/literal.inc.orig
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Literally included file using Python highlighting
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
foo = "Including Unicode characters: üöä" # This will be changed
|
||||||
|
|
||||||
|
class FooOrig:
|
||||||
|
pass
|
||||||
|
|
||||||
|
class BarOrig:
|
||||||
|
def baz():
|
||||||
|
pass
|
||||||
|
|
||||||
|
def bar(): pass
|
Loading…
Reference in New Issue
Block a user