What is ReStructured Text?

ReStructuredText 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. ReStructuredText is designed for extensibility for specific application domains. ReStructuredText is a revision and re-interpretation of the StructuredText and Setext lightweight markup systems.

People new to Wikis often find the ReStructuredText markup more natural and easier to learn than the default markup of MoinMoin.

ReStructuredText Parser

Installation

Before you can use it, you need to install the Python docutils package, which provides the additional ReStructuredText support that MoinMoin needs.

The docutils version you will need depends on the MoinMoin version. 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 as part of your Linux distribution. For example on Debian GNU/Linux you simply need to type apt-get install python-docutils. Other Linux distributions use other means to install packages: See the documentation of your Linux distribution.

The Parser in MoinMoin

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.

Using ReST in MoinMoin

Example

--> -->

TypeError

safe_import() got an unexpected keyword argument 'level'

If you want to report a bug, please save this page and attach it to your bug report.

Traceback

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

  1. /usr/local/lib/python2.4/site-packages/MoinMoin/request/__init__.py in run (self=<MoinMoin.request.request_cgi.Request object>)

    1. 1281 self.page.send_page(msg=msg)
    2. 1282 else:
    3. 1283 handler(self.page.page_name, self)
    4. 1284
    5. 1285 # every action that didn't use to raise MoinMoinNoFooter must call this now:
    • handler = <function do_show>
    • self = <MoinMoin.request.request_cgi.Request object>
    • self.page = <MoinMoin.Page.Page object>
    • self.page.page_name = u'HelpOnParsers/ReStructuredText'
  2. /usr/local/lib/python2.4/site-packages/MoinMoin/action/__init__.py in do_show (pagename=u'HelpOnParsers/ReStructuredText', request=<MoinMoin.request.request_cgi.Request object>, content_only=0, count_hit=1, cacheable=1, print_mode=0)

    1. 239 count_hit=count_hit,
    2. 240 print_mode=print_mode,
    3. 241 content_only=content_only,
    4. 242 )
    5. 243
    • content_only = 0
  3. /usr/local/lib/python2.4/site-packages/MoinMoin/Page.py in send_page (self=<MoinMoin.Page.Page object>, msg='', **keywords={'content_only': 0, 'count_hit': 1, 'print_mode': 0})

    1. 1179 format_args=pi['formatargs'],
    2. 1180 do_cache=do_cache,
    3. 1181 start_line=pi['lines'])
    4. 1182
    5. 1183 # check for pending footnotes
    • start_line undefined
    • pi = {'acl': <MoinMoin.security.AccessControlList instance>, 'format': u'wiki', 'formatargs': u'', 'language': u'en', 'lines': 7}
  4. /usr/local/lib/python2.4/site-packages/MoinMoin/Page.py in send_page_content (self=<MoinMoin.Page.Page object>, request=<MoinMoin.request.request_cgi.Request object>, body=u'= What is ReStructured Text? =\n\nRe``Structured``...cturedText/RstPrimer|A ReStructuredText Primer]]\n', format=u'wiki', format_args=u'', do_cache=1, **kw={'start_line': 7})

    1. 1263
    2. 1264 if not (do_cache and self.canUseCache(Parser)):
    3. 1265 self.format(parser)
    4. 1266 else:
    5. 1267 try:
    • self = <MoinMoin.Page.Page object>
    • self.format = <bound method Page.format of <MoinMoin.Page.Page object>>
    • parser = <MoinMoin.parser.text_moin_wiki.Parser instance>
  5. /usr/local/lib/python2.4/site-packages/MoinMoin/Page.py in format (self=<MoinMoin.Page.Page object>, parser=<MoinMoin.parser.text_moin_wiki.Parser instance>)

    1. 1284 def format(self, parser):
    2. 1285 """ Format and write page content without caching """
    3. 1286 parser.format(self.formatter)
    4. 1287
    5. 1288 def execute(self, request, parser, code):
    • parser = <MoinMoin.parser.text_moin_wiki.Parser instance>
    • parser.format = <bound method Parser.format of <MoinMoin.parser.text_moin_wiki.Parser instance>>
    • self = <MoinMoin.Page.Page object>
    • self.formatter = <MoinMoin.formatter.text_html.Formatter instance>
  6. /usr/local/lib/python2.4/site-packages/MoinMoin/parser/text_moin_wiki.py in format (self=<MoinMoin.parser.text_moin_wiki.Parser instance>, formatter=<MoinMoin.formatter.text_html.Formatter instance>, inhibit_p=False)

    1. 1542
    2. 1543 # Scan line, format and write
    3. 1544 formatted_line = self.scan(line, inhibit_p=inhibit_p)
    4. 1545 self.request.write(formatted_line)
    5. 1546
    • formatted_line = u''
    • self = <MoinMoin.parser.text_moin_wiki.Parser instance>
    • self.scan = <bound method Parser.scan of <MoinMoin.parser.text_moin_wiki.Parser instance>>
    • line = u'}}}'
    • inhibit_p = False
  7. /usr/local/lib/python2.4/site-packages/MoinMoin/parser/text_moin_wiki.py in scan (self=<MoinMoin.parser.text_moin_wiki.Parser instance>, line=u'}}}', inhibit_p=False)

    1. 1358 self.in_table or self.in_list):
    2. 1359 result.append(self.formatter.paragraph(1, css_class="line867"))
    3. 1360 result.append(self.replace(match, inhibit_p))
    4. 1361 end = match.end()
    5. 1362 lastpos = end
    • result = []
    • result.append = <built-in method append of list object>
    • self = <MoinMoin.parser.text_moin_wiki.Parser instance>
    • self.replace = <bound method Parser.replace of <MoinMoin.parser.text_moin_wiki.Parser instance>>
    • match = <_sre.SRE_Match object>
    • inhibit_p = False
  8. /usr/local/lib/python2.4/site-packages/MoinMoin/parser/text_moin_wiki.py in replace (self=<MoinMoin.parser.text_moin_wiki.Parser instance>, match=<_sre.SRE_Match object>, inhibit_p=False)

    1. 1400 # Get replace method and replace hit
    2. 1401 replace_func = getattr(self, '_%s_repl' % type)
    3. 1402 result.append(replace_func(hit, match.groupdict()))
    4. 1403 return ''.join(result)
    5. 1404 else:
    • result = []
    • result.append = <built-in method append of list object>
    • replace_func = <bound method Parser._parser_end_repl of <MoinMoin.parser.text_moin_wiki.Parser instance>>
    • hit = u'}}}'
    • match = <_sre.SRE_Match object>
    • match.groupdict = <built-in method groupdict of _sre.SRE_Match object>
  9. /usr/local/lib/python2.4/site-packages/MoinMoin/parser/text_moin_wiki.py in _parser_end_repl (self=<MoinMoin.parser.text_moin_wiki.Parser instance>, word=u'}}}', groups={u'parser_end': u'}}}'})

    1. 1293 # we obviously did not find a parser specification
    2. 1294 self.parser_name = 'text'
    3. 1295 result = self.formatter.parser(self.parser_name, self.parser_lines)
    4. 1296 del self.parser_lines
    5. 1297 self.in_pre = None
    • result undefined
    • self = <MoinMoin.parser.text_moin_wiki.Parser instance>
    • self.formatter = <MoinMoin.formatter.text_html.Formatter instance>
    • self.formatter.parser = <bound method Formatter.parser of <MoinMoin.formatter.text_html.Formatter instance>>
    • self.parser_name = u'rst'
    • self.parser_lines = [u'#!rst ', u'', u'This is a *very* simple example. If you see two ...-like format, but like a normal part of the page.']
  10. /usr/local/lib/python2.4/site-packages/MoinMoin/formatter/__init__.py in parser (self=<MoinMoin.formatter.text_html.Formatter instance>, parser_name=u'rst', lines=[u'This is a *very* simple example. If you see two ...-like format, but like a normal part of the page.'])

    1. 344 lines = lines[:-1]
    2. 345 p = parser('\n'.join(lines), self.request, format_args=args)
    3. 346 p.format(self)
    4. 347 del p
    5. 348 return ''
    • p = <MoinMoin.parser.text_rst.Parser instance>
    • p.format = <bound method Parser.format of <MoinMoin.parser.text_rst.Parser instance>>
    • self = <MoinMoin.formatter.text_html.Formatter instance>
  11. /usr/local/lib/python2.4/site-packages/MoinMoin/parser/text_rst.py in format (self=<MoinMoin.parser.text_rst.Parser instance>, formatter=<MoinMoin.formatter.text_html.Formatter instance>)

    1. 193 'raw_enabled': 0,
    2. 194 'stylesheet_path': '',
    3. 195 'template': '',
    4. 196 }
    5. 197 )
  12. /usr/lib/python2.7/dist-packages/docutils/core.py in publish_parts (source=u'This is a *very* simple example. If you see two ...-like format, but like a normal part of the page.', source_path=None, source_class=<class docutils.io.StringInput>, destination_path=None, reader=None, reader_name='standalone', parser=None, parser_name='restructuredtext', writer=<MoinMoin.parser.text_rst.MoinWriter instance>, writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides={'file_insertion_enabled': 0, 'halt_level': 5, 'raw_enabled': 0, 'stylesheet_path': '', 'template': '', 'traceback': True}, config_section=None, enable_exit_status=False)

    1. 448 settings_overrides=settings_overrides,
    2. 449 config_section=config_section,
    3. 450 enable_exit_status=enable_exit_status)
    4. 451 return pub.writer.parts
    5. 452
    • enable_exit_status = False
  13. /usr/lib/python2.7/dist-packages/docutils/core.py in publish_programmatically (source_class=<class docutils.io.StringInput>, source=u'This is a *very* simple example. If you see two ...-like format, but like a normal part of the page.', source_path=None, destination_class=<class docutils.io.StringOutput>, destination=None, destination_path=None, reader=None, reader_name='standalone', parser=None, parser_name='restructuredtext', writer=<MoinMoin.parser.text_rst.MoinWriter instance>, writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides={'file_insertion_enabled': 0, 'halt_level': 5, 'raw_enabled': 0, 'stylesheet_path': '', 'template': '', 'traceback': True}, config_section=None, enable_exit_status=False)

    1. 657 source_class=source_class,
    2. 658 destination_class=destination_class)
    3. 659 pub.set_components(reader_name, parser_name, writer_name)
    4. 660 pub.process_programmatic_settings(
    5. 661 settings_spec, settings_overrides, config_section)
    • pub = <docutils.core.Publisher instance>
    • pub.set_components = <bound method Publisher.set_components of <docutils.core.Publisher instance>>
    • reader_name = 'standalone'
    • parser_name = 'restructuredtext'
    • writer_name = 'pseudoxml'
  14. /usr/lib/python2.7/dist-packages/docutils/core.py in set_components (self=<docutils.core.Publisher instance>, reader_name='standalone', parser_name='restructuredtext', writer_name='pseudoxml')

    1. 91 def set_components(self, reader_name, parser_name, writer_name):
    2. 92 if self.reader is None:
    3. 93 self.set_reader(reader_name, self.parser, parser_name)
    4. 94 if self.parser is None:
    5. 95 if self.reader.parser is None:
    • self = <docutils.core.Publisher instance>
    • self.set_reader = <bound method Publisher.set_reader of <docutils.core.Publisher instance>>
    • reader_name = 'standalone'
    • self.parser = None
    • parser_name = 'restructuredtext'
  15. /usr/lib/python2.7/dist-packages/docutils/core.py in set_reader (self=<docutils.core.Publisher instance>, reader_name='standalone', parser=None, parser_name='restructuredtext')

    1. 80 def set_reader(self, reader_name, parser, parser_name):
    2. 81 """Set `self.reader` by name."""
    3. 82 reader_class = readers.get_reader_class(reader_name)
    4. 83 self.reader = reader_class(parser, parser_name)
    5. 84 self.parser = self.reader.parser
    • reader_class undefined
    • global readers = <module 'docutils.readers' from '/usr/lib/python2.7/dist-packages/docutils/readers/__init__.pyc'>
    • readers.get_reader_class = <function get_reader_class>
    • reader_name = 'standalone'
  16. /usr/lib/python2.7/dist-packages/docutils/readers/__init__.py in get_reader_class (reader_name='standalone')

    1. 108 reader_name = _reader_aliases[reader_name]
    2. 109 try:
    3. 110 module = __import__(reader_name, globals(), locals(), level=1)
    4. 111 except ImportError:
    5. 112 module = __import__(reader_name, globals(), locals(), level=0)
    • module undefined
    • global __import__ = <function safe_import>
    • reader_name = 'standalone'
    • builtin globals = <built-in function globals>
    • builtin locals = <built-in function locals>
    • level undefined

TypeError

safe_import() got an unexpected keyword argument 'level'

  • args = ("safe_import() got an unexpected keyword argument 'level'",)
  • message = "safe_import() got an unexpected keyword argument 'level'"

System Details

  • Date: Sun, 19 May 2024 15:23:37 +0000
  • Platform: Linux euler 4.19.0-26-686-pae #1 SMP Debian 4.19.304-1 (2024-01-09) i686
  • Python: Python 2.7.16 (/usr/bin/python)
  • MoinMoin: Release 1.6.2 (release)