root / PyCon07 / material / cheatsheet.html

Revision 19:8f9db9946360, 17.2 kB (checked in by Tarek Ziad?? <tarek@…>, 21 months ago)

added reST cheatsheet

Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
7<title>The reStructuredText Cheat Sheet: Syntax Reminders</title>
8<meta name="author" content="David Goodger &lt;goodger&#64;python.org&gt;" />
9<meta name="date" content="2006-01-23" />
10<style type="text/css">
11
12/*
13:Author: David Goodger
14:Contact: goodger@users.sourceforge.net
15:Date: $Date: 2005-12-18 01:56:14 +0100 (Sun, 18 Dec 2005) $
16:Revision: $Revision: 4224 $
17:Copyright: This stylesheet has been placed in the public domain.
18
19Default cascading style sheet for the HTML output of Docutils.
20
21See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
22customize this style sheet.
23*/
24
25/* used to remove borders from tables and images */
26.borderless, table.borderless td, table.borderless th {
27  border: 0 }
28
29table.borderless td, table.borderless th {
30  /* Override padding for "table.docutils td" with "! important".
31     The right padding separates the table cells. */
32  padding: 0 0.5em 0 0 ! important }
33
34.first {
35  /* Override more specific margin styles with "! important". */
36  margin-top: 0 ! important }
37
38.last, .with-subtitle {
39  margin-bottom: 0 ! important }
40
41.hidden {
42  display: none }
43
44a.toc-backref {
45  text-decoration: none ;
46  color: black }
47
48blockquote.epigraph {
49  margin: 2em 5em ; }
50
51dl.docutils dd {
52  margin-bottom: 0.5em }
53
54/* Uncomment (and remove this text!) to get bold-faced definition list terms
55dl.docutils dt {
56  font-weight: bold }
57*/
58
59div.abstract {
60  margin: 2em 5em }
61
62div.abstract p.topic-title {
63  font-weight: bold ;
64  text-align: center }
65
66div.admonition, div.attention, div.caution, div.danger, div.error,
67div.hint, div.important, div.note, div.tip, div.warning {
68  margin: 2em ;
69  border: medium outset ;
70  padding: 1em }
71
72div.admonition p.admonition-title, div.hint p.admonition-title,
73div.important p.admonition-title, div.note p.admonition-title,
74div.tip p.admonition-title {
75  font-weight: bold ;
76  font-family: sans-serif }
77
78div.attention p.admonition-title, div.caution p.admonition-title,
79div.danger p.admonition-title, div.error p.admonition-title,
80div.warning p.admonition-title {
81  color: red ;
82  font-weight: bold ;
83  font-family: sans-serif }
84
85/* Uncomment (and remove this text!) to get reduced vertical space in
86   compound paragraphs.
87div.compound .compound-first, div.compound .compound-middle {
88  margin-bottom: 0.5em }
89
90div.compound .compound-last, div.compound .compound-middle {
91  margin-top: 0.5em }
92*/
93
94div.dedication {
95  margin: 2em 5em ;
96  text-align: center ;
97  font-style: italic }
98
99div.dedication p.topic-title {
100  font-weight: bold ;
101  font-style: normal }
102
103div.figure {
104  margin-left: 2em ;
105  margin-right: 2em }
106
107div.footer, div.header {
108  clear: both;
109  font-size: smaller }
110
111div.line-block {
112  display: block ;
113  margin-top: 1em ;
114  margin-bottom: 1em }
115
116div.line-block div.line-block {
117  margin-top: 0 ;
118  margin-bottom: 0 ;
119  margin-left: 1.5em }
120
121div.sidebar {
122  margin-left: 1em ;
123  border: medium outset ;
124  padding: 1em ;
125  background-color: #ffffee ;
126  width: 40% ;
127  float: right ;
128  clear: right }
129
130div.sidebar p.rubric {
131  font-family: sans-serif ;
132  font-size: medium }
133
134div.system-messages {
135  margin: 5em }
136
137div.system-messages h1 {
138  color: red }
139
140div.system-message {
141  border: medium outset ;
142  padding: 1em }
143
144div.system-message p.system-message-title {
145  color: red ;
146  font-weight: bold }
147
148div.topic {
149  margin: 2em }
150
151h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
152h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
153  margin-top: 0.4em }
154
155h1.title {
156  text-align: center }
157
158h2.subtitle {
159  text-align: center }
160
161hr.docutils {
162  width: 75% }
163
164img.align-left {
165  clear: left }
166
167img.align-right {
168  clear: right }
169
170ol.simple, ul.simple {
171  margin-bottom: 1em }
172
173ol.arabic {
174  list-style: decimal }
175
176ol.loweralpha {
177  list-style: lower-alpha }
178
179ol.upperalpha {
180  list-style: upper-alpha }
181
182ol.lowerroman {
183  list-style: lower-roman }
184
185ol.upperroman {
186  list-style: upper-roman }
187
188p.attribution {
189  text-align: right ;
190  margin-left: 50% }
191
192p.caption {
193  font-style: italic }
194
195p.credits {
196  font-style: italic ;
197  font-size: smaller }
198
199p.label {
200  white-space: nowrap }
201
202p.rubric {
203  font-weight: bold ;
204  font-size: larger ;
205  color: maroon ;
206  text-align: center }
207
208p.sidebar-title {
209  font-family: sans-serif ;
210  font-weight: bold ;
211  font-size: larger }
212
213p.sidebar-subtitle {
214  font-family: sans-serif ;
215  font-weight: bold }
216
217p.topic-title {
218  font-weight: bold }
219
220pre.address {
221  margin-bottom: 0 ;
222  margin-top: 0 ;
223  font-family: serif ;
224  font-size: 100% }
225
226pre.literal-block, pre.doctest-block {
227  margin-left: 2em ;
228  margin-right: 2em ;
229  background-color: #eeeeee }
230
231span.classifier {
232  font-family: sans-serif ;
233  font-style: oblique }
234
235span.classifier-delimiter {
236  font-family: sans-serif ;
237  font-weight: bold }
238
239span.interpreted {
240  font-family: sans-serif }
241
242span.option {
243  white-space: nowrap }
244
245span.pre {
246  white-space: pre }
247
248span.problematic {
249  color: red }
250
251span.section-subtitle {
252  /* font-size relative to parent (h1..h6 element) */
253  font-size: 80% }
254
255table.citation {
256  border-left: solid 1px gray;
257  margin-left: 1px }
258
259table.docinfo {
260  margin: 2em 4em }
261
262table.docutils {
263  margin-top: 0.5em ;
264  margin-bottom: 0.5em }
265
266table.footnote {
267  border-left: solid 1px black;
268  margin-left: 1px }
269
270table.docutils td, table.docutils th,
271table.docinfo td, table.docinfo th {
272  padding-left: 0.5em ;
273  padding-right: 0.5em ;
274  vertical-align: top }
275
276table.docutils th.field-name, table.docinfo th.docinfo-name {
277  font-weight: bold ;
278  text-align: left ;
279  white-space: nowrap ;
280  padding-left: 0 }
281
282h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
283h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
284  font-size: 100% }
285
286tt.docutils {
287  background-color: #eeeeee }
288
289ul.auto-toc {
290  list-style-type: none }
291
292</style>
293</head>
294<body>
295<div class="document" id="the-restructuredtext-cheat-sheet-syntax-reminders">
296<h1 class="title">The <a class="reference" href="http://docutils.sf.net/rst.html">reStructuredText</a> Cheat Sheet: Syntax Reminders</h1>
297<table class="docinfo" frame="void" rules="none">
298<col class="docinfo-name" />
299<col class="docinfo-content" />
300<tbody valign="top">
301<tr class="field"><th class="docinfo-name">Info:</th><td class="field-body">See &lt;<a class="reference" href="http://docutils.sf.net/rst.html">http://docutils.sf.net/rst.html</a>&gt; for introductory docs.</td>
302</tr>
303<tr><th class="docinfo-name">Author:</th>
304<td>David Goodger &lt;<a class="reference" href="mailto:goodger&#64;python.org">goodger&#64;python.org</a>&gt;</td></tr>
305<tr><th class="docinfo-name">Date:</th>
306<td>2006-01-23</td></tr>
307<tr><th class="docinfo-name">Revision:</th>
308<td>4321</td></tr>
309<tr class="field"><th class="docinfo-name">Description:</th><td class="field-body">This is a &quot;docinfo block&quot;, or bibliographic field list</td>
310</tr>
311</tbody>
312</table>
313<div class="section">
314<h1><a id="section-structure" name="section-structure">Section Structure</a></h1>
315<p>Section titles are underlined or overlined &amp; underlined.</p>
316</div>
317<div class="section">
318<h1><a id="body-elements" name="body-elements">Body Elements</a></h1>
319<p>Grid table:</p>
320<table border="1" class="docutils">
321<colgroup>
322<col width="48%" />
323<col width="52%" />
324</colgroup>
325<tbody valign="top">
326<tr><td><p class="first">Paragraphs are flush-left,
327separated by blank lines.</p>
328<blockquote class="last">
329Block quotes are indented.</blockquote>
330</td>
331<td rowspan="2"><p class="first">Literal block, preceded by &quot;::&quot;:</p>
332<pre class="literal-block">
333Indented
334</pre>
335<p>or:</p>
336<pre class="last literal-block">
337&gt; Quoted
338</pre>
339</td>
340</tr>
341<tr><td><pre class="first last doctest-block">
342&gt;&gt;&gt; print 'Doctest block'
343Doctest block
344</pre>
345</td>
346</tr>
347<tr><td colspan="2"><div class="first last line-block">
348<div class="line">Line blocks preserve line breaks &amp; indents. [new in 0.3.6]</div>
349<div class="line-block">
350<div class="line">Useful for addresses, verse, and adornment-free lists; long
351lines can be wrapped with continuation lines.</div>
352</div>
353</div>
354</td>
355</tr>
356</tbody>
357</table>
358<p>Simple tables:</p>
359<table border="1" class="docutils">
360<colgroup>
361<col width="21%" />
362<col width="79%" />
363</colgroup>
364<thead valign="bottom">
365<tr><th class="head">List Type</th>
366<th class="head">Examples</th>
367</tr>
368</thead>
369<tbody valign="top">
370<tr><td>Bullet list</td>
371<td><ul class="first last simple">
372<li>items begin with &quot;-&quot;, &quot;+&quot;, or &quot;*&quot;</li>
373</ul>
374</td>
375</tr>
376<tr><td>Enumerated list</td>
377<td><ol class="first last arabic simple">
378<li>items use any variation of &quot;1.&quot;, &quot;A)&quot;, and &quot;(i)&quot;</li>
379<li>also auto-enumerated</li>
380</ol>
381</td>
382</tr>
383<tr><td>Definition list</td>
384<td><dl class="first last docutils">
385<dt>Term is flush-left <span class="classifier-delimiter">:</span> <span class="classifier">optional classifier</span></dt>
386<dd>Definition is indented, no blank line between</dd>
387</dl>
388</td>
389</tr>
390<tr><td>Field list</td>
391<td><table class="first last docutils field-list" frame="void" rules="none">
392<col class="field-name" />
393<col class="field-body" />
394<tbody valign="top">
395<tr class="field"><th class="field-name">field name:</th><td class="field-body">field body</td>
396</tr>
397</tbody>
398</table>
399</td>
400</tr>
401<tr><td>Option list</td>
402<td><table class="first last docutils option-list" frame="void" rules="none">
403<col class="option" />
404<col class="description" />
405<tbody valign="top">
406<tr><td class="option-group">
407<kbd><span class="option">-o</span></kbd></td>
408<td>at least 2 spaces between option &amp; description</td></tr>
409</tbody>
410</table>
411</td>
412</tr>
413</tbody>
414</table>
415<table border="1" class="docutils">
416<colgroup>
417<col width="21%" />
418<col width="79%" />
419</colgroup>
420<thead valign="bottom">
421<tr><th class="head">Explicit Markup</th>
422<th class="head">Examples (visible in the <a class="reference" href="cheatsheet.txt">text source</a>)</th>
423</tr>
424</thead>
425<tbody valign="top">
426<tr><td>Footnote</td>
427<td><table class="first last docutils footnote" frame="void" id="id1" rules="none">
428<colgroup><col class="label" /><col /></colgroup>
429<tbody valign="top">
430<tr><td class="label"><a class="fn-backref" href="#id3" name="id1">[1]</a></td><td>Manually numbered or [#] auto-numbered
431(even [#labelled]) or [*] auto-symbol</td></tr>
432</tbody>
433</table>
434</td>
435</tr>
436<tr><td>Citation</td>
437<td><table class="first last docutils citation" frame="void" id="cit2002" rules="none">
438<colgroup><col class="label" /><col /></colgroup>
439<tbody valign="top">
440<tr><td class="label"><a class="fn-backref" href="#id4" name="cit2002">[CIT2002]</a></td><td>A citation.</td></tr>
441</tbody>
442</table>
443</td>
444</tr>
445<tr><td>Hyperlink Target</td>
446<td></td>
447</tr>
448<tr id="internal-target"><td>Anonymous Target</td>
449<td></td>
450</tr>
451<tr><td>Directive (&quot;::&quot;)</td>
452<td><img alt="images/biohazard.png" class="first last" src="images/biohazard.png" />
453</td>
454</tr>
455<tr><td>Substitution Def</td>
456<td></td>
457</tr>
458<tr><td>Comment</td>
459<td><!-- is anything else -->
460</td>
461</tr>
462<tr><td>Empty Comment</td>
463<td>(&quot;..&quot; on a line by itself, with blank lines before &amp; after,
464used to separate indentation contexts)</td>
465</tr>
466</tbody>
467</table>
468</div>
469<div class="section">
470<h1><a id="inline-markup" name="inline-markup">Inline Markup</a></h1>
471<p><em>emphasis</em>; <strong>strong emphasis</strong>; <cite>interpreted text</cite>; <em>interpreted text
472with role</em>; <tt class="docutils literal"><span class="pre">inline</span> <span class="pre">literal</span> <span class="pre">text</span></tt>; standalone hyperlink,
473<a class="reference" href="http://docutils.sourceforge.net">http://docutils.sourceforge.net</a>; named reference, <a class="reference" href="http://docutils.sf.net/rst.html">reStructuredText</a>;
474<a class="reference" href="http://docutils.sf.net/docs/ref/rst/restructuredtext.html">anonymous reference</a>; footnote reference, <a class="footnote-reference" href="#id1" id="id3" name="id3">[1]</a>; citation reference,
475<a class="citation-reference" href="#cit2002" id="id4" name="id4">[CIT2002]</a>; like an inline directive; <span class="target" id="inline-internal-target">inline internal target</span>.</p>
476</div>
477<div class="section">
478<h1><a id="directive-quick-reference" name="directive-quick-reference">Directive Quick Reference</a></h1>
479<p>See &lt;<a class="reference" href="http://docutils.sf.net/docs/ref/rst/directives.html">http://docutils.sf.net/docs/ref/rst/directives.html</a>&gt; for full info.</p>
480<table border="1" class="docutils">
481<colgroup>
482<col width="21%" />
483<col width="79%" />
484</colgroup>
485<thead valign="bottom">
486<tr><th class="head">Directive Name</th>
487<th class="head">Description (Docutils version added to, in [brackets])</th>
488</tr>
489</thead>
490<tbody valign="top">
491<tr><td>attention</td>
492<td>Specific admonition; also &quot;caution&quot;, &quot;danger&quot;,
493&quot;error&quot;, &quot;hint&quot;, &quot;important&quot;, &quot;note&quot;, &quot;tip&quot;, &quot;warning&quot;</td>
494</tr>
495<tr><td>admonition</td>
496<td>Generic titled admonition: <tt class="docutils literal"><span class="pre">..</span> <span class="pre">admonition::</span> <span class="pre">By</span> <span class="pre">The</span> <span class="pre">Way</span></tt></td>
497</tr>
498<tr><td>image</td>
499<td><tt class="docutils literal"><span class="pre">..</span> <span class=