cross is now running Foswiki 2.1.3 Beta 1. Please open a task for any issues.

Item8635: Add a FORMAT type='string' that avoids doing topic specific list processing

Priority: Enhancement
Current State: Closed
Released In: 1.1.0
Target Release: minor
Applies To: Engine
Reported By: CrawfordCurrie
Waiting For:
Last Change By: KennethLavrsen
Issues with FORMAT, some doc and some code. I'll provide unit tests as an when I can.

I'm really not convinced FORMAT is a good name for the macro. It isn't intention-revealing, at least not to me. It suggest that it's going to let me apply a macro to a list of parameters, but that's not what it does; instead, it processes a text string that represents a list, and generates a new text string. It's very, very, very close in function to the FORMATLIST macro in FilterPlugin, and conflicts with the macro of the same name in ForEachPlugin.

  1. Doc does not specify what happens to whitespace in the list. Will "Blah,blah" process the same list of tokens as "Blah, blah" and "Blah ,blah"?
  2. I would guess the standard formatting tokens are supported - doc doesn't say explicitly (though it mentions $n in separator)
  3. $topic is definitely wrong; my lists are not topics! $item would be much better (and consistent with other work, e.g. FilterPlugin)
  4. No way to control the separator to split on (may have a ; separated list, for example)

(work in progress - to be continued)

-- CrawfordCurrie - 27 Feb 2010

I personally prefered to call the macro FORMAT, as that is really what it does, but was asked to change it smile until we release 1.1, it can clearly be renamed to anything.

wrt to the rest, yes, this is a combination of lack of docco and me being unsure how far I'd get in the first pass - at this point, its mostly an extraction of the formatting code out of SEARCH.

$item is one thing, but I have been wondering if $web and $topic won't be a special case of $item - where it assumes it is one, and formats&filters with that assumption - where $item is the item, and $address is the tom address of the item. Having someone else start to use the code will help work out what we really want to push into 1.1, and what can wait til 2.0

good list tho - keep it up, and thankyou.

-- SvenDowideit - 27 Feb 2010

Linked with SettingAndGettingVariablesUsingMacros - how do I have a list with commas in it?

-- CrawfordCurrie - 28 Feb 2010

at this point it uses the same processing as the SEARCH topics - ie split(/,\s*/ .

-- SvenDowideit - 02 Mar 2010

Modified to support $item and handle lists that are not topics. Used in foswiki.tmpl.

-- CrawfordCurrie - 23 May 2010

I think I'll coalesce the code during the week - fundamentally its where it is heading for foswiki 2.0.

-- SvenDowideit - 24 May 2010

OK. It might be sensible to consider how we would handle "list of objects" now, rather than leaving them till later. For example, "list of users", "list of webs", "list of attachments" etc. Lists of strings are just so limiting.

-- CrawfordCurrie - 24 May 2010

you say that $item is used in foswiki.tmpl, but I don't see it:

%FOREACH{"%EXPORTEDPREFERENCES%" format="$topic:\"$percnt$topic$percnt\"" separator=","}%}=

I re-wrote it to use the existing code path - this sets up the topic specific format string processing extractions for 2.0, and gives us a $index that is cross web.

yes, this $item and $index isa part of the feature now

-- SvenDowideit - 30 May 2010

ItemTemplate edit

Summary Add a FORMAT type='string' that avoids doing topic specific list processing
ReportedBy CrawfordCurrie
Codebase trunk
SVN Range
AppliesTo Engine
Priority Enhancement
CurrentState Closed
Checkins distro:e4a37c8f0637 distro:11a0db12178a distro:d1b24af43e3e
TargetRelease minor
ReleasedIn 1.1.0
Topic revision: r16 - 04 Oct 2010, KennethLavrsen - This page was cached on 18 Jan 2017 - 13:15.

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