[docutils:patches] #214 Give better messages on malformed tables
Günter Milde via Docutils-develop <[email protected]> Thu, 31 Jul 2025 13:06:23 -0000
| Newsgroups | gmane.text.docutils.devel |
|---|---|
| Message-ID | </p/docutils/patches/214/9210754aed300e1f39ec6b1c5462e1cdc6eb61e4.patches@docutils.p.sourceforge.net> |
This is a multi-part message in MIME format.
--===============4519249137675977420==
Content-Type: multipart/related; boundary="===============8397751161158978084=="
This is a multi-part message in MIME format.
--===============8397751161158978084==
Content-Type: multipart/alternative; boundary="===============4968811469404958502=="
MIME-Version: 1.0
--===============4968811469404958502==
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
I looked at the patch and found a number of issues:
* Message "details" misleading if the right border is not misaligned but missing.
* system exit with corrupt bottom border:
The compulsory "details" and "offset" arguments for `malformed_table()` lead to a system exit with traceback - for document authors this is worse than a generic error message. It is also an incompatible change in the Docutils library (some 3rd party extension may use the function...).
+-----------------------+
| A table with one cell |
| & corrupt bottom. |
+---------------------- +
* Indicated line for simple table with non-matching bottom border is wrong, if the table does not start on line 1 of the document!
* If there is no bottom border for a simple table, the complete remaining document may be scanned. Therefore it is both, simpler and more helpful to indicate the start line of a simple table with missing bottom border.
* The error "No bottom table border found or no blank line after table bottom." is raised because the markup is ambiguous:
============== ======
content or header
============== ======
this could be cell content
or text after the table
* According to the coding policy, lines should be < 80 characters.
The attached patch adresses these points and solves some more issues with the original code.
Attachments:
- [table-errors2.diff](https://sourceforge.net/p/docutils/patches/_discuss/thread/ecf1ca00d3/f025/attachment/table-errors2.diff) (7.6 kB; text/x-patch)
---
**[patches:#214] Give better messages on malformed tables**
**Status:** open
**Group:** None
**Created:** Sun Jun 08, 2025 05:58 PM UTC by Jynn Nelson
**Last Updated:** Sun Jul 20, 2025 09:57 PM UTC
**Owner:** nobody
**Attachments:**
- [tables.diff](https://sourceforge.net/p/docutils/patches/214/attachment/tables.diff) (5.2 kB; application/octet-stream)
This does several things:
- Specifies `Misaligned right border` for that error, instead of just "malformed table".
- Shows the line where each error happened, not the line where the table starts.
- This had a complication that line numbers appear to be wrong when `include` directives are present (they include the lines in the source document, instead of being relative to the included document). Just disabled the new smarter logic in that case.
- Changes `malformed_table` to require both detail and an offset, so poor errors like this can't happen in the future.
Fixes https://sourceforge.net/p/docutils/bugs/504/.
---
Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/docutils/patches/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/patches/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
--===============4968811469404958502==
MIME-Version: 1.0
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: 7bit
<div class="markdown_content"><p>I looked at the patch and found a number of issues:</p>
<ul>
<li>
<p>Message "details" misleading if the right border is not misaligned but missing.</p>
</li>
<li>
<p>system exit with corrupt bottom border:<br/>
The compulsory "details" and "offset" arguments for <code>malformed_table()</code> lead to a system exit with traceback - for document authors this is worse than a generic error message. It is also an incompatible change in the Docutils library (some 3rd party extension may use the function...).</p>
<p>+-----------------------+<br/>
| A table with one cell |<br/>
| & corrupt bottom. |<br/>
+---------------------- +</p>
</li>
<li>
<p>Indicated line for simple table with non-matching bottom border is wrong, if the table does not start on line 1 of the document!</p>
</li>
<li>
<p>If there is no bottom border for a simple table, the complete remaining document may be scanned. Therefore it is both, simpler and more helpful to indicate the start line of a simple table with missing bottom border.</p>
</li>
<li>
<p>The error "No bottom table border found or no blank line after table bottom." is raised because the markup is ambiguous:</p>
<div class="codehilite"><pre><span></span><code>============== ======
content or header
============== ======
this could be cell content
or text after the table
</code></pre></div>
</li>
<li>
<p>According to the coding policy, lines should be < 80 characters.</p>
</li>
</ul>
<p>The attached patch adresses these points and solves some more issues with the original code.</p>
<p>Attachments:</p>
<ul>
<li><a class="" href="https://sourceforge.net/p/docutils/patches/_discuss/thread/ecf1ca00d3/f025/attachment/table-errors2.diff">table-errors2.diff</a> (7.6 kB; text/x-patch)</li>
</ul>
<hr/>
<p><strong><a class="alink" href="https://sourceforge.net/p/docutils/patches/214/">[patches:#214]</a> Give better messages on malformed tables</strong></p>
<p><strong>Status:</strong> open<br/>
<strong>Group:</strong> None<br/>
<strong>Created:</strong> Sun Jun 08, 2025 05:58 PM UTC by Jynn Nelson<br/>
<strong>Last Updated:</strong> Sun Jul 20, 2025 09:57 PM UTC<br/>
<strong>Owner:</strong> nobody<br/>
<strong>Attachments:</strong></p>
<ul>
<li><a class="" href="https://sourceforge.net/p/docutils/patches/214/attachment/tables.diff">tables.diff</a> (5.2 kB; application/octet-stream)</li>
</ul>
<p>This does several things:<br/>
- Specifies <code>Misaligned right border</code> for that error, instead of just "malformed table".<br/>
- Shows the line where each error happened, not the line where the table starts.<br/>
- This had a complication that line numbers appear to be wrong when <code>include</code> directives are present (they include the lines in the source document, instead of being relative to the included document). Just disabled the new smarter logic in that case.<br/>
- Changes <code>malformed_table</code> to require both detail and an offset, so poor errors like this can't happen in the future.</p>
<p>Fixes <a href="https://sourceforge.net/p/docutils/bugs/504/.">https://sourceforge.net/p/docutils/bugs/504/.</a></p>
<hr/>
<p>Sent from sourceforge.net because [email protected] is subscribed to <a href="https://sourceforge.net/p/docutils/patches/">https://sourceforge.net/p/docutils/patches/</a></p>
<p>To unsubscribe from further messages, a project admin can change settings at <a href="https://sourceforge.net/p/docutils/admin/patches/options.">https://sourceforge.net/p/docutils/admin/patches/options.</a> Or, if this is a mailing list, you can unsubscribe from the mailing list.</p></div>
--===============4968811469404958502==--
--===============8397751161158978084==--
--===============4519249137675977420==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============4519249137675977420==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline