Ticket #832 (new defect)

Opened 14 years ago

Last modified 14 years ago

Rendering is broken when external links contains wiki names

Reported by: laurent.pelecq@… Owned by: tziade
Priority: P1 Milestone: CPS 3.5.7
Component: CPSWiki Version: TRUNK
Severity: normal Keywords:
Cc:

Description

Consider the following code:

A link_

.. _link: /folder/MyPage.html

It breaks the page HTML code because wiki links are expanded after the ReStructuredText parser has generated the HTML code. Word MyPage is assumed to be a wiki name.

There is at least two solutions:

Generate wiki links earlier

Wiki names could be expanded before the HTML code is generated. The text should be parsed line by line to exclude lines beginning with the ReStructuredText marker for external links (..). Wiki links would be replaced by a ReStructuredText external link such as:

A WikiName_ here.

.. _WikiName: WikiName

The ReStructuredText parser would generate the right HTML references to Wiki pages.

Normally wiki names inside external link names should not be replaced either. That requires a smarter parser. For example, in the following code, an extra question mark is appended to the link because ReStructuredText is considered as a wiki name although it shouldn't be.

A `link to ReStructuredText`_

.. _link to ReStructuredText: rst.html

However there is a workaround in this case:

A `link to !ReStructuredText`_

.. _link to !ReStructuredText: rst.html

Use a HTML parser

If the HTML code is generated first as today, wiki names should be expanded with a HTML parser such as the standard parser in python. Attributes and text inside tag <a> would not be considered for wiki link replacement.

This solution is a little bit more complicated but it ensures that the HTML code is always valid.

Change History

comment:1 Changed 14 years ago by fguillaume

  • Milestone changed from unspecified to CPS 3.5.0
Note: See TracTickets for help on using tickets.