ParseTopicTablesPlugin
Extract key/value pairs from topics to create a table dynamically
Introduction
There are times when many simple tables need to be displayed as a single table with specific columns. This plugin simply parses the given topic, extracts the given key/value pairs, and creates a new table dynamically.
The first argument is the source topic. The next argument is the primary key. The dynamic table is sorted on this primary key. The remaining arguments are parsed and displayed in the dynamic table in the order they are listed in the command.
Syntax Rules
%PARSETOPICTABLES{TOPIC, KEY [, KEY [, KEY...]]}%
Example
Given tables like the following in topic Systems.HardwareDetails:
| hostname | mailhost |
| location | work room |
| user | admin |
| use | sends mail |
| port | 99Z |
| production | yes |
| hostname | loghost |
| location | closet |
| user | admin |
| use | manages server logs |
| port | 99Z |
| production | yes |
Write this:
%PARSETOPICTABLES{Systems.HardwareDetails, hostname, location, port, production, use}%
The output is:
| *hostname* | *location* | *port* | *production* | *use* |
| mailhost | workroom | 99Z | yes | sends mail |
| loghost | closet | 99Z | yes | manages server logs |
ParseTopicTablesPlugin Settings
Plugin settings are stored as preferences variables. The following variables are used for this plugin.
- One line description, is shown in the TextFormattingRules topic:
- Set SHORTDESCRIPTION = Extract key/value pairs from topics to create a table dynamically
- Debug plugin: (See output in
data/debug.txt)
Plugin Installation Instructions
Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the TWiki server.
- Download the ZIP file from the plugin web (see below)
- Unzip
ParseTopicTablesPlugin.zip in your TWiki installation directory. Content: | File: | Description: |
data/TWiki/ParseTopicTablesPlugin.txt | Plugin topic |
lib/TWiki/Plugins/ParseTopicTablesPlugin.pm | Plugin Perl module |
- Visit
configure in your TWiki installation, and enable the plugin in the {Plugins} section.
- Test if the installation was successful:
%PARSETOPICTABLES{Plugins.ParseTopicTablesPlugin, hostname, location, port, production, use}%
Plugin Info
Related Topics: TWikiPreferences,
Main.TWikiPreferences,
TWikiPlugins