Revision Link Plugin
<--
Contributions to this TWiki plugin are appreciated. Please update the plugin page at
http://twiki.org/cgi-bin/view/Plugins/RevisionLinkPlugin or provide feedback at
http://twiki.org/cgi-bin/view/Plugins/RevisionLinkPluginDev .
If you are a TWiki contributor please update the plugin in the SVN repository.
-->
Enable linking to specific topic revisions
Introduction
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 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="TWiki" rev="1" format="$web.$topic(rev: $rev)"}% becomes WebHome(rev: 1)
Syntax Rules
%REV{"1"}% |
Points to current topic in specified revision, TWiki/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 TWiki/TWiki4 format (1, 2, 3,...) or the old Cairo syntax (1.1, 1.2, 1.3, ...). Revision is however always shown in TWiki/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
Example of more complex format attribute:
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 = Enable linking to specific topic revisions
- Debug plugin: (See output in
data/debug.txt )
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 |
- 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-2009 TWiki:Main.KennethLavrsen © 2006-2010 TWiki:TWiki/TWikiContributor |
License: |
GPL (GNU General Public License ) |
Plugin Version: |
2.2 (27 Jan 2009) |
Change History: |
<-- versions below in reverse order --> |
27 Jan 2009 (2.2) |
TWiki:Main.KennethLavrsen Added support for linking to revisions of attachments Removed the odd alternative 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) |
TWiki:Main.KennethLavrsen Fixed bug when having more than one REV tag in same topic |
18 May 2006 (2.0) |
TWiki: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 |
TWiki Dependency: |
$TWiki::Plugins::VERSION 1.0 |
CPAN Dependencies: |
none |
Other Dependencies: |
none |
Perl Version: |
5.008 |
Plugin Home: |
http://twiki.org/cgi-bin/view/Plugins/RevisionLinkPlugin |
Feedback: |
http://twiki.org/cgi-bin/view/Plugins/RevisionLinkPluginDev |
Related Topics: TWikiPreferences, TWikiPreferences, TWikiPlugins
This work was sponsored by Systinet Corp. |