• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item5023: decodeFormatTokens does not handle $nSOME_STRING

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Normal No Action Required   n/a  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

TWiki::Func::decodeFormatTokens($text) calls expandStandardEscapes from TWiki.pm:
sub expandStandardEscapes {
    my $text = shift;
    $text =~ s/\$n\(\)/\n/gos;         # expand '$n()' to new line
    $text =~ s/\$n([^$regex{mixedAlpha}]|$)/\n$1/gos; # expand '$n' to new line
    $text =~ s/\$nop(\(\))?//gos;      # remove filler, useful for nested search
    $text =~ s/\$quot(\(\))?/\"/gos;   # expand double quote
    $text =~ s/\$percnt(\(\))?/\%/gos; # expand percent
    $text =~ s/\$dollar(\(\))?/\$/gos; # expand dollar
    return $text;
} 

This assumes that $n is always followed by a non-alpha char, or by nothing (end of string). It does not handle $nSOME_STRING.

The documentation says:

$n or $n()= New line. Use $n() if followed by alphanumeric character, e.g. write =Foo$n()Bar instead of Foo$nBar

If the expansion order is changed ($n at end), this special treatment is not necessary.

-- TWiki:Main.ArthurClemens - 24 Nov 2007

I suggest not to change this. This is spec and documented as such. If we change the spec we clobber the namespace for future enhancements.

-- TWiki:Main.PeterThoeny - 24 Nov 2007

We have been fighting with this order before. Please study old bug items related to this before changing anything.

It is per spec that $n is only working before non-alpha characters. And this is also the reason why we have the $n() which you can use in front of alpha characters. It all works per spec. The suggested change will for sure break things. Setting to no action.

-- TWiki:Main.KennethLavrsen - 25 Nov 2007

ItemTemplate
Summary decodeFormatTokens does not handle $nSOME_STRING
ReportedBy TWiki:Main.ArthurClemens
Codebase

SVN Range TWiki-4.3.0, Sat, 24 Nov 2007, build 15734
AppliesTo Engine
Component

Priority Normal
CurrentState No Action Required
WaitingFor

Checkins

TargetRelease n/a
ReleasedIn

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r3 - 2007-11-25 - KennethLavrsen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback