2.3. LinuxDoc

Documentation

https://return42.github.io/linuxdoc/

Git Repository

https://github.com/return42/linuxdoc

The LinuxDoc library with extensions of the Linux-Kernel documentation, you can use these extensions in common Sphinx projects. It consists:

2.3.1. Flat list table

.. flat-table::

The .. flat-table::` (FlatTable) is a double-stage list similar to the .. list-table::` with some additional features:

  • column-span: with the role :cspan:`num` a cell can be extended through additional columns

  • row-span: with the role :rspan:`num` a cell can be extended through additional rows

  • auto-span: rightmost cell of a table row over the missing cells on the right side of that table-row. With Option :fill-cells: this behavior can changed from auto span to auto fill, which automatically inserts (empty) cells instead of spanning the last cell.

Options
:header-rows: (integer)

count of header rows

:stub-columns: (integer)

count of stub columns

:widths: (list of integer)

widths of columns

:fill-cells:

instead of auto-span missing cells, insert missing cells

Roles
:cspan:

(integer): additional columns (morecols)

:rspan:

(integer): additional rows (morerows)

The example below shows how to use this markup. The first level of the staged list is the table-row. In the table-row there is only one markup allowed, the list of the cells in this table-row. Exception are comments ( .. ) and targets (e.g. a ref to row 2 of table’s body).

the example

Attention

line 2: The option :class: longtable will not interpreted from directive .. flat-table:: and has no effects.

 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
.. flat-table:: LinuxDoc :rst:`.. flat-table::` example (table title)
   :class: longtable
   :widths: 15 15 15 15 40
   :header-rows: 2
   :stub-columns: 1

   * - :rspan:`1` head / stub
     - :cspan:`3` head 1.1-4

   * - head 2.1
     - head 2.2
     - head 2.3
     - head 2.4

   * .. row body 1 / this is a comment

     - row 1
     - :rspan:`2` cell 1-3.1
     - cell 1.2
     - cell 1.3
     - cell 1.4

   * .. Comments and targets are allowed on *table-row* stage.
     .. _`row body 2`:

     - row 2
     - cell 2.2
     - :rspan:`1` :cspan:`1`
       cell 2.3 with a span over

       * col 3-4 &
       * row 2-3

   * - row 3
     - cell 3.2

   * - row 4
     - cell 4.1
     - cell 4.2
     - cell 4.3
     - cell 4.4

   * - row 5
     - cell 5.1 with automatic span to right end

   * - row 6
     - cell 6.1
     - .. empty cell 6.2 with automatic span to right end
which gives
Table 2.1 LinuxDoc .. flat-table:: example (table title)

head / stub

head 1.1-4

head 2.1

head 2.2

head 2.3

head 2.4

row 1

cell 1-3.1

cell 1.2

cell 1.3

cell 1.4

row 2

cell 2.2

cell 2.3 with a span over

  • col 3-4 &

  • row 2-3

row 3

cell 3.2

row 4

cell 4.1

cell 4.2

cell 4.3

cell 4.4

row 5

cell 5.1 with automatic span to right end

row 6

cell 6.1