Item11556: $n newline format token doesn't seem to be expanded consistently in SEARCH formats
| Priority: |
CurrentState: |
AppliesTo: |
Component: |
WaitingFor: |
| Low |
New |
Engine |
|
|
The docco says Use $n() if followed by alphanumeric character.
$n$formfield(Summary)$n=
is detectable, given that the following char is not alphanumeric, its a
$.
Similarly,
$n$n$n$web is rendered as
\n\n$nBlog for some inane reason.
Mind you, It can't be that hard to detect that there's an unexpanded $ in there and work backwards until we get it.
%STARTSECTION{"query"}%
%SEARCH{
web="Blog"
type="query"
"form.name ~ 'BlogPostForm'"
date="P1w/$today"
excludetopic="*Template"
order="formfield(PublishingDate)"
reverse="on"
NNnonoise="on"
format="---+++ [[$web.$topic][$formfield(Title)]] $nby $formfield(Author) $n$formfield(Summary)$n $n$n$n$web"
}%
%ENDSECTION{"query"}%
renders as
Number of topics: 0
I
think the right approach is to either make the detection cleverer, by sorting the list of tokens by length, then replacing the longest first, matching greedily, but that has a small chance of tripping up someone that relies on the quirk produced by the code we have.
To work out if that is a reasonable worry, it'll be worth testing on a number of older releases - as we re-jiggered how the processing was done a few times, which may have resulted in different corner cases.
if that approach does not fly, then we should start by replacing all
$n tokens that are not followed by and alphanum with
$n(). that way at least the
$n$ cases will not be broken.
--
SvenDowideit - 24 Feb 2012