Menu

#311 Strange grid table bug.

closed-invalid
None
1
2020-03-03
2017-02-12
No

I have encountered a very strange bug with the following table:

+----------------+-----------+---------------+-------------+----------+-----------+------------+------------+----------+--------------+-----------+-----------+-------------+-----------+-------------------+--------------+
| |undevastated, | |xylomas  | |reformistic  | |estraying, | |requiem | |drawbars | |Norroway, | |sportier, | |goss    | |tressel,    | |skeed    | |bestrewn | |preterient | |Raia     | |../images/o.gif| | |ptyalolith| |
| radiancies|    | features| | chlamyses,    | racers|     | nemesia| | freeward| | encyc|     | unshent,   | unsalt,  | aigialosaur| | crocheter | morosity  | casini|     | ascribed| |                   |              |
|                |           | Epiph         |             |          |           |            | Exon,      | drammock |              | fire      | tenure|   |             |           |                   |              |
|                |           | machetes,     |             |          |           |            | scyphulus| | Mutus|   |              | and       |           |             |           |                   |              |
|                |           | hypnotoxin    |             |          |           |            |            |          |              | flapper|  |           |             |           |                   |              |
|                |           | all-disposing |             |          |           |            |            |          |              |           |           |             |           |                   |              |
|                |           | jameson|      |             |          |           |            |            |          |              |           |           |             |           |                   |              |
+----------------+-----------+---------------+-------------+----------+-----------+------------+------------+----------+--------------+-----------+-----------+-------------+-----------+-------------------+--------------+
| +------------------+------------------+------------------+------------------+------------------+------------------+------------------+------------------+------------------+----------------------+------------------+   |
| | |stegodont       | |Barram          | |confabulator    | |espagnole,      | |baronet         | |Wauconda        | |flavourfully    | |Foism to, Sulu| | |milchy          | |../images/zabc.gif| | |Pothos          |   |
| | distent, Livian| | transcriptase|   | unafeared,       | multibirth|      | unempanelled|    | verbalized|      | salpiglossis|    |                  | penlights|       |                      | Grosmark|        |   |
| |                  |                  | cotch|           |                  |                  |                  |                  |                  |                  |                      |                  |   |
| +------------------+------------------+------------------+------------------+------------------+------------------+------------------+------------------+------------------+----------------------+------------------+   |
+----------------+-----------+---------------+-------------+----------+-----------+------------+------------+----------+--------------+-----------+-----------+-------------+-----------+-------------------+--------------+

.. |undevastated, radiancies| image:: a.gif
   :alt: undevastated, radiancies
.. |xylomas features| image:: b.gif
   :alt: xylomas features
.. |reformistic chlamyses, Epiph machetes, hypnotoxin all-disposing jameson| image:: c.gif
   :alt: reformistic chlamyses, Epiph machetes, hypnotoxin all-disposing jameson
.. |estraying, racers| image:: d.gif
   :alt: estraying, racers
.. |requiem nemesia| image:: e.gif
   :alt: requiem nemesia
.. |drawbars freeward| image:: f.gif
   :alt: drawbars freeward
.. |Norroway, encyc| image:: g.gif
   :alt: Norroway, encyc
.. |sportier, unshent, Exon, scyphulus| image:: h.gif
   :alt: sportier, unshent, Exon, scyphulus
.. |goss unsalt, drammock Mutus| image:: i.gif
   :alt: goss unsalt, drammock Mutus
.. |tressel, aigialosaur| image:: j.gif
   :alt: tressel, aigialosaur
.. |skeed crocheter fire and flapper| image:: k.gif
   :alt: skeed crocheter fire and flapper
.. |bestrewn morosity tenure| image:: l.gif
   :alt: bestrewn morosity tenure
.. |preterient casini| image:: m.gif
   :alt: preterient casini
.. |Raia ascribed| image:: n.gif
   :alt: Raia ascribed
.. |../images/o.gif| image:: ../images/o.gif
.. |ptyalolith| image:: p.gif
   :alt: ptyalolith
.. |stegodont distent, Livian| image:: q.gif
   :alt: stegodont distent, Livian
.. |Barram transcriptase| image:: r.gif
   :alt: Barram transcriptase
.. |confabulator unafeared, cotch| image:: s.gif
   :alt: confabulator unafeared, cotch
.. |espagnole, multibirth| image:: t.gif
   :alt: espagnole, multibirth
.. |baronet unempanelled| image:: u.gif
   :alt: baronet unempanelled
.. |Wauconda verbalized| image:: v.gif
   :alt: Wauconda verbalized
.. |flavourfully salpiglossis| image:: w.gif
   :alt: flavourfully salpiglossis
