Menu

#435 invalid references in "problematic" nodes with report_level=4

closed-fixed
nobody
None
5
2022-07-06
2021-11-16
No

I don’t know if you will consider it a bug, but I decided to report it nevertheless.

When input reStructuredText has errors and you silence them with report_level=4, the following HTML will be generated:

>>> from docutils.core import publish_parts
>>> parts = publish_parts('`', settings_overrides={'report_level': 4}, writer_name='html5')
>>> print(parts['html_body'])
<main>
<p><a href="#system-message-1"><span class="problematic" id="problematic-1">`</span></a></p>
</main>

The link is pointing to #system-message-1, however there is no element with id="system-message-id" because the warning itself was not generated.

Discussion

  • Dmitry Shachnev

    Dmitry Shachnev - 2021-11-16

    Sorry, I meant “there is no element with id="system-message-1"” of course.

     
  • Günter Milde

    Günter Milde - 2021-11-17

    Thank you for the report.
    This is a bug. It occurs also with the html4css and latex writers.
    OTOH, it is not that urgent, as it only happens in documents where there are problems/errors anyway.

     
  • Günter Milde

    Günter Milde - 2021-12-04
    • summary: HTML writer generates invalid references with report_level=4 --> invalid references in "problematic" nodes with report_level=4

    The problem is already in the document tree: with report_level: 4 the FilterMessages transform removes SystemMessages but leaves "problematic" nodes untouched.

     

    Last edit: Günter Milde 2022-01-10
  • Günter Milde

    Günter Milde - 2021-12-04

    We need to define the intended behaviour for error messages generated during the parsing of inline elements:
    a) silently drop the faulty inline element,
    b) insert rawsource
    c) insert "problematic" node but don't link
    d) Insert invalid inline markup as Text.
    The attached patch implements alternative d). "Accidential" inline markup characters in the document are kept as text if errors are silenced with --quiet.

     

    Last edit: Günter Milde 2022-01-10
  • Günter Milde

    Günter Milde - 2022-02-04
    • status: open --> open-fixed
     
  • Günter Milde

    Günter Milde - 2022-02-04

    The patch was implemented in [r8997].
    With report_level== 4, inline markup that leads to an error is ignored and the raw source is inserted into the document as Text node.
    Thank you for the report

     

    Related

    Commit: [r8997]

  • Günter Milde

    Günter Milde - 2022-07-06
    • status: open-fixed --> closed-fixed
     
  • Günter Milde

    Günter Milde - 2022-07-06

    Fixed in release 0.19.
    Thank you for the report.

     

Log in to post a comment.