~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to wiki/underlay/pages/HelpOnParsers(2f)ReStructuredText/revisions/00000001

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20080622211713-inlv5k4eifxckelr
ImportĀ upstreamĀ versionĀ 1.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## Please edit system and help pages ONLY in the master wiki!
 
2
## For more information, please see MoinMoin:MoinDev/Translation.
 
3
##master-page:Unknown-Page
 
4
##master-date:Unknown-Date
 
5
#acl -All:write Default
 
6
#format wiki
 
7
#language en
 
8
= What is ReStructured Text? =
 
9
 
 
10
Re``Structured``Text is an easy-to-read, what-you-see-is-what-you-get plaintext markup syntax and parser system. It is useful for in-line program documentation (such as Python docstrings), for quickly creating simple web pages, and for stand-alone documents. Re``Structured``Text is designed for extensibility for specific application domains. Re``Structured``Text is a revision and re-interpretation of the Structured``Text and Setext lightweight markup systems.
 
11
 
 
12
People new to Wikis often find the Re``Structured``Text markup more natural and easier to learn than the default markup of MoinMoin.
 
13
 
 
14
= ReStructuredText Parser =
 
15
 
 
16
== Installation ==
 
17
Before you can use it, you need to install the Python docutils package, which provides the additional Re``Structured``Text support that MoinMoin needs.  
 
18
 
 
19
The docutils version you will need depends on the MoinMoin version.
 
20
If you are reading this text here as part of your MoinMoin installation, you probably have MoinMoin 1.5 or newer, which currently (as of January 2006) needs docutils 0.4.0 or newer, or a recent 0.3.10 snapshot.  If you are using MoinMoin on Linux, docutils is probably already available
 
21
as part of your Linux distribution.  For example on Debian GNU/Linux you simply need to type {{{apt-get install python-docutils}}}.  Other
 
22
Linux distributions use other means to install packages:  See the documentation of your Linux distribution.
 
23
 
 
24
== The Parser in MoinMoin ==
 
25
The parser supports the same features that are supported by the docutils HTML writer. However, some aspects have been slightly modified to work well with MoinMoin. These areas are outlined below.
 
26
 
 
27
== Using ReST in MoinMoin ==
 
28
 
 
29
=== Example ===
 
30
 
 
31
{{{#!rst
 
32
This is a *very* simple example. If you see two asterisks around the word "very" in the previous sentence, then the module docutils is improperly installed (or not installed at all). When the module docutils is there, the word is displayed in italics and this whole block of text is not displayed in a special source-code-like format, but like a normal part of the page.
 
33
}}}
 
34
 
 
35
=== Unknown Targets ===
 
36
 
 
37
Unknown targets are used to create wiki links. Typically an unknown target would cause an error in a reStructuredText document. To enable wiki like behavior, unknown targets now create links to wiki pages using the target name as the name of the wiki page. For example:
 
38
 
 
39
 {{{ #!rst
 
40
 
 
41
Here is a link to a MoinMoin page named SecondPage_.
 
42
}}}
 
43
 
 
44
 {{{#!rst
 
45
 
 
46
Here is a link to a MoinMoin page named SecondPage_.
 
47
}}}
 
48
 
 
49
The above contains a reStructuredText reference to "SecondPage". The reference would typically cause an unknown target error from the docutils parser. This is because there isn't a target in the document named "SecondPage". However, with the MoinMoin parser, the "SecondPage_" reference instead creates a link to a MoinMoin page named "SecondPage".
 
50
 
 
51
=== Support for MoinMoin-specific link schemes ===
 
52
 
 
53
MoinMoin-specific link schemes are supported when used in a reStructuredText  explicit hyperlink target. For example:
 
54
 
 
55
 {{{ #!rst
 
56
Here is a link to a page attachment__.
 
57
 
 
58
__ attachment:Attachment.zip
 
59
}}}
 
