TIP RevisionLinkPlugin is not installed on Foswiki.org.

Revision Link Plugin

This plugin enables the author of a Foswiki page to specify a particular version of a topic to link to. You can use also negative numbers when specifying the revision number which means a revision back in time relative to the current revision.

Some examples of how the plugin works when installed.

%REV{"WebHome" rev="1"}% becomes WebHome(1)

%REV{"WebHome" web="System" rev="1" format="$web.$topic(rev: $rev)"}% becomes WebHome(rev: 1)

Syntax Rules

%REV{"1"}% Points to current topic in specified revision, Foswiki/TWiki4 revision syntax
%REV{"1.1"}% Points to current topic in specified revision, Cairo revision syntax
%REV{"-2"}% Points to current topic in revision which was two times back
%REV{"SomeTopic" rev="1"}% Points to specified topic in specified revision
%REV{rev='1' "SomeTopic"}% Same as above. Syntax is very flexible.
%REV{"SomeTopic" web="AWeb" rev="1"}% Points to specified topic in web
%REV{"SomeTopic" web="AWeb" rev="1" format="$web.$topic(rev=$rev)"}% Points to specified topic in web and formats the output
%REV{"SomeTopic" web="AWeb" rev="1" attachment="filename.png" format="$web.$topic - $attachment(rev=$rev)"}% Points to specified attachment of topic formats the output

You can specify also the topic by topic attribute, i.e. %REV{topic="ATopic" rev="1"}%

Revision can be given as input either in Foswiki/TWiki4 format (1, 2, 3,...) or the old Cairo syntax (1.1, 1.2, 1.3, ...). Revision is however always shown in Foswiki/TWiki4 syntax (without the 1. prefix).

Syntax and variables in 'format' attribute

You can use these variables:

Variable Description
$web The web name for the target topic
$topic The name of the target topic
$attachment The filename of an attachment
$rev The revision of the target topic or attachment
$date The date (in epoch) of the target topic or attachment.
$user The author of the target topic or attachment
$comment The comment given when uploading an attachment

As default the whole string is used as link to appropriate revision. If you write more complex format string and you don't want to link only part of the string encapsulate it with !. Ex. %REV{"ATopic" web="AWeb" rev="1" format="| $date | $user | !$web.$topic(rev=$rev)! |"}%.

Examples

%REV{1}% Points to current topic in specified revision
%REV{"1"}% Points to current topic in specified revision
%REV{"1.1"}% Points to current topic in specified revision (Cairo syntax as input but Foswiki as output)
%REV{"CommentPlugin" rev="3"}% Points to specified topic in specified revision
%REV{"WebHome" web="System" rev="1"}% Points to specified topic in web
%REV{"WebHome" web="System" rev="1" format="$web.$topic(rev=$rev)"}% Points to specified topic in web and formats the output
%REV{"ProjectLogos" web="System" rev="1" attachment="foswiki-logo.png" format="$web.$topic - $attachment(rev=$rev)"}% Points to specified attachment of topic formats the output

Example of more complex format attribute:
%REV{"WebHome" web="System" rev="1" format="| $date | $user | !$web.$topic(rev: $rev)! | $comment |"}%

RevisionLinkPlugin 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 = This plugin enables linking to specific topic revisions.

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

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 Foswiki server.

  • Download the ZIP file from the Plugin web (see below)
  • Unzip RevisionLinkPlugin.zip in your Foswiki installation directory. Content:
    File: Description:
    data/System/RevisionLinkPlugin.txt Plugin topic
    lib/Foswiki/Plugins/RevisionLinkPlugin.pm Plugin Perl module
  • Visit configure in your Foswiki installation, and enable the plugin in the {Plugins} section.
  • Test if the installation was successful:
    • %REV{"1"}%

Plugin Info

Plugin Author: TWiki:Main.RichardBaar, Foswiki:Main.KennethLavrsen
Copyright: © 2003 TWiki:Main.RichardBaar, 2006-2009 Foswiki:Main.KennethLavrsen
License: GPL (GNU General Public License)
Plugin Version: 2.2 (27 Jan 2009)
Change History:  
27 Jan 2009 (2.2) Foswiki:Main.KennethLavrsen
Foswiki version.
Added support for linking to revisions of attachments
Removed the odd altertive square bracket syntax. It is probably few that ever used it because the many past years it has not been a problem using the normal syntax in form fields. The removal of this syntax enabled using the registerTagHandler instead of the much less efficient commonTagsHandler
16 Feb 2007 (2.1) Foswiki:Main.KennethLavrsen
Fixed bug when having more than one REV tag in same topic
18 May 2006 (2.0) Foswiki:Main.KennethLavrsen
updated plugin to Dakar while maintaining Cairo compatibility.
Enhanced the syntax robustness.
Fixed some rendering errors when plugin was used several times on same topic.
Fixed the plugin so only official API is used.
27 Aug 2003 (1.11) Repaired link when "web" attribute specified
14 Aug 2003 (1.1) You can specify revision only with one number (ex. %REV{"5"}%)
You can use negative numbers for revision (ex. %REV{"-2"}%)
Enhanced syntax (added characters [ and ')
Added variables $date, $user and $comment to format attribute
05 Aug 2003 (1.0) Initial version
Foswiki Dependency: $Foswiki::Plugins::VERSION 1.0
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.008
Plugin Home: http://foswiki.org/Extensions/RevisionLinkPlugin
Feedback: http://foswiki.org/Extensions/RevisionLinkPluginDev

Related Topics: DefaultPreferences, SitePreferences, Plugins

This work was sponsored by Systinet Corp.
I Attachment Action Size Date Who Comment
RevisionLinkPlugin.md5md5 RevisionLinkPlugin.md5 manage 177 bytes 27 Jan 2009 - 01:25 KennethLavrsen  
RevisionLinkPlugin.tgztgz RevisionLinkPlugin.tgz manage 6 K 27 Jan 2009 - 01:25 KennethLavrsen  
RevisionLinkPlugin.zipzip RevisionLinkPlugin.zip manage 7 K 27 Jan 2009 - 01:25 KennethLavrsen  
RevisionLinkPlugin_installerEXT RevisionLinkPlugin_installer manage 4 K 27 Jan 2009 - 01:25 KennethLavrsen  
Topic revision: r3 - 02 Feb 2009, KennethLavrsen
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy