Skip to topic | Skip to bottom
TWiki.AliasPluginr1.1 - 27 Apr 2005 - 12:48 - TWikiGuesttopic end

Start of topic | Skip to actions



This plugin allows you to create arbitrary word aliases. If you write down a word that has a defined alias, it will then be replaced with the given text string. If that string is a string of the format <web>.<topic> it will be replaced by an appropriate TWiki link. Aliases take only effect within the boundaries if alias areas between %STARTALIASAREA% and %STOPALIASAREA% tags.

Aliases aren't replaced within html tags (<html tag ... TESTALIAS ... >), TWiki tags (%INCLUDE... TESTALIAS ...%) and TWiki links ([[TWiki.WebHome][TESTALIAS]]). A word can be prevented of being substituted by prefixing it with <nop>.


Configuration of this plugin is done by writing your aliases into a specific topic which defaults to the topic defined by the DEFAULT_ALIASES variable (see below). This topic is looked up in the current web. If it does not exist in the current web, the plugin will fallback to the DEFAULT_ALIASES in the TWiki. Aliases defined in DEFAULT_ALIASES will be used within the current web. Aliases can be defined temporarily also, that is they will only be taking effect within the current topic. Similarly, aliases can be disabled. See the Syntax section for more details.


This is the list of TWiki tags defined by this plugin.
Name Description
%ALIASES% display all aliases
%ALIASES{"<topic>" merge="on,off"}% use aliases defined in <topic> by either merging or redefining the set of current aliases
%ALIAS{name="..." value="..." }% defines one new alias
%STARTALIASAREA% mark the beginning of an alias area
%STOPALIASAREA% mark the end of an alias area
%UNALIAS% delete all aliases
%UNALIAS{name="..."}%,%UNALIAS{"..."}% deletes one alias

The aliases in the topic DEFAULT_ALIASES can be either defined using the %ALIAS{}% macro or listed in the following way:

   * <name1>: <value1>
   * <name2>: <value2>
   * <name3>: <value3>

Plugin Settings

  • Set SHORTDESCRIPTION = Define aliases which will be replaced with arbitrary strings automatically

  • restrict aliases to WikiWords

  • Set the topic holding some default aliases

Defined Aliases

Name Value
MainWeb MainWeb
rtfm read the fine manual
SandboxWeb SandboxWeb
TWikiWeb TWikiWeb
UserWeb UserWeb

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 in your twiki installation directory. Content:
    File: Description:
    data/TWiki/AliasPlugin.txt Plugin topic
    data/TWiki/WebAliases.txt definition of site-wide aliases
    lib/TWiki/Plugins/ Plugin Perl module

  • On TWiki/Dakar: You might add %STARTALIASAREA% and %STOPALIASAREA% surrounding the %TEXT% tag of the view and preview templates of your TWikiSkins (e.g. view.pattern.tmpl and preview.pattern.tmpl) to enable the AliasPlugin sitewide.

  • On TWiki/Beijing: add the line marked with + to the script bin/view (a similar change must be added to the bin/preview script):
   if( $viewRaw ) {
      $text = &TWiki::Store::readTopicRaw( $webName, $topic );
   } else {
      ( $meta, $text ) = &TWiki::Store::readTopic( $webName, $topic );
+     $text = "%STARTALIASAREA% $text %STOPALIASAREA%";

  • On TWiki/Cairo: either of both might work (can someone confirm?)


  Pattern Substitution Correctness
1 TESTLINK yes, this is a link to TWiki.WebHome DONE
3 _TESTLINK no, _ is no word boundary DONE
4 TESTLINK_TESTLINK no, _ is no word boundary DONE
6 TESTLINKTESTLINK no, this is one word not being aliases DONE
7 read the fine manual yes, but be more polite to your users DONE
8 GREEN this should be a green link to DONE
9 TESTALIAS no, don't substitute inside a TWiki tag DONE
10 TESTALIAS? no, don't substitute inside a TWiki tag DONE
11 [[TESTALIAS]] no, not even inside a nopped TWiki tag DONE
12 GREEN yes, ignores red DONE
13 %TESTALIAS% no, inside two % DONE
14 %TESTALIAS% no, this is inside two % DONE
15 %TESTALIAS% no. inside two % DONE
16 %TESTALIAS% no. inside two % DONE
17 %GREEN yes, no perc on the same line DONE
18 %GREEN yes, with a second % here DONE
19 %BLABLA GREEN% yes, this is no regular TWiki tag DONE
20 %BLABLA{TESTALIAS}% no, this is a regular TWiki tag DONE
21 %BLABLA{TESTALIAS}% no, albeit this is a nopped TWiki tag DONE

Plugin Info

Plugin Author: TWiki:Main/OthelloMaurer, TWiki:Main/MichaelDaum
Plugin Version: v1.1 (27 Apr 2005)
Change History:  
27 Apr 2005 always read site aliases and then merge in web aliases
07 Apr 2005 TWiki:Main/MichaelDaum: major rewrite
30 Mar 2005 TWiki:Main/MichaelDaum: added alias area
  added fix to honor order of alias/unalias commands in a topic
23 Mar 2005: TWiki:Main/MichaelDaum: added list of test-cases
  rewrite of substitution code
  improved configurability
22 Mar 2005: TWiki:Main/MichaelDaum: prevent substitutions within html tags, twiki tags and twiki links
21 Mar 2005: TWiki:Main/MichaelDaum: allow arbitrary string substs
  configured via a list now (was tables)
  taking care not to replace inside html tags
1 Dec 2003: TWiki:Main.NielsKoldso: Non WikiWord aliases as an option
  More alias prefixes allowed
16 Oct 2003: Speedup
09 Oct 2003: Initial Version
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
Plugin Home:

-- TWiki:Main/OthelloMaurer - 09 Oct 2003 -- TWiki:Main/MichaelDaum - 21 Mar 2005
to top

You are here: TWiki > AliasPlugin

to top

All content is Copyright © 1999-2023 by, and the property of, the contributing authors.
Questions, comments, or concerns? Contact GNHLUG
Legal Notice (includes Terms of Service)