Tags:
import1Add my vote for this tag search2Add my vote for this tag create new tag
, view all tags

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

NETGREP Plugin Error
NetgrepPlugin: href parameter (source) is missing

NETGREP Plugin Error
NetgrepPlugin: filter parameter is missing

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
    • Set DEBUG = 0

  • Refresh rate in minutes for cached feeds. Disable caching: 0, default: 30
    • Set REFRESH = 30

  • Font size of displayed result. Default: smaller
    • Set SIZE = smaller

  • Font color of displayed result. Default: black
    • Set COLOR = gray

  • 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

Plugin Author: TWiki:Main.ToniPrug
Copyright: © 2005 TWiki:Main.ToniPrug
© 2005-2010 TWiki:TWiki.TWikiContributor
License: GPL (GNU General Public License)
Plugin Version: 2010-12-14 (V1.1)
Change History:  
2010-12-14: TWikibug:Item6530: Fix for TWiki-5.0; add USELWPUSERAGENT setting; doc improvements; changing TWIKIWEB to SYSTEMWEB (V1.1) -- TWiki:Main.PeterThoeny
2005-07-14: Initial version (V1.0)
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.008
TWiki:Plugins/Benchmark: GoodStyle 100%, FormattedSearch 100%, NetgrepPlugin 99%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/NetgrepPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/NetgrepPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/NetgrepPluginAppraisal

Related Topics: TWikiPreferences, TWikiPlugins

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatmd5 NetgrepPlugin.md5 r3 r2 r1 manage 0.2 K 2010-12-15 - 05:55 PeterThoeny  
Compressed Zip archivetgz NetgrepPlugin.tgz r3 r2 r1 manage 7.2 K 2010-12-15 - 05:55 PeterThoeny  
Compressed Zip archivezip NetgrepPlugin.zip r7 r6 r5 r4 r3 manage 8.7 K 2010-12-15 - 05:55 PeterThoeny  
Unknown file formatEXT NetgrepPlugin_installer r2 r1 manage 3.4 K 2010-12-15 - 05:55 PeterThoeny  
Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r11 - 2013-10-16 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2015 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.