summary refs log tree commit diff stats
path: root/doc/rst.txt
blob: 4199598d1be8607b3206863a3d9055d187ea33d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
===========================================================================
       Nimrod's implementation of |rst|
===========================================================================

:Author: Andreas Rumpf
:Version: |nimrodversion|

.. contents::

Introduction
============

This document describes the subset of `Docutils`_' `reStructuredText`_ as it
has been implemented in the Nimrod compiler for generating documentation.
Elements of |rst| that are not listed here have not been implemented.
Unfortunately, the specification of |rst| is quite vague, so Nimrod is not as
compatible to the original implementation as one would like.

Even though Nimrod's |rst| parser does not parse all constructs, it is pretty
usable. The missing features can easily be circumvented. An indication of this
fact is that Nimrod's *whole* documentation itself (including this document) is
processed by Nimrod's |rst| parser. (Which is an order of magnitude faster than
Docutils' parser.)


Inline elements
===============

Ordinary text may contain *inline elements*.


Bullet lists
============

*Bullet lists* look like this::

  * Item 1
  * Item 2 that
    spans over multiple lines
  * Item 3
  * Item 4
    - bullet lists may nest
    - item 3b
    - valid bullet characters are ``+``, ``*`` and ``-``

This results in:
* Item 1
* Item 2 that
  spans over multiple lines
* Item 3
* Item 4
  - bullet lists may nest
  - item 3b
  - valid bullet characters are ``+``, ``*`` and ``-``


Enumerated lists
================

*Enumerated lists*


Definition lists
================

Save this code to the file "greeting.nim". Now compile and run it:

  ``nimrod run greeting.nim``

As you see, with the ``run`` command Nimrod executes the file automatically
after compilation. You can even give your program command line arguments by
appending them after the filename that is to be compiled and run:

  ``nimrod run greeting.nim arg1 arg2``


Tables
======

Nimrod only implements simple tables of the form::

  ==================      ===============       ===================
  header 1                header 2              header n
  ==================      ===============       ===================
  Cell 1                  Cell 2                Cell 3
  Cell 4                  Cell 5; any           Cell 6
                          cell that is
                          not in column 1
                          may span over
                          multiple lines
  Cell 7                  Cell 8                Cell 9
  ==================      ===============       ===================

This results in:
==================      ===============       ===================
header 1                header 2              header n
==================      ===============       ===================
Cell 1                  Cell 2                Cell 3
Cell 4                  Cell 5; any           Cell 6
                        cell that is
                        not in column 1
                        may span over
                        multiple lines
Cell 7                  Cell 8                Cell 9
==================      ===============       ===================


.. |rst| replace:: reStructuredText
.. _reStructuredText: http://docutils.sourceforge.net/rst.html#reference-documentation
.. _docutils: http://docutils.sourceforge.net/