| 1 |
""" |
| 2 |
General epytext formating markups are documented here. |
| 3 |
|
| 4 |
Epydoc code related formating are demonstrated in the L{demo_epytext_module}. |
| 5 |
|
| 6 |
Read the U{the epytext manual <http://epydoc.sourceforge.net/manual-epytext.html>} for more documentation. |
| 7 |
|
| 8 |
Scope and Purpose |
| 9 |
================= |
| 10 |
|
| 11 |
Sample package for describing and demonstrating C{pydoctor} HTML API rendering for B{Epytext} based documentation. |
| 12 |
|
| 13 |
Many examples are copied from U{the epytext manual <http://epydoc.sourceforge.net/manual-epytext.html>}. |
| 14 |
|
| 15 |
Try to keep the example as condensed as possible. |
| 16 |
|
| 17 |
- Make it easy to review HTML rendering. |
| 18 |
|
| 19 |
- Cover all epytext markup. |
| 20 |
Like the usage of list with various indentation types. |
| 21 |
|
| 22 |
- Have it build as part of our continuous integration tests. |
| 23 |
To ensure we don't introduce regressions. |
| 24 |
|
| 25 |
Lists |
| 26 |
===== |
| 27 |
|
| 28 |
Epytext supports both ordered and unordered lists. |
| 29 |
A list consists of one or more consecutive list items with the same indentation. |
| 30 |
Each list item is marked by a bullet. |
| 31 |
The bullet for unordered list items is a single dash character (C{-}). |
| 32 |
Bullets for ordered list items consist of a series of numbers followed by periods, |
| 33 |
such as C{12.} or C{1.2.8.}. |
| 34 |
|
| 35 |
Ordered list example: |
| 36 |
|
| 37 |
1. This is an ordered list item. |
| 38 |
|
| 39 |
2. This is a another ordered list |
| 40 |
item. |
| 41 |
|
| 42 |
3. This is a third list item. Note that |
| 43 |
the paragraph may be indented more |
| 44 |
than the bullet. |
| 45 |
|
| 46 |
Example of unordered list: |
| 47 |
|
| 48 |
- This is an ordered list item. |
| 49 |
|
| 50 |
- This is a another ordered list |
| 51 |
item. |
| 52 |
|
| 53 |
Example of complex list: |
| 54 |
|
| 55 |
1. This is a list item. |
| 56 |
- This is a sublist. |
| 57 |
- The sublist contains two |
| 58 |
items. |
| 59 |
- The second item of the |
| 60 |
sublist has its own sublist. |
| 61 |
|
| 62 |
2. This list item contains two |
| 63 |
paragraphs and a doctest block. |
| 64 |
|
| 65 |
>>> print 'This is a doctest block' |
| 66 |
This is a doctest block |
| 67 |
|
| 68 |
This is the second paragraph. |
| 69 |
|
| 70 |
|
| 71 |
Literal Blocks |
| 72 |
============== |
| 73 |
|
| 74 |
Literal blocks are used to represent "preformatted" text. |
| 75 |
Everything within a literal block should be displayed exactly as it appears in plaintext. |
| 76 |
|
| 77 |
- Spaces and newlines are preserved. |
| 78 |
- Text is shown in a monospaced font. |
| 79 |
- Inline markup is not detected. |
| 80 |
|
| 81 |
Literal blocks are introduced by paragraphs ending in the special sequence C{::}. |
| 82 |
Literal blocks end at the first line whose indentation is equal to or less than that of the paragraph that introduces them. |
| 83 |
|
| 84 |
The following is a literal block:: |
| 85 |
|
| 86 |
Literal / |
| 87 |
/ X{Block} |
| 88 |
|
| 89 |
|
| 90 |
Doctest Blocks |
| 91 |
============== |
| 92 |
|
| 93 |
- contain examples consisting of Python expressions and their output |
| 94 |
- can be used by the doctest module to test the documented object |
| 95 |
- begin with the special sequence C{>>>} |
| 96 |
- are delimited from surrounding blocks by blank lines |
| 97 |
- may not contain blank lines |
| 98 |
|
| 99 |
The following is a doctest block: |
| 100 |
|
| 101 |
>>> print (1+3, |
| 102 |
... 3+5) |
| 103 |
(4, 8) |
| 104 |
>>> 'a-b-c-d-e'.split('-') |
| 105 |
['a', 'b', 'c', 'd', 'e'] |
| 106 |
|
| 107 |
This is a paragraph following the doctest block. |
| 108 |
|
| 109 |
|
| 110 |
Basic Inline Markup |
| 111 |
=================== |
| 112 |
|
| 113 |
I{B{Inline markup} may be nested; and |
| 114 |
it may span} multiple lines. |
| 115 |
|
| 116 |
Epytext defines four types of inline markup that specify how text should be displayed: |
| 117 |
|
| 118 |
- I{Italicized text} |
| 119 |
- B{Bold-faced text} |
| 120 |
- C{Source code} |
| 121 |
- M{Math} |
| 122 |
|
| 123 |
Without the capital letter, matching |
| 124 |
braces are not interpreted as markup: |
| 125 |
C{my_dict={1:2, 3:4}}. |
| 126 |
|
| 127 |
|
| 128 |
URLs |
| 129 |
==== |
| 130 |
|
| 131 |
The inline markup construct U{text<url>} is used to create links to external URLs and URIs. |
| 132 |
'text' is the text that should be displayed for the link, and 'url' is the target of the link. |
| 133 |
If you wish to use the URL as the text for the link, you can simply write "U{url}". |
| 134 |
Whitespace within URL targets is ignored. |
| 135 |
In particular, URL targets may be split over multiple lines. |
| 136 |
The following example illustrates how URLs can be used: |
| 137 |
|
| 138 |
- U{www.python.org} |
| 139 |
- U{http://www.python.org} |
| 140 |
- U{The epydoc homepage<http:// |
| 141 |
epydoc.sourceforge.net>} |
| 142 |
- U{The B{Python} homepage |
| 143 |
<www.python.org>} |
| 144 |
- U{Edward Loper<mailto:edloper@ |
| 145 |
gradient.cis.upenn.edu>} |
| 146 |
|
| 147 |
|
| 148 |
Symbols |
| 149 |
======= |
| 150 |
|
| 151 |
Symbols are used to insert special characters in your documentation. |
| 152 |
A symbol has the form SE{lb}codeE{rb}, |
| 153 |
where code is a symbol code that specifies what character should be produced. |
| 154 |
|
| 155 |
Symbols can be used in equations: S{sum}S{alpha}/x S{<=} S{beta} |
| 156 |
|
| 157 |
S{<-} and S{larr} both give left |
| 158 |
arrows. Some other arrows are |
| 159 |
S{rarr}, S{uarr}, and S{darr}. |
| 160 |
|
| 161 |
|
| 162 |
Escaping |
| 163 |
======== |
| 164 |
|
| 165 |
Escaping is used to write text that would otherwise be interpreted as epytext markup. |
| 166 |
|
| 167 |
Escaped text has the form EE{lb}codeE{rb}, |
| 168 |
where code is an escape code that specifies what character should be produced. |
| 169 |
|
| 170 |
If the escape code is a single character (other than '{' or '}'), then that character is produced. |
| 171 |
For example, to begin a paragraph with a dash (which would normally signal a list item), write 'E{-}'. |
| 172 |
In addition, two special escape codes are defined: 'E{lb}' produces a left curly brace ('{'); and 'E{rb}' produces a right curly brace ('}'). |
| 173 |
|
| 174 |
This paragraph ends with two |
| 175 |
colons, but does not introduce |
| 176 |
a literal blockE{:}E{:} |
| 177 |
|
| 178 |
E{-} This is not a list item. |
| 179 |
|
| 180 |
Escapes can be used to write |
| 181 |
unmatched curly braces: |
| 182 |
E{rb}E{lb} |
| 183 |
|
| 184 |
""" |