You are here: Foswiki>Tasks Web>Item973 (23 Feb 2009, KennethLavrsen)Edit Attach

Item973: SEARCH adds extra separator for header

pencil
Priority: Normal
Current State: Closed
Released In: 1.0.1
Target Release: patch
Applies To: Engine
Component:
Branches:
Reported By: ArthurClemens
Waiting For:
Last Change By: KennethLavrsen
If you use separator together with header, an extra separator is added.

With header:
%SEARCH{
"name~'*Pattern*'"
type="query"
format="[[$web.$topic][$topic]]"
separator=", "
header="Search for Pattern:<br />"
nonoise="on"
}%
... creates:

Search for Pattern:
PatternSkin, PatternSkinBugsTemplate, PatternSkinItemViewTemplate

... while without header:
%SEARCH{
"name~'*Pattern*'"
type="query"
format="[[$web.$topic][$topic]]"
separator=", "
nonoise="on"
}%
... creates:

PatternSkin, PatternSkinBugsTemplate, PatternSkinItemViewTemplate

-- ArthurClemens - 03 Feb 2009

This seems to be coded on purpose:

        # header and footer of $web
        my ( $beforeText, $repeatText, $afterText ) =
          split( /%REPEAT%/, $tmplTable );
        if ( defined $header ) {
            $beforeText = Foswiki::expandStandardEscapes($header);
            $beforeText =~ s/\$web/$web/gos;    # expand name of web
            if ( defined($separator) ) {
                $beforeText .= $separator;
            }
            else {
                $beforeText =~
                  s/([^\n])$/$1\n/os;           # add new line at end if needed
            }
        }

But removing it does not break any of the 175 unit tests.

-- ArthurClemens - 03 Feb 2009

Are you sure? It broke 151 unit tests...

Re-opening it to fix it "properly".

In fact, I have no idea how to fix it properly, so just "fixing" it so it doesn't break any unit test, and thus had to "fix" the new unit test added by Arthur, for this particular problem.

Arthur, please check your test environment, on mine, it breaks a lot of tests, and on the build server too...

-- OlivierRaginel - 04 Feb 2009

It does not break tests now.

-- ArthurClemens - 04 Feb 2009

It broke Fn_SEARCH because "Ok-Topic" is lexically below "Ok+Topic" but the separator tests had them reversed.

-- CrawfordCurrie - 07 Feb 2009

Dash it - it's only lexically below if UseLocale is on. Made the Fn_SEARCH tests control the setting of UseLocale, so we can be sure we've got our shoes on the right feet before we step in it again.

-- CrawfordCurrie - 08 Feb 2009

ItemTemplate edit

Summary SEARCH adds extra separator for header
ReportedBy ArthurClemens
Codebase
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Engine
Component
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:16320c2c4a74 distro:9ae21e174adc distro:51241e72ff7e distro:3bf307f07e3d distro:517c74d017c3
TargetRelease patch
ReleasedIn 1.0.1
Topic revision: r12 - 23 Feb 2009, KennethLavrsen - This page was cached on 06 May 2016 - 08:23.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License