| 1 |
============================== |
| 2 |
Documentation on documentation |
| 3 |
============================== |
| 4 |
|
| 5 |
Documentation is now written in ReStructuredText, a lightweight and |
| 6 |
readable markup language designed for Python. |
| 7 |
|
| 8 |
Conventions |
| 9 |
=========== |
| 10 |
|
| 11 |
ReStructuredText leaves much freedom in the syntax - in our help files we |
| 12 |
try to stick to consistent conventions as in the following. |
| 13 |
|
| 14 |
Markup for sectioning |
| 15 |
--------------------- |
| 16 |
|
| 17 |
:: |
| 18 |
|
| 19 |
============== |
| 20 |
Document title |
| 21 |
============== |
| 22 |
|
| 23 |
Section title |
| 24 |
============= |
| 25 |
|
| 26 |
Subsection title |
| 27 |
---------------- |
| 28 |
|
| 29 |
Sub-subsection title |
| 30 |
******************** |
| 31 |
|
| 32 |
Blank and spaces |
| 33 |
---------------- |
| 34 |
|
| 35 |
One blank line before and after every paragraph. |
| 36 |
Two-char indent in definition lists. |
| 37 |
|
| 38 |
Inline help parser syntax |
| 39 |
========================= |
| 40 |
|
| 41 |
As to the time when this documentation was last updated, the online help |
| 42 |
parser programmed into Angband does the following: |
| 43 |
|
| 44 |
- ignore colons (``|``) |
| 45 |
- ignore paragraphs starting with ``..`` (including their trailing blank |
| 46 |
line) |
| 47 |
- recognize link targets (``.. _something``) and be |
| 48 |
able to open a file to the right position using them. |
| 49 |
- recognize "menu" links for the online help navigation. Links are given |
| 50 |
with the following format (``g`` is the hotkey here): |
| 51 |
|
| 52 |
:: |
| 53 |
|
| 54 |
.. menu:: [g] option.txt |
| 55 |
|
| 56 |
Tricks |
| 57 |
====== |
| 58 |
|
| 59 |
Sometimes it is tricky to get a thing to display in the correct way in both |
| 60 |
the online help and the compiled RST. This is often due to the complex |
| 61 |
interaction between backslashes and backticks in RST. In particular, in |
| 62 |
several places we need to use in RST a syntax such as |
| 63 |
|
| 64 |
:: |
| 65 |
|
| 66 |
``D``\isarm |
| 67 |
|
| 68 |
If this appeared directly in the help file, then the online help parser |
| 69 |
would display a spurious backslash character ``\`` before the ``i`` letter. |
| 70 |
It would be quite complicated to instruct it to parse backslashes using the |
| 71 |
full RST syntax. Instead, we adopt the following workaround: we write |
| 72 |
|
| 73 |
:: |
| 74 |
|
| 75 |
this is a paragraph containing the word |``D``isarm| just in the middle |
| 76 |
|
| 77 |
and later in the file we define a substitution directive |
| 78 |
|
| 79 |
:: |
| 80 |
|
| 81 |
.. |``D``isarm| replace:: ``D``\isarm |
| 82 |
|
| 83 |
Magically this works, since the online help parser *skips* pipes. |