Netgrep Plugin
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 particulary 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.
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 wesbites (document revision date, for example) by using 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
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
| plugin tag | % NETGREP{ href="http://wiki.gnuarch.org/WhyArch" filter="(last edited) ([0-9]+-[0-9]+-[0-9]+)" format"(+1+)" } % |
| displayed output | (2005-03-26) |
| real life use | from http://wiki.gnuarch.org/WhyArch (2005-03-26) list of reasons for using GNU Arch |
| 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 |
| plugin tag | % NETGREP{ href="http://wiki.gnuarch.org/Archive_20Registry" filter="(last edited) (\d+-\d+-\d+)" format="+0+ +1+" size="90%" color="red" } % |
| displayed output | last edited 2005-04-14 |
| real life use | http://wiki.gnuarch.org/Archive_20Registry - last edited 2005-04-14 list of Gnu Arch archives |
missing/wrong parameters
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 |
Test if the plugin is correctly installed:
- two below tags should show
error handling tables, like in the above examples displayed output row
%NETGREP{}%
%NETGREP{ href="http://"}%
-
last edited and a date in green color and smaller font should be shown instead of plugin's NETGREP tag, like in the above examples displayed output row
%NETGREP{ href="http://wiki.gnuarch.org/Archive_20Registry" filter="(last edited \d+-\d+-\d+)" format="+0+" size="smaller" color="green" }%
-
date rendered in larger font should be shown instead of plugin's NETGREP tag, like in the above examples displayed output row
%NETGREP{ href="http://wiki.gnuarch.org/Archive_20Registry" filter="(last edited) (\d+-\d+-\d+)" format="+1+" size="larger"}%
Plugin Info
Related Topics: TWikiPreferences,
TWikiPlugins
--
TWiki:Main.ToniPrug - 18 Jul 2005