Skip to content

Commit f19bb0e

Browse files
committed
Add a writers guide document
Start a simple writers guide for conventions used in this project. For now it only talks about how tables should be marked up, but it will be expanded on later. Signed-off-by: Grant Likely <[email protected]>
1 parent 2781a51 commit f19bb0e

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

writers-guide.rst

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
This document uses the Sphinx implementation of reStructured Text (RST). RST is
2+
a flexible markup language with lots of options for laying out text. To keep
3+
thinks simple, this file describes the conventions used by this project. As
4+
much as possible, use these methods for markup.
5+
6+
Tables
7+
======
8+
Use the simplified markup for tables as shown below. Use the tabularcolumns
9+
directive for controlling how tables are layed out in pdf output. For
10+
consistency, tables in this document shoud be specified without internal
11+
vertical columns separators are preferred. (ie. Only use the | specifier on the
12+
outsides of the table, such as with ``.. tabularcolumns:: | l l J|`` instead of
13+
``.. tabularcolumns:: | l | l | J |``. Column specifiers will be one of the
14+
following.
15+
16+
When possible, use only ``l,c,r,L,R,C,J`` specifiers and the renderer will
17+
automatically figure out the columns widths. However, if a table is longer than
18+
a page, or has complex content, then you must manually specify each column
19+
width with the ``p{width}`` specifier. Long tables must also include the
20+
``:class: longtable`` directive as shown below.
21+
22+
=========== ======================================
23+
Specifier Behaviour
24+
=========== ======================================
25+
l minimum width left-justified column
26+
c minimum width centered column
27+
r minimum width right-justified column
28+
p{'width'} paragraph column with text vertically aligned at the top
29+
L flush left column with automatic width
30+
R flush right column with automatic width
31+
C centered column with automatic width
32+
J justified column with automatic width
33+
\| Vertical line
34+
|| Double vertical line
35+
=========== ======================================
36+
37+
Use ``:numref:`` to reference a table from the document text. For example:
38+
``:numref:`table_example_simple```
39+
40+
.. tabluarcolumns:: l l J
41+
.. _table_example_simple:
42+
.. table:: Example of simple table
43+
44+
========== =============== ==========
45+
Heading 1 Heading 2 Heading 3
46+
========== =============== ==========
47+
row 1 two row cell 3
48+
entry
49+
row 2 data more
50+
========== =============== ==========
51+
52+
.. tabluarcolumns:: | p{3cm} p{1cm} p{10cm} |
53+
.. _table_example_columns:
54+
.. table:: Example of table needing explicit formatting
55+
56+
========== =============== ==========
57+
Heading 1 Heading 2 Heading 3
58+
========== =============== ==========
59+
row 1 two row cell 3
60+
entry
61+
row 2 data more
62+
63+
:: * embedded
64+
* list
65+
code * of
66+
block * items
67+
========== =============== ==========
68+
69+
.. tabluarcolumns:: | p{3cm} p{1cm} p{10cm} |
70+
.. _table_example_simple:
71+
.. table:: Example of table that spans multiple pages
72+
:class: longtable
73+
74+
========== =============== ==========
75+
Heading 1 Heading 2 Heading 3
76+
========== =============== ==========
77+
row 1 two row cell 3
78+
entry
79+
row 2 data more
80+
========== =============== ==========

0 commit comments

Comments
 (0)