You are here: Foswiki>Tasks Web>Item11556 (06 Jan 2015, GeorgeClark)Edit Attach

Item11556: $n newline format token doesn't seem to be expanded consistently in SEARCH formats

pencil
Priority: Low
Current State: Confirmed
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: SEARCH
Branches:
Reported By: SvenDowideit
Waiting For:
Last Change By: GeorgeClark
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

Searched: form.name ~ 'BlogPostForm'
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

 

ItemTemplate edit

Summary $dollarn newline format token doesn't seem to be expanded consistently in SEARCH formats
ReportedBy SvenDowideit
Codebase 1.1.4, trunk
SVN Range
AppliesTo Engine
Component SEARCH
Priority Low
CurrentState Confirmed
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release01x01Checkins
Topic revision: r2 - 06 Jan 2015, GeorgeClark
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