NatsWiki System Managing
Search: 

Navigation

AliasPlugin

Description

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

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.

Syntax

This is the list of TWiki tags defined by this plugin.
NameDescription
%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 ALIAS_WIKI_WORDS_ONLY = 0

  • Set the topic holding some default aliases

Defined Aliases

NameValue
CPhilWeb CPhilWeb
CxGWeb CxGWeb
DawaiWeb DawaiWeb
DisWeb DisWeb
EntiWeb EntiWeb
GirlsDay GirlsDay
InfExWeb InfExWeb
KilianFoth KilianFoth
MachineTranslationWeb MachineTranslationWeb
MainWeb MainWeb
MTSWorkshopWeb MTSWorkshopWeb
MultiModWeb MultiModWeb
NatIntWeb NatIntWeb
NatS NatS
NatsUser NatsUser
NatsUsers NatsUsers
NatsWeb NatsWeb
NatsWebUsers NatsWebUsers
NatsWiki NatsWiki
NatsWikiAdmins NatsWikiAdmins
NatsWikiUser NatsWikiUser
NatsWikiUsers NatsWikiUsers
NatsWikiWeb NatsWikiWeb
NatsWikiWebs NatsWikiWebs
OssWeb OssWeb
PapaWeb PapaWeb
RANLPWorkshopWeb RANLPWorkshopWeb
rtfm read the fine manual
SandboxWeb SandboxWeb
SemanticWeb04 SemanticWeb04
SemWeb SemWeb
SpeakerId SpeakerId
SpeakerIdWeb SpeakerIdWeb
SpeechWeb SpeechWeb
StudienReformAusschuss StudienReformAusschuss
StuKo StuKo
SupportWeb SupportWeb
TESTALIAS GREEN
TESTLINK TESTLINK
TWikiUser TWikiUser
TWikiWeb TWikiWeb
UserWeb UserWeb
WaltherVonHahn WaltherVonHahn
WikiWeb WikiWeb

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 AliasPlugin.zip 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/AliasPlugin.pm Plugin Perl module

  • On TWiki/Dakar: Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section. 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?)

Test-Cases

 PatternSubstitutionCorrectness
1 TESTLINK yes, this is a link to TWiki.WebHome DONE
2 GREEN yes DONE
3 _TESTLINK no, _ is no word boundary DONE
4 TESTLINK_TESTLINK no, _ is no word boundary DONE
5 TESTLINK yes 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 http://nats-www.informatik.uni-hamburg.de/TESTALIAS 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: http://TWiki.org/cgi-bin/view/Plugins/AliasPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/AliasPluginDev

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

r1.38 - 08 Nov 2005 - 17:24 GMT - MichaelDaum
Copyright (c) 1999-2006 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Powered by TWiki/Beijing 01 Feb 2003 (NatsWiki), Syndicate this site.