Skip to content

Some reStructuredText (rST) links broken in moin2. #1680

@gmilde

Description

@gmilde

It seems like "simple" links to different Wiki pages fail in text parts written in rST:

Working examples: links with targed specified in rST
(cf. https://moin-20.readthedocs.io/en/latest/user/rest.html#hyperlinks).

Links that work
=============

This is a `hyperlink with included target <WikiLink>`_.

This is a `hyperlink to an explicit target`_.

.. _hyperlink to an explicit target: WikiLink

This is an `anonymous hyperlink to an explicit target`_.

__ WikiLink

This is a link to an implicit target: `links that work`_.

All these links work in standard rST

Now the failing example: A link to a different WikiPage without explicit or embedded target.
This works in the "old" MoinMoin but fails in Moin2:

Here is a link to a MoinMoin page named SecondPage_.

Details:

The reference would typically cause an unknown target error from the docutils parser. This is because there isn't a target in the document named "SecondPage". However, with the MoinMoin parser, the "SecondPage_" reference instead creates a link to a MoinMoin page named "SecondPage".
https://moinmo.in/HelpOnParsers/ReStructuredText section "Unknown Targets"

It seems that a part of the underlying code was transferred to moin2: see the visit_reference() function

However, this code is never reached, as Docutils checks for references without targets earlier (in a "transform") and creates a "system message" describing the problem (With Docutils and Sphinx, the system message is inserted into the output, in moin2 it seems to be shown in the log only.)

If continued support for simple WikiLinks_ is planned, moin2 would need to

  • define a "resolver" function and register it in the "unknown_references_resolvers" hook,
  • adapt the abovelinked visit_reference() function to the upcoming changes in Docutils DTD.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions