diff options
| author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2011-09-02 13:00:23 +0000 |
|---|---|---|
| committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2011-09-02 13:00:23 +0000 |
| commit | 65eeb2675166b6e88d35e20bc9a23e49724cdf74 (patch) | |
| tree | 48d073a0334bbb36fc1156e904044ab6ac055ec8 /docutils/test/functional/input | |
| parent | c8a67b4c2e573e5c5c8c6a6e2d81451c6b040008 (diff) | |
| download | docutils-65eeb2675166b6e88d35e20bc9a23e49724cdf74.tar.gz | |
reStructuredText "code" role and directive
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@7119 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/test/functional/input')
| -rw-r--r-- | docutils/test/functional/input/data/standard.txt | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/docutils/test/functional/input/data/standard.txt b/docutils/test/functional/input/data/standard.txt index 194c39fac..d2979844f 100644 --- a/docutils/test/functional/input/data/standard.txt +++ b/docutils/test/functional/input/data/standard.txt @@ -121,9 +121,10 @@ __ http://docutils.sourceforge.net/ The default role for interpreted text is `Title Reference`. Here are some explicit interpreted text roles: a PEP reference (:PEP:`287`); an -RFC reference (:RFC:`2822`); a :sub:`subscript`; a :sup:`superscript`; -and explicit roles for :emphasis:`standard` :strong:`inline` -:literal:`markup`. +RFC reference (:RFC:`2822`); an abbreviation (:ab:`abb.`), an acronym +(:ac:`reST`), code (:code:`print "hello world"`); a :sub:`subscript`; +a :sup:`superscript` and explicit roles for :title:`Docutils`' +:emphasis:`standard` :strong:`inline` :literal:`markup`. .. DO NOT RE-WRAP THE FOLLOWING PARAGRAPH! @@ -754,6 +755,41 @@ Parsed Literal Blocks text``, footnotes [1]_, _`hyperlink targets`, and `references <http://www.python.org/>`_. +Code +```` + +Blocks of source code can be set with the `code` directive. If the +code language is specified, the content is parsed and tagged by the +Pygments_ syntax highlighter and can be formatted with a style sheet: + +.. code:: python + + print 'This is Python code.' + +There is an option for line numbers with optional start value: + +.. code:: python + :number-lines: 8 + + # print integers from 0 to 9: + for i in range(10): + print i + +For inline code snippets, there is the `code` role, which can be used +directly (the code will not be parsed/tagged, as the language is not +known) or as base for special code roles, e.g., + +.. role:: tex(code) + :language: latex + +.. + + Docutils uses LaTeX syntax for math directives and roles: + :tex:`\alpha = f(x)` prints :math:`\alpha = f(x)`. + +.. _Pygments: http://pygments.org/ + + Substitution Definitions ------------------------ |
