AliasPlugin
Define aliases which will be replaced with arbitrary strings automatically
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 link.
Configuration
Configuration of this plugin is done by writing
your aliases into a specific topic, the WebAliases defining the
WebAliases for the current web.
Site-wide aliases can be defined in
SiteAliases.
Definitions are looked up in the given order:
- current topic
- current web's WebAliases
- Main.SiteAliases
Aliases are applied when saving a topic. The original form is encoded together with the replacement. The reverse operation is done before editing the topic.
Syntax
This is the list of tags defined by this plugin.
Name |
Description |
%ALIASES% |
display all aliases |
%ALIASES{regex="on"}% |
display also the regular expression to match the alias |
%ALIASES{"<topic>" merge="on,off"}% |
use aliases defined in <topic> by either merging or redefining the set of current aliases |
%ALIAS{name="..." value="..." [regex="..."]}% |
defines an alias using regex to find it; if regex is not specified it defaults to the alias' name |
%UNALIAS% |
delete all aliases |
%UNALIAS{name="..."}%,%UNALIAS{"..."}% |
deletes one alias |
The
regex
parameter in the %ALIAS{...}% tag might contain the two variables
$start
and
$stop
that help to match the boundaries of an alias consisting of
non-alphabetic characters. Some textile examples:
%STARTSECTION{"textile"}%
%ALIAS{name="''" regex="$start''$stop" value="”"}%
%ALIAS{name="``" regex="$start``$stop" value="“"}%
%ALIAS{name="--" regex=" -- " value=" — "}%
%ALIAS{name="(c)" regex="$start\(c\)$stop" value="©"}%
%ALIAS{name="(r)" regex="$start\(r\)$stop" value="®"}%
%ALIAS{name="(tm)" regex="$start\(tm\)$stop" value="™"}%
%ALIAS{name="..." regex="$start\.\.\.$stop" value="…"}%
%ALIAS{name=",," regex="$start,,$stop" value="„"}%
%ALIAS{name="1/2" regex="$start1/2$stop" value="½"}%
%ALIAS{name="1/4" regex="$start1/4$stop" value="¼"}%
%ALIAS{name="3/4" regex="$start3/4$stop" value="¾"}%
%ENDSECTION{"textile"}%
Defined Aliases
%ALIAS{name="TESTLINK" value="System.WebHome"}%
%ALIAS{name="TESTALIAS" value="yes"}%
%ALIAS{name="rtfm" value="read the fine manual"}%
%ALIASES%
Plugin Installation Instructions
You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.
Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".
If you have any problems, or if the extension isn't available in
configure
, then you can still install manually from the command-line. See
http://foswiki.org/Support/ManuallyInstallingExtensions for more help.
Change History
25 Aug 2011: |
minor compatibility fixes |
09 Nov 2010: |
fixing error using takOutBlocks |
07 Jun 2010: |
don't expand ADDTOZONE/ADDTOHEAD when parsing in alias definitions |
12 Feb 2010: |
compatibility with newer foswiki engines |
17 Nov 2009: |
complete rewrite not to apply aliases during view but during save |
17 Apr 2009: |
converted to Foswiki plugin |
28 Apr 2008: |
speed improvements |
13 Nov 2007: |
Item4959: disabled settings in plugin topic, removed DEFAULT_ALIASES |
14 Sep 2007: |
added view.alias.tmpl |
13 Sep 2007: |
rewrite for modern wiki engines |
10 Feb 2006: |
fixed use of uninitialized value (outch) |
03 Feb 2006: |
prevent nested alias expansion; support convenience aliases for anchors on the same page |
09 Dec 2005: |
added expl icite regex parameter for ALIAS |
06 Dec 2005: |
fixed deprecation warning on a dakar install; added support for non-alphabetical aliases; fixed use of uninitialized values due to special chars in alias patterns; the ALIAS tag in WebAliases can be used to define global aliases now |
27 Apr 2005: |
always read site aliases and then merge in web aliases |
07 Apr 2005: |
Foswiki:Main/MichaelDaum: major rewrite |
30 Mar 2005: |
Foswiki:Main/MichaelDaum: added alias area |
|
added fix to honor order of alias/unalias commands in a topic |
23 Mar 2005: |
Foswiki:Main/MichaelDaum: added list of test-cases |
|
rewrite of substitution code |
|
improved configurability |
22 Mar 2005: |
Foswiki:Main/MichaelDaum: prevent substitutions within html tags, wiki tags and links |
21 Mar 2005: |
Foswiki:Main/MichaelDaum: allow arbitrary string substs |
|
configured via a list now (was tables) |
|
taking care not to replace inside html tags |
1 Dec 2003: |
Foswiki:Main.NielsKoldso: Non WikiWord aliases as an option |
|
More alias prefixes allowed |
16 Oct 2003: |
Speedup |
09 Oct 2003: |
Initial Version |