This is the first comment.
-- Michael Daum on 22 Aug 2005
%DECODE{"..." type="..."}%
reverses encoding via VarENCODE.
type="..."
: type of decoding, can be url
(default), entity
, html
, quote
or none
%SUBST{topic="..." ...}%
insert a topic by processing its content.
topic="..."
: name of the topic text to be processed
rev="..."
: revision of the topic to be processed (defaults to latest version)
text="..."
: text to be processed (has got higher precedence than 'topic')
pattern="..."
: pattern to be extracted or substituted
format="..."
: format expression or pattern substitute
header="..."
: header string prepended to output
footer="..."
: footer string appended to output
limit="<n>"
maximum number of occurences to extract or substitute counted from the start of the text (defaults to 100000
aka all hits)
skip="<n>"
skip the first n occurences
exclude="..."
: skip occurences that match this regular expression
include="..."
: skip occurences that don't match this regular expression
expand="on,off"
: toggle expansion of markup before filtering (defaults to on
)
%STARTSUBST{...}% ... %STOPSUBST%substitute text given inline. see SUBST.
%EXTRACT{topic="..." ...}%
extract text from a topic. see SUBST.
%STARTEXTRACT{...}% ... %STOPEXTRACT%extract content given inline. see SUBST.
%FORMATLIST{"<list>" ...}%
formats a list of items. The <list> argument is separated into items by using
a split expression; each item is matched agains a pattern and then formatted
using a format string while being separated by a separator string; the result is
prepended with a header and appended with a footer in case the list is not empty. $marker
is inserted
selection
regex matches; this will be inserted at the position $marker
as indicated in format
.
$map()
variable. (see also the replace
parameter for means to preprocess list items automatically.)
format
, header
, footer
) may contain format tokens
* $percnt$
* $nop
* $dollar
and
* $n
.
Furthermore the variables:
*$index
: expands to the index within the (filtered) list
* $pos
: expands to the position within the unfiltered list (include and exclude not applied)
* $hits
: expands to the total number of matched list elements
* $count
: expands to the total number of elements in the list
* $marker
: is set if the selection
regular expression matches the current item
* $map(key)
: returns the value for "key" as specified in the map
argument
%MAKEINDEX{"<list>" ...}%
formats a list into a multi-column index like in MediaWiki's category topcis. MAKEINDEX insert capitals as headlines to groups of sorted items. It will try to balance all columns equally, and keep track of breaks to prevent "schusterkinder", that is avoid isolated headlines at the bottom of a column.
parameters:automatic
, that is the number of columns is specified by colwidth
and colgap
; in general it is better to specify colwidth
and colgaph
rather than hard-coding the number of columns; this will let the viewport of the browser/device decide on the number of columns dynamically based on the available space
<h3 $anchor>$group</h3>
"<source1>=<target1>, <source2>=<target2>, ..."
to map a source string to a given target string (default "on")
format
parameter can make use of $1
, $2
, ... variables
to match the groupings defined in the pattern
argument (like in pattern="(.*);(.*);(.*)"
) .
The first matched grouping $1 will be used as the $item to sort the list and is optionally being transliterated.
In addition header
and footer
might contain the $anchors
variable which will expand
to a navigation to jump to the groups within the index.
Pos | Description | Hours |
---|---|---|
1 | onsite troubleshooting | 3 |
2 | normalizing data to new format | 10 |
3 | testing server performance | 5 |
%EXTRACT{topic="%TOPIC%" expand="off" pattern="^\|\s\s(.*?)\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|" format=" * it took $3 hours $2$n" skip="1" }%Expected result (simulated):
$pos
to %FORMATLIST
hideempty
parameter to MAKEINDEX; fixed expand
in SUBST
aind EXTRACT
colwidth
and colgap
to %MAKEINDEX; fixed numerical sorting of lists
$hits
to FORMATLIST to distinguish it from $count
and $index
transliterate
parameter, including custom mappings; upgraded Text::Unidecode fallback shipped with this plugin
lastseparator
(by Foswiki:Main/OliverKrueger); fixed paging when using together with include
and exclude
parameters
hideempty
parameter to enable/disable rendering empty list items
tokenize
pattern for FORMATLIST; fixed potential deep recursion in SUBST/EXTRACT
selection
and marker
to FORMATLIST, similar in use as VarWEBLIST
expand="on"
%EXTRACT{ topic="%TOPIC%" expand="off" pattern=".div class=\"text\">.*?[\r\n]+(.*?)[\r\n]+(?:.*?[\r\n]+)+?-- (.*?) on (.*?)[\r\n]+" format="| $3 | $2 | $1 ... |$n" header="|*Date*|*Author*|*Headline*|$n" }%Expected result (simulated):
Date | Author | Headline |
---|---|---|
22 Aug 2005 | Michael Daum | This is the first comment. ... |
22 Aug 2005 | Michael Daum | This is the second comment. ... |
Date | Author | Headline |
---|---|---|
22 Aug 2005 | Michael Daum | This is the first comment. ... |
22 Aug 2005 | Michael Daum | This is the second comment. ... |
cd /path/to/foswiki perl tools/extension_installer <NameOfExtension> installIf you have any problems, or if the extension isn't available in
configure
, then you can still install manually from the command-line. See https://foswiki.org/Support/ManuallyInstallingExtensions for more help.
Name | Version | Description |
---|---|---|
Text::Unidecode | >=1.27 | Required |
01 Nov 2024: | removed local version of Text::Unidecode |
19 Jan 2024: | added rotate parameter to %FORMATLIST |
23 Jun 2023: | added $pos to %FORMATLIST |
29 Apr 2022: | added casesensitive parameter to MAKEINDEX and FORMATLIST; new macro DECODE ; fixed a couple of perl gotchas initializing variables |
19 Oct 2020: | added hideempty parameter to MAKEINDEX; fixed expand in SUBST aind EXTRACT |
25 Oct 2018: | added rev param to %SUBST and %EXTRACT |
08 Oct 2018: | added colwidth and colgap to %MAKEINDEX; fixed numerical sorting of lists |
01 Jun 2018: | improved sorting of lists, i.e. with numeric values |
05 Mar 2018: | css fixes for MAKEINDEX |
30 Aug 2017: | rewrite MAKEINDEX from using tables to css3 multicolumn |
05 Sep 2016: | added $hits to FORMATLIST to distinguish it from $count and $index |
29 Apr 2016: | don't fallback to unidecode if an explicit mapping is given; don't use Foswiki's internal anchor creator as it does not support unicode |
20 Apr 2016: | added transliterate parameter, including custom mappings; upgraded Text::Unidecode fallback shipped with this plugin |
31 Aug 2015: | fixing deprecated unescaped left brace in regexes |
17 Jul 2015: | fixed compatibility with Foswiki-2.x |
10 Apr 2014: | transliterate/normalize unicode strings before sorting them in MAKETEXT |
19 Jun 2012: | added lastseparator (by Foswiki:Main/OliverKrueger); fixed paging when using together with include and exclude parameters |
15 May 2012: | fixed paging through lists in FORMATLIST |
05 May 2012: | fixed lists not being processed properly before iterating over them in FORMATLIST and MAKEINDEX |
19 Apr 2012: | modernized plugin by using a proper OO-core; fixed processing of tokenize properly; added replace parameter for FORMATLIST; fixed the plugin calling Foswiki::Func::expandCommonVariables() itself unnecessarily |
10 Jan 2012: | fixed filtering zero; fixed counting list items without formating them; added hideempty parameter to enable/disable rendering empty list items |
29 Sep 2011: | fixed SUBST macro topic param processing embedded META |
25 Aug 2011: | fixed perl rookie error initializing defaults |
14 Jul 2011: | fixed parsing zero values in lists (by Grzegorz Marszalek) |
06 Apr 2011: | fixed SUBST to removing everything after the last match |
23 Jul 2010: | fixed wrapper for non-official api call to getAnchorName on foswiki-1.1 |
07 Jun 2010: | fixed expanding standard escapes ($n, $percent, ...); improved examples in docu |
12 Feb 2010: | ease tokenize ; forward compatibility for newer foswikis |
17 Nov 2009: | added tokenize pattern for FORMATLIST; fixed potential deep recursion in SUBST/EXTRACT |
14 Sep 2009: | added include counterpart to already existing exclude params; fixed SUBST not to forget about the non-matching tail of a char sequence |
17 Apr 2009: | converted to foswiki, added numerical sorting to MAKETEXT |
08 Oct 2008: | added $anchors to MAKEINDEX (by Dirk Zimoch); added nocase option to FORMATLIST (by Dirk Zimoch); fixed null/empty string match in FORMATLIST |
20 Aug 2008: | added selection and marker to FORMATLIST, similar in use as VarWEBLIST |
03 Jul 2008: | sorting a list before, not after, formatting it in FORMATLIST |
08 May 2008: | added 'text' parameter to SUBST and EXTRACT; fixed SUBST as it was pretty useless before |
07 Dec 2007: | added MAKEINDEX, added lazy compilation |
14 Sep 2007: | added sorting for EXTRACT and SUBST |
02 May 2007: | using registerTagHandler() as far as possible; enhanced parameters to EXCTRACT and SUBST |
05 Feb 2007: | fixed escapes in format strings; added better default value for max number of hits to prevent deep recursions on bad regexpressions |
22 Jan 2007: | fixed SUBST, added skip parameter to FORMATLIST |
18 Dec 2006: | using registerTagHandler for FORMATLIST |
13 Oct 2006: | fixed limit parameter in FORMATLIST |
31 Aug 2006: | added NO_PREFS_IN_TOPIC |
15 Aug 2006: | added use strict; and fixed revealed errors |
14 Feb 2006: | moved in FORMATLIST from the Foswiki:Extensions/NatSkinPlugin; added escape variables to format strings |
06 Dec 2005: | fixed SUBST not to cut off the rest of the text |
09 Nov 2005: | fixed deep recursion using expand="on" |
22 Aug 2005: | Initial version; added expand toggle |