Tags:
create new tag
, view all tags

Question

I've read numerous identical and similar questions here which have helped a lot get me this far but I still can't get the last bit..

I want a search with a conditional include which I can do but can't stop returns in the included text messing up the table.

https://twiki.cern.ch/twiki/bin/view/EGEE/WlcgOsgEgeeOpsMeetingMinutes is the example page but a simplified version would be:

%CALC{$SET(tooold, $TIMEADD($TIME(), -20, day))}%

%SEARCH{
   ".*WlcgOsgEgeeOpsMinutes200*"
   scope="topic"
   regex="on"
   nosearch="on"
   nototal="on"
   order="topic"
   reverse="on"          
   format="$percntCALC{$IF($TIME($date) <= $GET(tooold), <nop>, | *Summary:* | <pre> $NOP(%)INCLUDE{\"$topic\" section=\"summary\"}$NOP(%)  </pre> |)}$percnt"
}%

I'm using <pre> tags at the moment to ignore the line breaks but that has the other undesirable effects of ignoring twiki words for instance.

Is there a way to ignore line breaks or replace them with %BR%. I have access the filter plugin but can't work out how to insert it in there.

Steve

Environment

TWiki version: TWikiRelease04x01x00
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Search

-- SteveTraylen - 10 Jul 2008

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

Try adding separator="%BR%" to your SEARCH.

See VarSEARCH for more on the separator attribute.

-- SeanCMorgan - 11 Jul 2008

Hi, The separator does not help here, you just get

| row1col1 | row1col2 | %BR% | row2col1 | row2col2 |
in that case. Where as I need to cope with line breaks within row1col2.

-- SteveTraylen - 16 Jul 2008

I suggest you use the date keyword in the search clause with a time interval http://twiki.org/cgi-bin/view/TWiki/TimeInterval. The IF conditional would then not be needed any more in the format clause and the escaping of specials caracters would then be simplified..You could then use a more standard/simple format clause.

-- OlivierThompson - 16 Jul 2008

You may have seen these remarks in IncludeTopicsAndWebPages:
JamesKnevitt - 25 Jul 2006> Is there functionality for using Include inside a table cell?
PeterThoeny - 25 Jul 2006> You can, but only if the included text has no newlines. Newlines break TWiki tables apart.

That's discouraging. I tried a bunch of work-arounds but got nowhere.

RecursiveRenderPlugin might help? At least that page shows a macro with newlines inside a table cell.

Otherwise you might be better off reworking your template to use a form, with input controls for each section. That will give you control over how the line breaks of a textarea for the summary are interpreted, so you can fix the problem at the source instead of on the fly. Then when building your index page, you would use FORMFIELD instead of SEARCH.

Another reason to use a form is to provide better guidance to the users than the HTML comments in your template. smile

If you decide to go that way, here's a trick I've used in a couple of TWikiApps: put "* Set EDITACTION = form" in your template, so that the edit action takes the users to your fancy form and not the regular edit screen. But if you really want the edit box instead, just hit "Checkpoint" (now called "Save and Continue").

-- SeanCMorgan - 16 Jul 2008

Thanks for the comments, I've been looking at TWikiForms anyway and it looks like they may help me here as well given the comments. The documentation is a little confusing though... I just have to experiment I guess.

-- SteveTraylen - 17 Jul 2008

Closing this question after more than 30 days of inactivity. Feel free to re-open if needed.

-- PeterThoeny - 02 Sep 2008

 
Change status to:
Topic revision: r8 - 2008-09-02 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.