diff options
| author | georg.brandl <devnull@localhost> | 2008-03-16 11:19:26 +0000 |
|---|---|---|
| committer | georg.brandl <devnull@localhost> | 2008-03-16 11:19:26 +0000 |
| commit | 67ca33e1c4f6cbcebc503ed7037e135101f5e46f (patch) | |
| tree | 24bd20c728be044d2acf74d1426ea3624b8e8e8e /doc/markup/code.rst | |
| parent | 6d7da9f9fdaae2a1913c6efc8aa823b888ede577 (diff) | |
| download | sphinx-67ca33e1c4f6cbcebc503ed7037e135101f5e46f.tar.gz | |
Update documentation, add more content.
Diffstat (limited to 'doc/markup/code.rst')
| -rw-r--r-- | doc/markup/code.rst | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/doc/markup/code.rst b/doc/markup/code.rst index ab1420c2..bceafb4c 100644 --- a/doc/markup/code.rst +++ b/doc/markup/code.rst @@ -3,6 +3,9 @@ Showing code examples --------------------- +.. index:: pair: code; examples + single: sourcecode + Examples of Python source code or interactive sessions are represented using standard reST literal blocks. They are started by a ``::`` at the end of the preceding paragraph and delimited by indentation. @@ -78,14 +81,24 @@ on line numbers for the individual block:: Includes ^^^^^^^^ -Longer displays of verbatim text may be included by storing the example text in -an external file containing only plain text. The file may be included using the -``literalinclude`` directive. [1]_ For example, to include the Python source file -:file:`example.py`, use:: +.. directive:: .. literalinclude:: filename + + Longer displays of verbatim text may be included by storing the example text in + an external file containing only plain text. The file may be included using the + ``literalinclude`` directive. [1]_ For example, to include the Python source file + :file:`example.py`, use:: + + .. literalinclude:: example.py - .. literalinclude:: example.py + The file name is relative to the current file's path. -The file name is relative to the current file's path. + The directive also supports the ``linenos`` flag option to switch on line + numbers, and a ``language`` option to select a language different from the + current file's standard language. Example with options:: + + .. literalinclude:: example.rb + :language: ruby + :linenos: .. rubric:: Footnotes |
