You are here:
Foswiki
>
System Web
>
Macros
>
VarFORMAT
E
dit
A
ttach
Tags:
create new tag
,
view all tags
#VarFORMAT ---+++ FORMAT{"list" format="" header="" footer="" separator=""} -- format a list of objects * Syntax: =%<nop>FORMAT{"list"}%= * Supported parameters: | *Parameter:* | *Description:* | *Default:* | | ="one, two, three"= | The list to be expanded into the format. Required. Currently only two types of list data are supported; topic names (=type="topic"=) and plain strings (=type="string"=). | =""= | | =format="..."= | Format string | =""= | | =header="..."= | Text to come before the formated output | =""= | | =footer="..."= | Text to come after the formated output | =""= | | =separator="n"= | Separator between formatted elements | ="$n"= | | =type=""= | Treat input list as either =topic= or =string= | ="topic"= | * Examples: <verbatim class="tml"> %FORMAT{"one,two,three" type="string" format=" * $item"}% %FORMAT{"%SKIN%" header="the Skin setting is evaluated in this order:" format=" 1 =$topic=" footer=" 1 =default=" }%</verbatim> * Related: [[%IF{"'%INCLUDINGTOPIC%'='Macros'" then="#"}%VarSEARCH][SEARCH]] ---++++ Supported formatting tokens If =type="topic"= (the default) the format string can contain _any_ of the topic-specific format tokens specified in FormattedSearch (=$web=, =$topic=, =$parent=, =$text=, =$locked=, =$date=, =$isodate=, =$index=, =$item=, =$rev=, =$username=, =$wikiname=, =$wikiusername=, =$createdate=, =$createusername=, =$createwikiname=, =$createwikiusername=, =$summary=, =$changes=, =$formname=, =$formfield=, =$pattern=, =$count=, =$ntopics=, =$nhits=, =$pager=). In addition, the macro supports all the standard [[format tokens]]. If =type="string"= then the comma separated list is treated as a list of strings. In this case, the format tokens =$index= and =$item= will return the position of the item in the list (1-based), and the item itself, respectively. Note that a comma can be embedded in the data using the standard formatting token =$comma=. The FORMAT macro is currently only of use in formatting lists of topics, or of simple strings. It will be extended in future releases to add the capability to render other object types. <blockquote class="foswikiHelp">%I% For more sophisticated handling of string lists, consider installing Foswiki:Extensions.FilterPlugin.</blockquote> * Related: [[%IF{"'%INCLUDINGTOPIC%'='Macros'" then="#"}%VarSEARCH][SEARCH]], [[%IF{"'%INCLUDINGTOPIC%'='Macros'" then="#"}%VarENCODE][ENCODE]], FormattedSearch <!--%JQREQUIRE{"chili"}%-->
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Edit
w
iki text
|
M
ore topic actions
Topic revision: r1 - 09 Jan 2009,
ProjectContributor
System
Log In
or
Register
Toolbox
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
User Reference
BeginnersStartHere
TextFormattingRules
Macros
FormattedSearch
QuerySearch
DocumentGraphics
SkinBrowser
InstalledPlugins
Admin Maintenance
Reference Manual
AdminToolsCategory
InterWikis
ManagingWebs
SiteTools
DefaultPreferences
WebPreferences
Categories
Admin Documentation
Admin Tools
Developer Doc
User Documentation
User Tools
Webs
Applications
ClassificationApp
Extensions
Main
System
Copyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki?
Send feedback