.. |Foism to, Sulu| image:: x.gif
   :alt: Foism to, Sulu
.. |milchy penlights| image:: y.gif
   :alt: milchy penlights
.. |../images/zabc.gif| image:: ../images/zabc.gif
.. |Pothos Grosmark| image:: d.gif
   :alt: Pothos Grosmark

It consists of random words as substitution text for a set of images, with heavy word wrapping, and two nested grid tables. I cannot for the life of me work out why this table cannot be processed by docutils. Considering the responses to past bug reports, I've placed this at the absolute lowest priority.

Discussion

  • Edward d'Auvergne

    With both 0.12 and 0.13.2a versions, I see:

    $ rst2xml.py table_test.rst > /dev/null 
    table_test.rst:13: (ERROR/3) Unexpected indentation.
    table_test.rst:15: (WARNING/2) Definition list ends without a blank line; unexpected unindent.
    table_test.rst:10: (ERROR/3) Undefined substitution referenced: "stegodont | |Barram | |confabulator | distent, Livian".
    table_test.rst:11: (ERROR/3) Undefined substitution referenced: "espagnole, | |baronet | |Wauconda | |flavourfully | |Foism to, Sulu".
    table_test.rst:11: (ERROR/3) Undefined substitution referenced: "milchy | |../images/zabc.gif".
    table_test.rst:11: (ERROR/3) Undefined substitution referenced: "Pothos | multibirth".
    
     
  • Edward d'Auvergne

    Note that with slight modification, the table can be processed:

    +-----------------+-----------+---------------+-------------+----------+-----------+------------+------------+----------+--------------+-----------+-----------+-------------+-----------+-------------------+--------------+
    | |undevastated,  | |xylomas  | |reformistic  | |estraying, | |requiem | |drawbars | |Norroway, | |sportier, | |goss    | |tressel,    | |skeed    | |bestrewn | |preterient | |Raia     | |../images/o.gif| | |ptyalolith| |
    | radiancies|     | features| | chlamyses,    | racers|     | nemesia| | freeward| | encyc|     | unshent,   | unsalt,  | aigialosaur| | crocheter | morosity  | casini|     | ascribed| |                   |              |
    |                 |           | Epiph         |             |          |           |            | Exon,      | drammock |              | fire      | tenure|   |             |           |                   |              |
    |                 |           | machetes,     |             |          |           |            | scyphulus| | Mutus|   |              | and       |           |             |           |                   |              |
    |                 |           | hypnotoxin    |             |          |           |            |            |          |              | flapper|  |           |             |           |                   |              |
    |                 |           | all-disposing |             |          |           |            |            |          |              |           |           |             |           |                   |              |
    |                 |           | jameson|      |             |          |           |            |            |          |              |           |           |             |           |                   |              |
    +-----------------+-----------+---------------+-------------+----------+-----------+------------+------------+----------+--------------+-----------+-----------+-------------+-----------+-------------------+--------------+
    | +--------------------+--------------------+--------------------+--------------------+--------------------+--------------------+--------------------+-------------+--------------------+----------------------+----------+ |
    | | |stegodont         | |Barram            | |confabulator      | |espagnole,        | |baronet           | |Wauconda          | |flavourfully      | |Foism to,| | |milchy penlights| | |../images/zabc.gif| | |Pothos| | |
    | | distent, Livian|   | transcriptase|     | unafeared, cotch|  | multibirth|        | unempanelled|      | verbalized|        | salpiglossis|      |             |                    |                      |          | |
    | +--------------------+--------------------+--------------------+--------------------+--------------------+--------------------+--------------------+-------------+--------------------+----------------------+----------+ |
    +-----------------+-----------+---------------+-------------+----------+-----------+------------+------------+----------+--------------+-----------+-----------+-------------+-----------+-------------------+--------------+
    
    .. |undevastated, radiancies| image:: a.gif
       :alt: undevastated, radiancies
    .. |xylomas features| image:: b.gif
       :alt: xylomas features
    .. |reformistic chlamyses, Epiph machetes, hypnotoxin all-disposing jameson| image:: c.gif
       :alt: reformistic chlamyses, Epiph machetes, hypnotoxin all-disposing jameson
    .. |estraying, racers| image:: d.gif
       :alt: estraying, racers
    .. |requiem nemesia| image:: e.gif
       :alt: requiem nemesia
    .. |drawbars freeward| image:: f.gif
       :alt: drawbars freeward
    .. |Norroway, encyc| image:: g.gif
       :alt: Norroway, encyc
    .. |sportier, unshent, Exon, scyphulus| image:: h.gif
       :alt: sportier, unshent, Exon, scyphulus
    .. |goss unsalt, drammock Mutus| image:: i.gif
       :alt: goss unsalt, drammock Mutus
    .. |tressel, aigialosaur| image:: j.gif
       :alt: tressel, aigialosaur
    .. |skeed crocheter fire and flapper| image:: k.gif
       :alt: skeed crocheter fire and flapper
    .. |bestrewn morosity tenure| image:: l.gif
       :alt: bestrewn morosity tenure
    .. |preterient casini| image:: m.gif
       :alt: preterient casini
    .. |Raia ascribed| image:: n.gif
       :alt: Raia ascribed
    .. |../images/o.gif| image:: ../images/o.gif
    .. |ptyalolith| image:: p.gif
       :alt: ptyalolith
    .. |stegodont distent, Livian| image:: q.gif
       :alt: stegodont distent, Livian
    .. |Barram transcriptase| image:: r.gif
       :alt: Barram transcriptase
    .. |confabulator unafeared, cotch| image:: s.gif
       :alt: confabulator unafeared, cotch
    .. |espagnole, multibirth| image:: t.gif
       :alt: espagnole, multibirth
    .. |baronet unempanelled| image:: u.gif
       :alt: baronet unempanelled
    .. |Wauconda verbalized| image:: v.gif
       :alt: Wauconda verbalized
    .. |flavourfully salpiglossis| image:: w.gif
       :alt: flavourfully salpiglossis
    .. |Foism to,| image:: x.gif
       :alt: Foism to,
    .. |milchy penlights| image:: y.gif
       :alt: milchy penlights
    .. |../images/zabc.gif| image:: ../images/zabc.gif
    .. |Pothos| image:: d.gif
       :alt: Pothos
    
     
  • David Goodger

    David Goodger - 2017-02-13

    Please attach your examples as text files. This site (and many others) often mangle indentation and whitespace, as you've already experienced.

     
    • Edward d'Auvergne

      I pre-checked this one, copying and pasting the preview. In this case, it seemed to work fine, and the visual representation makes the issue quite clear now.

       
  • David Goodger

    David Goodger - 2017-02-13

    If you look at the output (I use rst2pseudoxml.py, because the output is clean and easy to visually parse), you'll see that the first three columns of the nested table are separated from the rest. The nested table's third column right edge lines up with a column of the enclosing table there. The table parser is interpreting the stacked and aligned "+" characters as continuous column separators, splitting the enclosing table in two through the nested table. The table parser sees a row of zero height (no content).

    This is an example of "Some care must be taken with grid tables to avoid undesired
    interactions with cell text in rare cases." (from http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#grid-tables).

    The reST spec and code don't require grid table rows to have height ≥ 1, so a zero-height row is fine. The parser could be changed to not allow zero-height table rows, but I can imagine uses for zero-height rows. As this is another example of an extremely obscure corner case, I'm marking it as not a bug.

     
    • Edward d'Auvergne

      I understand the problem now. What about something explicit like this for the spec?

      Index: docutils/docs/ref/rst/restructuredtext.txt
      ===================================================================
      --- docutils/docs/ref/rst/restructuredtext.txt  (revision 8030)
      +++ docutils/docs/ref/rst/restructuredtext.txt  (working copy)
      @@ -1421,7 +1421,29 @@
           | row 3        |          |           |           |
           +--------------+----------+-----------+-----------+
      
      +This technique may also be required for nested tables::
      
      +    +----------------+--------------+----------------+
      +    | row 1, col 1   | row 1, col 2 | row 1, col 3   |
      +    +----------------+--------------+----------------+
      +    | +--------------+--------------+--------------+ |
      +    | | row 1, col 1 | row 1, col 2 | row 1, col 3 | |
      +    | +--------------+--------------+--------------+ |
      +    +----------------+--------------+----------------+
      +
      +Due to zero-height rows, the nested table will be split at the parent table
      +cell boundaries, but adding an extra line avoids the problem::
      +
      +    +----------------+--------------+----------------+
      +    | row 1, col 1   | row 1, col 2 | row 1, col 3   |
      +    +----------------+--------------+----------------+
      +    | +--------------+--------------+--------------+ |
      +    | | row 1, col 1 | row 1, col 2 | row 1, col 3 | |
      +    | +--------------+--------------+--------------+ |
      +    |                                                |
      +    +----------------+--------------+----------------+
      +
      +
       Simple Tables
       `````````````
      
       
  • David Goodger

    David Goodger - 2017-02-13
    • status: open --> closed-invalid
    • assigned_to: David Goodger
     

Log in to post a comment.