Skip to content

Conversation

@gmilde
Copy link
Contributor

@gmilde gmilde commented Nov 4, 2025

Next set of fixes for the reStructuredText import.

  • Support custom "interpreted text roles"
    Pass on CSS class arguments from <inline> elements to support "custom interpreted text roles"
    (https://docutils.sourceforge.io/docs/ref/rst/directives.html#role)
    Add special handling for "del" and "ins" roles, so that they will become <del> and <ins> in HTML.

  • Support a custom start value for ordered lists.

  • Run "transform" to filter INFO-level messages.
    (Unless the "report-level" configuration setting is changed to keep them.)

  • More informative system messages: include severity level, line of occurence and (if applicable) a back-link to the problematic text when reporting a parser issue.

Documentation will follow once the current doc PR is handled.

Pass on CSS class arguments from `<inline>` elements to support
"custom interpreted text roles"
(https://docutils.sourceforge.io/docs/ref/rst/directives.html#role)

Add special handling for "del" and "ins" roles, so that they will become
`<del>` and `<ins>` in HTML.
Both, rST and Moin support ordered lists starting with a value other than one.

Docutils also generates an INFO level system message that is usually not shown.
This may have led to the missing conversion of the start value.

Correct handling of system messages will be added in the next steps.
Docutils system messages
(https://docutils.sourceforge.io/docs/ref/doctree.html#system-message)
contain useful information that is currently ignored:

* type/level (DEBUG, INFO, WARNING, ERROR, SEVERE)
* source description, line number of the issue

Show this info in the inserted "admonition".

Use a "caution" instad of an "error admonition" for merely informative messages.
The rst_in converter is a Docutils "writer" component (exporting a "doctree" to
some other format) but does not inherit `docutils.writers.Writer`.
Therefore, we add the "transfroms" that are usually loaded by the Writer class to
the transforms added by Moin (in the parser component).

https://docutils.sourceforge.io/docs/api/transforms.html#transforms-added-by-components
To report issues in inline content, Docutils uses a combination of a
`<problematic>` element and a `<system_message>`.
https://docutils.sourceforge.io/docs/ref/doctree.html#problematic

Make "problematic" content stay out by a red background and
turn it into a link to the related "system message" (if there is one).

Add a backlink from the "system message" to the "problematic" element
at the place of origin.
@gmilde gmilde changed the title rST in: support "ins", "del" and custom "text roles". Next set of fixes for the reStructuredText import. Nov 6, 2025
@RogerHaase RogerHaase merged commit 1957426 into moinwiki:master Nov 7, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants