This seemed like a good idea to me - it's very simple, but loops always make people think of interesting things to do with them! The plugin allows you to specify any number of named parameters which each contain a pipe-delimited list of replacements. When it renders, it will repeat the plugin body, replacing textual parameters (surrounded by ${...}) in the body from each list. Here's an example...
[{IteratorPlugin num='1|2|3' desc='One|Two|Three'
${num}. ${desc}\\}]
...would produce...
1. One
2. Two
3. Three
You can put any wiki markup in the plugin body. Unfortunately, there's a problem with TranslatorReader which means you can't nest plugins (see my bug report). There's a patch attached which fixes this. With this patch, you can do something like this...
[{IteratorPlugin src='1|2|3|4|5'
{[Image src='holiday${src}.jpg' height='100' caption='Holiday Pic ${src}'}]}]
To install, just drop the JAR into WEB-INF/lib/ and optionally add com.lledrsolutions.jspwiki.plugin to jspwiki.plugin.searchPath in the JSPWiki properties file (if you want to use the shortened plugin name - as in the example).
-- DaveSB
Add new attachment
List of attachments
| Kind | Attachment Name | Size | Version | Date Modified | Author | Change note |
|---|---|---|---|---|---|---|
txt |
TranslatorReader-patch.txt | 1.2 kB | 1 | 27-Oct-2005 13:53 | DaveSB | |
jar |
iterator-plugin.jar | 2.7 kB | 1 | 27-Oct-2005 13:51 | DaveSB |