Tags:
linking1Add my vote for this tag create new tag
view all tags

Revision Link Plugin

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

%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 TWiki as output)
%REV{"CommentPlugin" rev="3"}% Points to specified topic in specified revision
%REV{"WebHome" web="TWiki" rev="1"}% Points to specified topic in web
%REV{"WebHome" web="TWiki" rev="1" format="$web.$topic(rev=$rev)"}% Points to specified topic in web and formats the output
%REV{"ProjectLogos" web="TWiki" rev="1" attachment="twiki-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="TWiki" 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 = Enable 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
  • Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.
  • Test if the installation was successful:
    • %REV{"1"}%

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:  
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, Main.TWikiPreferences, TWikiPlugins

This work was sponsored by Systinet Corp.

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatmd5 RevisionLinkPlugin.md5 r8 r7 r6 r5 r4 manage 0.2 K 2010-11-11 - 07:43 PeterThoeny  
Compressed Zip archivetgz RevisionLinkPlugin.tgz r8 r7 r6 r5 r4 manage 6.1 K 2010-11-11 - 07:43 PeterThoeny  
Compressed Zip archivezip RevisionLinkPlugin.zip r11 r10 r9 r8 r7 manage 7.7 K 2010-11-11 - 07:43 PeterThoeny  
Unknown file formatext RevisionLinkPlugin_installer r4 r3 r2 r1 manage 3.4 K 2010-11-11 - 07:43 PeterThoeny  
Edit | Attach | Watch | Print version | History: r18 < r17 < r16 < r15 < r14 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r18 - 2018-07-17 - 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-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.