diff options
| author | Georg Brandl <georg@python.org> | 2009-01-02 00:32:02 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2009-01-02 00:32:02 +0100 |
| commit | 8429841e5c11fa1e3ce5c56dd7070c1bd21a51ec (patch) | |
| tree | f0534f57267a9bd90596550cd7ea5ee128915e6d /doc/markup/code.rst | |
| parent | 5d006c40aabdf9aad10f7871a55db4416d80d98a (diff) | |
| download | sphinx-8429841e5c11fa1e3ce5c56dd7070c1bd21a51ec.tar.gz | |
Document new literalinclude options.
Diffstat (limited to 'doc/markup/code.rst')
| -rw-r--r-- | doc/markup/code.rst | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/doc/markup/code.rst b/doc/markup/code.rst index 2fd51c84..0bf8343b 100644 --- a/doc/markup/code.rst +++ b/doc/markup/code.rst @@ -123,10 +123,25 @@ Includes This would only include the code lines belonging to the ``start()`` method in the ``Timer`` class within the file. + Alternately, you can specify exactly which lines to include by giving a + ``lines`` option:: + + .. literalinclude:: example.py + :lines: 1,3,5-10,20- + + This includes the lines 1, 3, 5 to 10 and lines 20 to the last line. + + Another way to control which part of the file is included is to use the + ``start-after`` and ``end-before`` options (or only one of them). If + ``start-after`` is given as a string option, only lines that follow the first + line containing that string are included. If ``end-before`` is given as a + string option, only lines that precede the first lines containing that string + are included. + .. versionadded:: 0.4.3 The ``encoding`` option. .. versionadded:: 0.6 - The ``pyobject`` option. + The ``pyobject``, ``lines``, ``start-after`` and ``end-before`` options. .. rubric:: Footnotes |
