How to place bulleted lists within simple tables in restructured text?
Asked Answered
D

2

5

I am trying to place a bulleted list in my reST simple table, but each line of the bulleted list gets its own row:

======================  =======================  =======================
|foo.png|               |bar.png|                |baz.png|
======================  =======================  =======================
* foo1 - Lorem ipsum    * bar                    * baz 
  dolor sit amet, 
  consectetur 
* foo2 - adipisicing 
  elit
======================  =======================  =======================

.. |foo.png| image:: assets/img/foo.png
.. |bar.png| image:: assets/img/bar.png
.. |baz.png| image:: assets/img/baz.png

The result is that each of the lines * foo1 - Lorem ipsum, dolor sit amet,, consectetur, * foo2 - adipisicing and elit are placed into separate table rows.

The desired result is that the bulleted list in the first column is contained in one table row item. Is there an easy way to get the result I am after?

Failing that, is there a way to embed an HTML table of my design in a reST document?

Another thing I have tried is a replacement:

======================  =======================  =======================
|foo.png|               |bar.png|                |baz.png|
======================  =======================  =======================
|foo_list|              |bar_list|               |baz_list|
======================  =======================  =======================

.. |foo.png| image:: assets/img/foo.png
.. |bar.png| image:: assets/img/bar.png
.. |baz.png| image:: assets/img/baz.png

.. |foo_list| replace::
   * foo1 - Lorem ipsum dolor sit amet, consectetur
   * foo2 - adipisicing elit
.. |bar_list| replace::
   * bar
.. |baz_list| replace::
   * baz

This did not work at all, showing the text |foo_list| in the first, top-left cell underneath the |foo.png| image.

Dalia answered 29/8, 2013 at 22:56 Comment(1)
Substitution replacements only work for inline elements.Ginny
A
6

Try the list-table directive:

.. list-table:: Example table
   :header-rows: 1

   * - First header
     - Second header
     - Third header
   * - Some text
     - Some text
     - A list:
         * foo
         * bar
         * baz
   * - Second row
     - More cells
     - etc.
   * - ...
     - ...
     - ...
Accompanist answered 30/8, 2013 at 0:16 Comment(0)
G
1

Simple tables are simple but limited:

Each line of text starts a new row, except when there is a blank cell in the first column. [...] this mechanism limits cells in the first column to only one line of text.

Use grid tables, list-tables, or csv-tables if this limitation is unacceptable.

Ginny answered 5/3 at 12:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.