Difference: RevisionLinkPlugin ( vs. 1)

Revision 12006-05-17 - Main.TWikiContributor

Line: 1 to 1

Revision Link Plugin

This plugin enables the author of a TWiki page to specify a particular version of a topic to link to. You can use also negative numbers when specifying the revision number.

Some examples of how the plugin works when installed.

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

%REV{"WebHome" web="TWiki" rev="1.1" format="$web.$topic(rev=$rev)"}% becomes WebHome(1.1)

Syntax Rules

%REV{"1"}% Points to current topic in specified revision, 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.1"}% Points to specified topic in specified revision
%REV{rev='1.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' format='$web.$topic(rev=$rev)'}% Same as above but using [] and '' syntax

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

If you want to add this plugin to metadata than you can use character [ ] instead of { } and ' ' instead of " ". These characters should not be in conflict with the syntax of metadata. The plugin is is very forgiving with syntax and accepts a mix of "" and '' syntax for the attributes. Space is not allowed round the =.

Revision can be either in TWiki4 format (1, 2, 3,...) or the old Cairo syntax (1.1, 1.2, 1.3, ...). In TWiki4 the revision is written the same way as you write it. In Cairo the 1.X format is always displayed.

Syntax and variables in 'format' attribute

You can use these variables: $web, $topic, $rev, $date, $user, $comment.

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.1" format="| $date | $user | !$web.$topic(rev=$rev)! | $comment |"}%.


RevisionLinkPlugin(1) Points to current topic in specified revision
RevisionLinkPlugin(1.1) Points to current topic in specified revision
RevisionLinkPlugin(1) Points to current topic in revision which was two times back
CommentPlugin(3) Points to specified topic in specified revision
CommentPlugin(10) Points to specified topic in revision which was two times back
WebHome(1.1) Points to specified topic in web
TWiki.WebHome(rev=1.1) Points to specified topic in web and formats the output

Example of more complex format attribute:

965291838 PeterThoeny TWiki.WebHome(rev=1) none

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

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

Plugin Info

Plugin Author: TWiki:Main.RichardBaar, TWiki:Main.KennethLavrsen
Copyright: © 2003 TWiki:Main.RichardBaar, 2006 TWiki:Main.KennethLavrsen
License: GPL (GNU General Public License)
Plugin Version: 2.1 (12904)
Change History:
<-- versions below in reverse order -->
16 Feb 2007 (2.1)
SVN 12904
Fixed bug when having more than one REV tag in same topic
18 May 2006 (2.0)
SVN 10228
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
TWiki Dependency: $TWiki::Plugins::VERSION 1.0
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005  
Benchmarks: Author does not have test environment. Feel free to add them
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/RevisionLinkPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/RevisionLinkPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/RevisionLinkPluginAppraisal

Related Topics: TWikiPreferences, TWikiPlugins

This work was sponsored by Systinet Corp.

This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.RevisionLinkPlugin