%ADDTOHEAD{}%
expands in-place to an empty string, unless there is an error in which case the variable expands to an error string.
%ADDTOHEAD{ "..." text="..." }%
Parameter: | Description: | Comment: |
---|---|---|
"..." | ID of the head block, such as "MY_CSS" | Optional but recommended |
text="..." | HTML text to add to the head section | Mutually exclusive with topic="" |
topic="Web.TopicName" | Name of topic that contains the full HTML text to add to the head section, such as topic="Main.MyCssTopic" | Mutually exclusive with text="" |
section="name" | If topic parameter is used, includes only the specified named section, as defined in the topic by the STARTSECTION and ENDSECTION variables. Nothing is shown if the named section does not exists. section="" is equivalent to not specifying a section | Optional |
requires="..., ..." | Comma-separated list of other IDs this one depends on | Optional |
%ADDTOHEAD{ "MYBOX_CSS" text="<style type=\"text/css\"> .myBox { height: 22px; background-color: #AFB3C5; } </style>" }%
(this topic)
%COLORPICKER{}%
variable is handled by the ColorPickerPlugin.
%COLORPICKER{ name="..." value="..." }%
Parameter | Description | Default | Example |
---|---|---|---|
name | Name of input field | (required) | name="text_color" |
value | Initial color value, in hexadecimal notation for the combination of Red, Green, and Blue color values (RGB). | (none) | value="#0000ff" |
size | Size of input field, in number of characters | (browser default) | size="8" |
class | CSS class of input field or the rectangular color block | (none) | class="twikiInputField" |
style | Style of input field or the rectangular color block | (none) | style="width: 190px; height: 32px" |
type | Type of color widget: • "below" - color picker is located below the input field;• "popup" - pop-up a color picker window when clicking the button next to the input field (this uses very little vertical space); • "view" - a read-only rectangular block colored in the color value (no color picker);• "view-hex" - like view , in addition shows the color value as an RGB hexadecimal code (no color picker); | type="below" | type="view-hex" |
Additional parameters can be supplied; they will be added to the HTML input field or the rectangular color block. |
<form action="...">
%COLORPICKER{ name="text_color" value="#123456" class="twikiInputField" type="popup" }%
<form>
%COMMENT%
without parameters shows a simple text box.
%COMMENT{}%
can handle the following parameters: Parameter | Description | Default |
---|---|---|
type | This is the name of the template to use for this comment. Comment templates are defined in a TWiki template - see customization. If this attribute is not defined, the type is whatever is defined by COMMENTPLUGIN_DEFAULT_TYPE, either in this topic or in your WebPreferences. | "below" |
default | Default text to put into the textarea of the prompt. | |
target | Name of the topic to add the comment to | the current topic |
location | Regular expression specifying the comment location in the target topic. Read carefully the CommentPlugin documentation! | |
mode | For compatibility with older versions only, synonymous with type | |
nonotify | Set to "on" to disable change notification for target topics | "off" |
noform | Set to "on" to disable the automatic form that encloses your comment block - remember to insert <form> tags yourself! See CommentPluginExamples for an example. | "off" |
nopost | Set to "on" to disable insertion of the posted text into the topic. | "off" |
remove | Set to "on" to remove the comment prompt after the first time it is clicked. | "off" |
button | Button label text | "Add comment" |
emailto | Send comment by email. Use comma "," to seperate multiple email addresses. This feature is disabled by default. To enable this feature, please set up "$TWiki::cfg{Plugins}{CommentPlugin}{EmailEnabled} = 1;". |
%DASHBOARD{...}%
variable.
%DASHBOARD{ section="..." ... }%
%DASHBOARD{ section="dashboard_start" }%
%DASHBOARD{ section="banner" image="..." title="..." }%
%DASHBOARD{ section="box_start" title="Box 1 title" }%
Box 1 content
%DASHBOARD{ section="box_end" }%
%DASHBOARD{ section="box_start" title="Box 2 title" }%
Box 2 content
%DASHBOARD{ section="box_end" }%
...
%DASHBOARD{ section="dashboard_end" }%
%DATEPICKER{}%
variable is handled by the DatePickerPlugin.
%DATEPICKER{ name="..." value="..." }%
Parameter | Description | Default | Example |
---|---|---|---|
name | Name of input field. φ: No output is shown if the name parameter is missing, but the CSS and Javascript are loaded. | (requiredφ) | name="Start" |
value | Initial date value. | "" (today) | value="2012-12-31" |
format | Format of resulting date value. • %a - abbreviated weekday name• %A - full weekday name• %b - abbreviated month name• %B - full month name• %C - century number• %d - the day of the month (00 ... 31)• %e - the day of the month (0 ... 31)• %H - hour (00 ... 23)• %I - hour (01 ... 12)• %j - day of the year ( 000 ... 366)• %k - hour (0 ... 23)• %l - hour (1 ... 12)• %m - month (01 ... 12)• %M - minute (00 ... 59)• %n - a newline character• %p - "PM" or "AM"• %P - "pm" or "am"• %S - second (00 ... 59)• %s - number of seconds since Epoch (since Jan 01 1970 00:00:00 UTC)• %t - a tab character• %U , %W , %V - the week number. The week 01 is the week that has the Thursday in the current year, which is equivalent to the week that contains the fourth day of January. Weeks start on Monday.• %u - the day of the week (1 ... 7, 1 = MON)• %w - the day of the week (0 ... 6, 0 = SUN)• %y - year without the century (00 ... 99)• %Y - year including the century (ex. 2012)• %% - a literal % character | "%Y-%m-%d" | format="%e %b %Y" |
id | ID of input field, optional. | "id_" + name | id="idStart" |
size | Size of input field, in number of characters. | (calculated as needed) | size="12" |
class | CSS class of input field. | "twikiInputField" | class="dateField" |
Additional HTML input field attributes, such as alt , disabled , maxlength , onblur , onchange , onfocus , readonly , style , tabindex , title |
<form action="...">
%DATEPICKER{ name="Start_Date" }%
<form>
"\n"
) and linefeed ("\r"
)
"<"
, ">"
, "&"
, single quote ('
) and double quote ("
)
"%"
, "["
, "]"
, "@"
, "_"
, "*"
, "="
and "|"
%ENCODE{"string"}%
Parameter: | Description: | Default: |
---|---|---|
"string" | String to encode | required (can be empty) |
type="url" | Encode special characters for URL parameter use, like a double quote into %22 | (this is the default) |
type="quotes" | Escape double quotes with backslashes (\" ), does not change other characters. This type does not protect against cross-site scripting. | type="url" |
type="moderate" | Encode special characters into HTML entities for moderate cross-site scripting protection: "<" , ">" , single quote (' ) and double quote (" ) are encoded. Useful to allow TWiki variables in comment boxes. | type="url" |
type="safe" | Encode special characters into HTML entities for cross-site scripting protection: "<" , ">" , "%" , single quote (' ) and double quote (" ) are encoded. | type="url" |
type="entity" | Encode special characters into HTML entities, like a double quote into " . Does not encode newline (\n ) or linefeed (\r ). | type="url" |
type="entity" extra=" $n$r" | For type="entity" only, use the extra parameter to encode additional characters to HTML numeric entities. Formatting tokens can be used, such as "$n" for newline. Note that type="entity" extra=" $n$r" is equivalent to type="html" . | type="url" extra="" |
type="html" | Encode special characters into HTML entities. In addition to type="entity" , it also encodes space, \n and \r . Useful to encode text properly in HTML input fields. See equivalent ENTITY. | type="url" |
type="json" | Escape double quotes and backslashes with backslashes (\" and \\ , respectively), escape non-printable characters with hex code \u0000 ... \u001F , does not change other characters. Use this to properly escape text for a JSON string. Example result: This is a string with \"quoted\" and \\backslashed\\ text . | type="url" |
type="csv" | Escape single quotes and double quotes by repeating them, other characters do not change. Use this to properly escape fields in CSV reports that output comma-separated values, such as "field 1","field 2 with ''single'' and ""double"" quotes" . | type="url" |
type="search" | Special encoding used for SEARCH: Substitute % characters into non-printable characters, so that TWikiVariables are no longer expanded. Also escapes quotes. Used to feed a search string from a URLPARAM into SEARCH without expanding any variables, such as when searching for %BR% . | type="url" |
newline="..." | Replace a newline with the specified value before encoding. Please note that newline="<br/>" does not bring <br/> to the output because < and > are encoded (except with the quotes and csv types). To have <br/> in the output, you need to specify newline="$br" . However, newline="$br" does not work in combination with type="url" (the defautl type). This shouldn't be a problem because it's very rare to need to have <br/> encoded in a URL. In addition to $br , $n has a special meaning in a newline parameter value - $n results in a newline in the output. This parameter is expected to be used in combination with the moderate , safe , entity , or html type. With the other types, it causes unuseful results. |
%ENCODE{"spaced name"}%
expands to spaced%20name
%ENCODE{"spaced name" type="entity" extra=" "}%
expands to spaced name
"html"
. A shorter %ENTITY{any text}%
can be used instead of the more verbose %ENCODE{ "any text" type="html" }%
. <input type="text" name="address" value="%ENTITY{any text}%" />
%SET{ "lunch" value="%ENCODE{ "string with "quotes"" type="quotes" }%" remember="1" }%
type="moderate"
, type="safe"
, type="entity"
or type="html"
to protect user input from URL parameters and external sources against cross-site scripting (XSS). type="html"
is the safest mode, but some TWiki applications might not work. type="safe"
provides a safe middle ground, type="moderate"
provides only moderate cross-site scripting protection.
%SET{}%
. The %SET{}%
and %GET{}%
variables are handled by the SetGetPlugin.
%GET{ "name" default="..." }%
Parameter | Description | Default |
---|---|---|
"name" | Name of variable, such as menu . May optionally contain a JSON path, such as menu.File.Open . | (required) |
format="..." | Format with supported variables: • $name for variable name • $value for variable value • $isdefined expanding to 1 or 0 depending if variable is defined or not • $isset expanding to 1 or 0 depending if variable is logically true or false • $ispersistent expanding to 1 or 0 depending if variable is persistent or not • all FormatTokens such as $dollar , $n , $percnt . | "$value" |
default="..." | Text shown if variable is not defined, e.g. not found. This parameter overrides the format parameter. | "" (empty string) |
store="..." | Specify a store name that holds the persistent variable. This assumes the variable was previously set with the same store name. | "" |
%GET{"lunch"}%
returns Sushi
if the following has been previously set:%SET{ "lunch" value="Sushi" }%
- see more examples
%GET{ name }%
- see description.
%SET{ menu = { "File": { "New": [ "new", "F" ], "Open": [ "open", "F" ] }, "Edit": { "Copy": [ "cpy", "F" ], "Paste": [ "pst", "F" ] } } }%
- set a JSON object
%GET{ menu.File.Open }%
- returns: ["open","F"]
%HEADLINES{"url"}%
variable is handled by the HeadlinesPlugin.
%HEADLINES{ "http://..." }%
"..." | Source of RSS or ATOM feed; this can be a URL (starting with http) or a web.topic location for internal feeds |
refresh="60" | Refresh rate in minutes for caching feed; "0" for no caching |
limit="12" | Maximum number of items shown |
header="..." | Header. May include these variables: - $channeltitle , $title : title of channel (channel.title) - $channellink , $link : link of channel (channel.link) - $channeldescription , $description : description (channel.description) - $channeldate , $date : publication date of the channel (channel.pubDate) - $rights : copyrights of the channel (channel.copyright) - $imagetitle : title text for site (image.title) - $imagelink : link for site (image.link) - $imageurl : URL of image (image.url) - $imagedescription : description of image (image.description) |
format="..." | Format of one item. May include these variables: - $title : news item title (item.title) - $link : news item link (item.link) - $description : news item description (item.description) - $date : the publication date (item.pubDate, item.date) - $category : the article category (item.category) |
newline="$br" | Convert newlines in feed; "$br" becomes <br /> tag, default "$n" (newline) |
filter="..." | Filter out content from feed; for example to delete an encoded break tag specify "<br>" |
Details |
%HEADLINES{ "http://slashdot.org/slashdot.rdf" header="*[[$link][$title]]:* $description" format="$t* [[$link][$title]]" limit="4" }%
shows the latest Slashdot news in bullet list format
%INCLUDE{"page" ...}%
Parameter: | Description: | Default: |
---|---|---|
"SomeTopic" | The name of a topic located in the current web, i.e. %INCLUDE{"WebNotify"}% | |
"Web.Topic" | A topic in another web, i.e. %INCLUDE{"TWiki.SiteMap"}% | |
"http://..." | A full qualified URL, i.e. %INCLUDE{"http://twiki.org:80/index.html"}% . Supported content types are text/html and text/plain by default. See allowanytype .if the URL resolves to an attachment file on the server this will automatically translate to a server-side include. | |
attachment="filename.ext" | Include the specified attachment instead of topic text. The attachment content is subject to processing just like when topic text is included. For example, text up to %STARTINCLUDE% is excluded. When including an attachment, you can do without topic specification - %INCLUDE{attachment="filename.ext"}% works, which results in including the attachment of the same topic. | |
allowanytype="on" | Suppress the content type checking in including the web page specified by a URL. | disabled |
charset="CHARSET" | Specify the charset of the included content so that a proper charset conversion happens when it's different from the site charset. Needless to say, this works for a TWiki topic, a topic attachment, and a content specified with a URL. This parameter overrides otherwise specified or implied charset. | none |
pattern="..." | Include a subset of a topic or a web page. Specify a RegularExpression that scans from start ('^' ) to end and contains the text you want to keep in parenthesis, e.g., pattern="^.*?(from here.*?to here).*" . IncludeTopicsAndWebPages has more. | none |
headingoffset="2" | Adjust the level of headings in the included topic. A "2" or "+2" increases the level by two, e.g. a ---+ H1 turns into a ---+++ H3. Positive and negative values are supported. Adjusted min and max levels are H1 and H6, respectively. | no adjustment |
hidetoc="on" | Remove %TOC% in included content. Useful to show table of contents in individual topics, while suppressing them if included in a big master document. | TOC_HIDE_IF_ setting |
rev="2" | Include a previous topic revision; N/A for URLs | top revision |
raw="on" (for HTTP inclusion) | When a page is included via HTTP, normally TWiki will process it, doing the following: 1) Alter relative links to point back to originating host, 2) Remove some basic HTML tags (html, head, body, script) and finally 3) Remove newlines from HTML tags spanning multiple lines. If you prefer to include exactly what is in the source of the originating page set this to on . raw="on" is short for disableremoveheaders="on" , disableremovescript="on" , disableremovebody="on" , disablecompresstags="on" and disablerewriteurls="on" . | disabled |
raw="on" (for topic or attachment inclusion) | When a topic is included, normally TWiki variables in the included topic are expanded in the context of the included topic. If raw="on" is specified, that variable expansion does not happen. You may wonder what's that for and what are the implications, which are found out on IncludeTopicRaw. Because of the "in the raw" nature of the parameter, if it's specified, parameters such as encode , headingoffset , hidetoc , newline , nofinalnewline , and section are ignored. | disabled |
literal="on" | While using the raw option will indeed include the raw content, the included content will still be processed and rendered like regular topic content. To disable parsing of the included content, set the literal option to "on" . | disabled |
nofinalnewline="on" | Delete the new line at the end of the result if exists | disabled |
newline="$br" | Convert newlines in textarea to other delimiters. Variable $br expands to <br /> tag, and $n to a newline. Other text is encoded based on encode parameter. | no conversion |
encode="html" | Encode special characters into HTML entities. If a FORMFIELD is passed into an HTML form field it should be encoded as "html" . Additional encodings available: encode="quote" , encode="moderate" , encode="safe" , encode="entity" and encode="url" . See ENCODE for details. | no encoding |
disableremoveheaders="on" | Bypass stripping headers from included HTML (everything until first </head> tag) | disabled |
disableremovescript="on" | Bypass stripping all <script> tags from included HTML | disabled |
disableremovebody="on" | Bypass stripping the </body> tag and everything around over and below it | disabled |
disablecompresstags="on" | Bypass replacing newlines in HTML tags with spaces. This compression step rewrites unmatched <'s into < entities unless bypassed | disabled |
disablerewriteurls="on" | Bypass rewriting relative URLs into absolute ones | disabled |
disablefixlinks="on" | Bypass fixing WikiWord links if include is done across webs. Fixing links in included text such as from SomeLink to Otherweb.SomeLink is usually desirable so that links in included text still point to the same target | disabled |
warn="off" | Warn if topic include fails: Fail silently (if off ); output default warning (if set to on ); else, output specific text (use $topic for topic name) | %INCLUDEWARNING% preferences setting |
section="name" | Includes only the specified named section, as defined in the included topic by the STARTSECTION and ENDSECTION variables. Nothing is shown if the named section does not exists. section="" is equivalent to not specifying a section | |
PARAMONE="val 1" | Any other parameter will be defined as a variable within the scope of the included topic. The example parameters on the left will result in %PARAMONE% and %PARAMTWO% being defined within the included topic. A default value for a variable can be specified in the included topic in case the corresponding parameter is not specified, such as %PARAMONE{ default="..." }% |
%INCLUDE{"http://www.google.com/"}%
is turned off by default. To turn this on, ask your TWiki administrator to enable the {INCLUDE}{AllowURLs}
flag in the Security setup section of configure.
raw
or disableremovescript
parameter.
%INCLUDE{"http://THIS_SERVER/.../THIS_WEB/THIS_TOPIC}%
is detected and blocked.
$TWiki::cfg{UrlHostRegex}
should be set so that it matches all possible server names. e.g. $TWiki::cfg{UrlHostRegex} = qr{http://(www\.)?domain\.com};
attachment="filename.ext"
%STARTINCLUDE%
and %STOPINCLUDE%
in the attachment are observed. The section
parameter is observed. The variables are expanded in the context of the topic having the attachment. For example, %TOPIC%
is expanded to the name of the topic having the attachment.
%INCLUDE{%ATTACHURL%/foo.txt}%
) raw="on"
is specified, the content of <body>...</body>
is extracted, all occurrences of <script>...</script>
are removed. Topic context change doesn't happen because in general inclusion via HTTP doesn't cause topic context change.
%JQTABPANE% %JQTAB{"Tab 1"}% ... %JQENDTAB% %JQTAB{"Tab 2"}% ... %JQENDTAB% ... %JQENDTABPANE%
%JQTABPANE% %JQTAB{"Tab 1"}% ... %JQENDTAB% %JQTAB{"Tab 2"}% ... %JQENDTAB% ... %JQENDTABPANE%
%JQTABPANE% %JQTAB{"Tab 1"}% ... %JQENDTAB% %JQTAB{"Tab 2"}% ... %JQENDTAB% ... %JQENDTABPANE%
Parameter: | Description: | Default: |
---|---|---|
"..." | Name of tab, shown as tab label | (required) |
before | When switching tabs, this is the Javascript fragment to be executed just before the tab is displayed | "" |
after | This Javascript handler is to be executed after the tab has been made visible | "" |
afterload | This Javascript handler will be called when content loaded asynchronously has finished loading (using the url parameter described below). Depending on the network latency and server response time, this can be significantly later than execution of the after handler above | "" |
url | Link from where to load the content of the tab asynchronously when selecting this tab; the result of the addressed handler will replace the content area; if no url is set the content of the TAB ... ENDTAB area will be shown when the tab is selected | "" |
container | Container element (".someClass" or "#someID" ) where content will be loaded asynchronously using Ajax; this is only used together with url | ".jqTabContents" |
class | Add additional class to existing tab class "jqTab" | "" |
%JQTABPANE%
%JQTAB{ "Tim Berners-Lee" url="%SCRIPTURL{view}%/TWiki/TimBernersLee?skin=text" }%
%ICON{processing}%
%JQENDTAB%
%JQENDTABPANE%
%JQTAB{"..."}%
and %JQENDTAB%
pairs, and enclose them in %JQTABPANE%
and %JQENDTABPANE%
. Tab panes can be nested, e.g. within one tab you can add another tab pane. These variable are handled by the JQueryPlugin.
%JQTABPANE{ select="1" }% %JQTAB{"Tab 1"}% ... %JQENDTAB% %JQTAB{"Tab 2"}% ... %JQENDTAB% ... %JQENDTABPANE%
Parameter: | Description: | Default: |
---|---|---|
select="" | Select a tab pane, default is the first tab. | "1" |
tab
URL parameter using %JQTABPANE{ select="%URLPARAM{tab}%" }%
%JQTABPANE%
%JQTAB{"Tab 1"}%
Tab 1 content...
%JQENDTAB%
%JQTAB{"Tab 2"}%
Tab 2 content...
%JQENDTAB%
%JQENDTABPANE%
%GET{}%
. No output is shown, e.g. %SET{}%
resolves to an empty string. It is also possible to set a JSON object using a JSON path. The %SET{}%
and %GET{}%
variables are handled by the SetGetPlugin.
%SET{ "name" value="..." remember="1" }%
Parameter | Description | Default |
---|---|---|
"name" | Name of variable. Alphanumeric characters, dashes and underscores can be used. | (required) |
value="..." | Value of variable. Escape double quotes with backslash. | (required, may be empty) |
remember="1" | If set, the variable will be stored persistently so that it can be used later in any TWiki topic. Alternatively use the store parameter. See important notes. | "0" |
store="..." | Specify a store name to persistently store the variable, such as store="Parts" . Use alphanumeric characters, dashes and underscores for the name. For better performance, store is preferred over the remember parameter if you need to store a large dataset. See important notes. | "" |
%SET{"lunch" value="Sushi"}%
- see more examples.
%SET{ name = { ... } remember="1" }%
- see description. remember="1"
or store="..."
parameter can be appended. If specified, the JSON object will be stored persistently so that it can be used later in any TWiki topic.
%SET{ menu = { "File": { "New": [ "new", "F" ], "Open": [ "open", "F" ] }, "Edit": { "Copy": [ "cpy", "F" ], "Paste": [ "pst", "F" ] } } }%
- set a JSON object
%GET{ menu }%
- returns: {"File":{"New":["new","F"],"Open":["open","F"]},"Edit":{"Copy":["cpy","F"],"Paste":["pst","F"]}}
%SET{ menu.File.Open[1] = "T" }%
- modify a JSON object
%GET{ menu }%
- returns: {"File":{"New":["new","F"],"Open":["open","T"]},"Edit":{"Copy":["cpy","F"],"Paste":["pst","F"]}}
%SET{ menu.Edit.Cut = [ "cut", "T" ] }%
- add to a JSON object
%GET{ menu }%
- returns: {"File":{"New":["new","F"],"Open":["open","T"]},"Edit":{"Copy":["cpy","F"],"Paste":["pst","F"],"Cut":["cut","T"]}}
%SET{}%
. The %SETGETDUMP{}%
, %SET{}%
, and %GET{}%
variables are handled by the SetGetPlugin.
%SETGETDUMP{ remember="1" format="..." separator="..." }%
Parameter | Description | Default |
---|---|---|
remember="1" | Dump all persistent variables | (volatile variables) |
store="..." | Dump variables of a specific store | (volatile variables) |
format="..." | Format output using variables $name and $value | "name: $name, value: $value <br />" |
separator="..." | String used for separating entries | "\n" |
%SETGETDUMP{"| $name | $value |" separator="$n"}%
- see more examples.
%TWISTY{}%
variable is handled by the TwistyPlugin.
%TWISTY{}% ... %ENDTWISTY%
%TWISTY{}%
my twisty content
%ENDTWISTY%