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