Netgrep Plugin
Embed information from other websites, such as document revision date, by applying filters
Introduction
This plugin searches content from given URL and displays result from given filter, according to given format. It can be used to track changes of documents, which is particularly suitable for growing amount of websites running wikis, blogs or some other tool used to update content. Main reason for writing it was desire to see when links on wiki have been updated, without having to click on the link; it thus acts as sort of latest changes for individual, external, links. Nothing stops one from using it internally to, when linking page on the same wiki.
Syntax Rules
The
%NETGREP{...}% variable gets expanded to the content pulled from an UR that matches give filters.
| %NETGREP% Parameter |
Explanation |
Default |
href |
URL of source |
None; is required |
filter |
patterns to search form, written as computer language (Perl) regular expressions |
none |
format |
Format for displaying results |
Global FORMAT setting |
size |
size of the font displaying result |
100% |
color |
color of the font displaying result |
black |
refresh |
Refresh rate in minutes for caching feed; "0" for no caching |
Global REFRESH setting |
filter
Contribution needed! Short, yet as clear as possible, introduction to the way this plugin uses regular expressions (regex) in given examples, and they way matching results are displayed is required. Target audience are non-technical users. Below perl regex links are there for the convinience of technical users.
format
Contribution needed! Short, yet as clear as possible, introduction to the way this plugins displays matching results is required. Target audience are non-technical users.
Examples
Valid examples
| plugin tag |
%NETGREP{ href="http://www.w3.org/TR/CSS2/" filter="(W3C Working Draft \d+ \w+ \d+)" format="+0+" }% |
| displayed output |
W3C Working Draft 07 December 2010 |
| real life use |
CSS 2.1 Specification W3C Working Draft 07 December 2010 |
| plugin tag |
%NETGREP{ href="http://www.dwheeler.com/essays/scm-security.html" filter="(Revised \w+ \d+\, \d+)" format="+0+" color="green" size="larger" }% |
| displayed output |
Revised May 6, 2005 |
| real life use |
security analysis by d wheeler Revised May 6, 2005 |
Missing/wrong parameters
NetgrepPlugin Global Settings
Plugin settings are stored as preferences variables. To reference
a plugin setting write
%<plugin>_<setting>%, for example,
%NETGREP_SHORTDESCRIPTION%
- One line description, shown in the TextFormattingRules topic:
- Set SHORTDESCRIPTION = Embed information from other websites, such as document revision date, by applying filters
- Set DEBUG to 1 to get debug messages in
data/debug.txt. Default: 0
- Refresh rate in minutes for cached feeds. Disable caching:
0, default: 30
- Font size of displayed result. Default:
smaller
- Font color of displayed result. Default:
black
- Use LWP::UserAgent, or fallback to TWiki's internal
getUrl() method. Default: yes
- Set USELWPUSERAGENT = yes
Known issues
- Topic load time depends on time it takes to load the filtered source. Performance can be improved by using parameter REFRESH.
- This plugin uses the undocumented
TWiki::Net::getUrl() function. The plugin might break in a future TWiki release.
- URLs on virtual hosts cannot be read. This is a limitation of
TWiki::Net::getUrl()
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 server where TWiki is running.
- Download the ZIP file from the Plugin web (see below)
- Unzip
NetgrepPlugin.zip in your twiki installation directory. Content: | File: | Description: |
data/TWiki/NetgrepPlugin.txt | Plugin topic |
lib/TWiki/Plugins/NetgrepPlugin.pm | Plugin Perl module |
- Visit
configure in your TWiki installation, and enable the plugin in the {Plugins} section.
Test if the plugin is correctly installed:
- Two examples should show
error handling tables, like in the above examples:
%NETGREP{}%
%NETGREP{ href="http://"}%
-
date rendered in smaller font should be shown instead of plugin's NETGREP tag, like in above example:
%NETGREP{ href="http://www.w3.org/TR/CSS2/" filter="(
W3C Working Draft \d+ \w+ \d+)" format="+0+" }%
-
last edited and a date in green color and smaller font should be shown instead of plugin's NETGREP tag, like in above example:
%NETGREP{ href="http://www.dwheeler.com/essays/scm-security.html" filter="(Revised \w+ \d+\, \d+)" format="+0+" color="green" size="larger" }%
Plugin Info
Related Topics: TWikiPreferences,
TWikiPlugins