cross is now running Foswiki 2.1.3 Beta 1. Please open a task for any issues.

Item2367: In a forced wiki link, if a url occurs within the "text" part, illegal html is generated

Priority: Normal
Current State: Closed
Released In: 1.1.0
Target Release: minor
Applies To: Engine
Component: Renderer
Reported By: PatrickGosling
Waiting For:
Last Change By: KennethLavrsen
If I force a wiki link using the
syntax, and there is a url in the second part, the generated html is illegal (and quite odd).

For instance, if I say

[[][Link to]]

then the generated html will be (modulo some newlines for clarity ...)

<a href="" target="_top">
Link to <a href="</a>" target="_top">]]</a>

Although I've given a rather un-wiki-ish example here, I don't think that it's in general inappropriate to include urls in the text part of a forced link.

Now this failure can be avoided by explicitly suppressing linking on the url as follows:

[[][Link to !]]

but I would argue that the need to do so is counter-intuitive, and that it is in any event wrong to produce illegal html sequences in such a situation.
Link to

It appears that the problem is that http: links are rendered before bracketed links are processed. So by the time the bracketed link is being rendered, the http:// link has already been rendered. Adding an escape to the bracketed link handling is too late. I've created a unit test and can fix the issue by deferring http:// link processing until after the bracketed links are processed, and adding code to escape link strings from the link text similar to the WikiWord escapes. But I'm concerned that changing the rendering order could have other significant side effects.

-- GeorgeClark - 23 Jun 2010

I agree. I moved the order round so that the external link was rendered after the squabbed link, which works for this example but may have undesirable effects elsewhere - not sure how we can tell.

-- CrawfordCurrie - 23 Jun 2010

Unit tests all seem fine, and I played around with it quite a bit - I can't see any reason not to go ahead with this change. Apologies that it's tangled up with another checkin that I had pending simultaneously frown, sad smile

-- CrawfordCurrie - 23 Jun 2010

ItemTemplate edit

Summary In a forced wiki link, if a url occurs within the "text" part, illegal html is generated
ReportedBy PatrickGosling
Codebase 1.0.7
SVN Range Foswiki-1.0.7, Sun, 20 Sep 2009, build 5061
AppliesTo Engine
Component Renderer
Priority Normal
CurrentState Closed
Checkins distro:c7c1f281eaca
TargetRelease minor
ReleasedIn 1.1.0
Topic revision: r8 - 04 Oct 2010, KennethLavrsen - This page was cached on 21 Jan 2017 - 16:20.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License