60
 
 
61
 {{{#!rst
 
62
Here is a link to a page attachment__.
 
63
 
 
64
__ attachment:Attachment.zip
 
65
}}}
 
66
 
 
67
The above creates a link to an attachment named Attachment.zip. If the attachment for the page does not exist, the link text will be replaced with the typical MoinMoin replacement text for uploading an attachment. Supported MoinMoin-specific link schemes are:
 
68
 
 
69
    * {{{wiki:}}}
 
70
    * {{{attachment:}}}
 
71
    * {{{inline:}}}
 
72
    * {{{drawing:}}}
 
73
    
 
74
=== Inline Images ===
 
75
 
 
76
Docutils image directives, that are not urls, are converted to MoinMoin {{{inline:}}} links. This produces the expected behavior of inserting the image into the document. If the image attachment does not exist, the typical MoinMoin upload new attachment message will be displayed instead. For example:
 
77
 
 
78
 {{{ #!rst
 
79
Here is the picture I took yesterday |image|
 
80
 
 
81
.. |image| image:: Yesterday.jpg
 
82
}}}
 
83
 
 
84
 {{{#!rst
 
85
Here is the picture I took yesterday |image|
 
86
 
 
87
.. |image| image:: Yesterday.jpg
 
88
}}}
 
89
 
 
90
The above will insert the image "Yesterday.jpg" in place of {{{|image|}}}.
 
91
 
 
92
=== Experimental Features ===
 
93
 
 
94
The include and macro directives are considered experimental due to lack of
 
95
testing. They are expected to work but have not been used extensively.
 
96
 
 
97
==== Include Support ====
 
98
 
 
99
The reStructuredText include directive is supported with some restrictions. The directive allows including wiki pages from the same wiki (page attachments are not candidates for the include directive). Included pages must be formatted using reStructuredText (wiki formatted pages will produce improperly formatted documents). For example, the following would insert the pages header and footer surrounding the page contents.
 
100
 
 
101
 {{{ #!rst
 
102
.. include:: header
 
103
 
 
104
The sole document sentence.
 
105
 
 
106
.. include:: footer
 
107
}}}
 
108
 
 
109
The number of included documents is limited to ten. This is to prevent denial of service attacks using recursive include directives.
 
110
 
 
111
==== Macro Support ====
 
112
 
 
113
The MoinMoin reStructuredText parser adds a new MoinMoin specific macro
 
114
directive. The directive allows access to MoinMoin macros from within a
 
115
reStructuredText document. For example:
 
116
 
 
117
 {{{ #!rst
 
118
Use the title search macro to insert a search box to search through page titles.
 
119
 
 
120
.. macro:: [[TitleSearch]]
 
121
}}}
 
122
 
 
123
 {{{#!rst
 
124
Use the title search macro to insert a search box to search through page titles.
 
125
 
 
126
.. macro:: [[TitleSearch]]
 
127
}}}
 
128
 
 
129
=== Known Issues ===
 
130
 
 
131
 * Docutils and MoinMoin use different sets of css directives. Some directives overlap, while others do not. For example, the note directive is not displayed with any special formatting. This issue is most severe when using the rightsidebar theme with the docutils sidebar directive. The docutils sidebar will replace the MoinMoin sidebar. It is currently recommended that the sidebar directive not be used with MoinMoin.
 
132
 * Features related to external URL and local file retrieval are unsupported by the parser in order to guarantee local security. Besides that, raw roles and other features that might support the user to output raw HTML are disallowed, too.
 
133
 
 
134
=== Links ===
 
135
 
 
136
  * [[http://docutils.sourceforge.net/rst.html|reStructuredText]]
 
137
  * [[http://docutils.sourceforge.net/docs/user/rst/quickref.html|Quick Reference]]
 
138
  * [[http://docutils.sourceforge.net/|Docutils]]
 
139
  * [[HelpOnParsers/ReStructuredText/RstPrimer|A ReStructuredText Primer]]