Item8694: [[*formatting*]] in links is a little broken

pencil
Priority: Normal
Current State: Closed
Released In: 1.1.0
Target Release: minor
Applies To: Engine
Component: Render.pm
Branches:
Reported By: PaulHarvey
Waiting For:
Last Change By: KennethLavrsen
Which is a shame, and bites users often.

You need to ensure there are no formatting symbols (*, =, _ etc) against either the beginning or ending brackets.

[[ *this* works ]]
this works
[[*this* doesn't]]
this doesn't

Work-around is obviously the space, but from the user's perspective, this experience just adds to Foswiki's quirkiness.

Is this a known limitation in the parser? Or should it be an easy fix?

-- PaulHarvey - 11 Mar 2010

 

I tried to fix this by adding new STARTEM/ENDEM regular expressions to match formatting inside of squabs, such as [*strong* link] or [link *strong*] however the unit test shows that it breaks one other condition - FormattingTests::test_squabbedEmmedTopic - which tests an italics link which ends in an underscore:
_text with [[H_]] link_
So I'm not sure this is a good fix to apply.

our $STARTWW = qr/^|(?<=[\s\(])/m;
our $ENDWW   = qr/$|(?=[\s,.;:!?)])/m;
our $STARTEM = qr/^|(?<=[\s\(])|(?<=\[\[)/m;
our $ENDEM   = qr/$|(?=[\s,.;:!?)])|(?=\][\]\[])/m;

used later as:
    $text =~ s/${STARTEM}==(\S+?|\S[^\n]*?\S)==$ENDEM/_fixedFontText($1,1)/gem;
...
    $text =~ s/${STARTEM}==(\S+?|\S[^\n]*?\S)==$ENDEM/$1/gem;

-- GeorgeClark - 18 Aug 2010

The actual fix was to add the rendering regex statements into the processing for the Link text. This way the link text is rendered for TML separately, and avoids the issue encountered above. Not committing to 1.0.10, this needs a more thorough test.

-- GeorgeClark - 19 Aug 2010

ItemTemplate edit

Summary [[*formatting*]] in links is a little broken
ReportedBy PaulHarvey
Codebase 1.0.9, trunk
SVN Range
AppliesTo Engine
Component Render.pm
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:46d0dd0e2bae
TargetRelease minor
ReleasedIn 1.1.0
Topic revision: r7 - 04 Oct 2010, KennethLavrsen
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy