key Log In or Register to edit

Find Elsewhere Plugin

This plugin will automatically link to another web(s) if a topic isn't found in the current web.

This is useful for a TWiki site that wants to implement a glossar/dictionary web where common terms are defined and stored. Without this plugin:

  • Each web would need to create their own topic for a common term
  • Link to or INCLUDE the topic from where it is defined
  • Authors need to remember to put the Web name in front of the topic name, such as TWiki.WikiWord

Without this kind of plugin, it's likely that common terms used within an organization will be defined in multiple webs or the common terms will be unlinked wiki words (as if they didn't exist).

Syntax Rules

No new rules are introduced. However, new automatic Wiki Word linking will occur.

If a topic is not found in the current web, this plugin will look through the webs listed in the LOOKELSEWHEREWEBS variable. If the topic is found (as it looks through the webs in their listed order), it will create one or more links, depending on the number of topics found.

New functionality, single hit

Test case Input Output
(if installed)
Expected
Found here WebHome Web Home Web Home
Found singular here WebHomes Web Homes WebHomes
Found elsewhere TWikiAdminGroup T Wiki Admin Group? TWikiAdminGroup
Found singular elsewhere TWikiAdminGroups T Wiki Admin Groups? TWikiAdminGroups
Found elsewhere, spaced wiki word [[TWiki admin group]] TWiki admin group? TWiki admin group
Found elsewhere, abbrev ACRONYM ACRONYM (If ACRONYM is a topic defined in one of the LOOKELSEWHERE webs, a link to it should show up)
Escaped with <noautolink> <noautolink> TWikiAdminGroup </noautolink> TWikiAdminGroup TWikiAdminGroup (Note: FindElsewherePlugin doesn't support <noautolink> in Cairo; TWikiAdminGroup will be found anyway if you're in this codebase)

New functionality, multiple hits

If a word is found in two or more LOOKELSEWHERE webs, a special syntax is used:

  • Standard WikiWord: TWikiPreferences(TWiki,Main)
  • [[Spaced wiki word]]: TWiki preferences(TWiki,Main)

Create this table in Sandbox.FindElsewherePluginTest? to try it out:

| *Test case* | *Input* | *Output<br/>(if installed)* | *Expected* |
| Found elsewhere | <nop>TWikiPreferences | TWikiPreferences | <nop/>TWikiPreferences<sup>([[%TWIKIWEB%.TWikiPreferences][%TWIKIWEB%]],[[%MAINWEB%.TWikiPreferences][%MAINWEB%]])</sup> |
| Found elsewhere, spaced wiki word | [<nop/>[TWiki preferences]] | [[TWiki preferences]] | <em>TWiki preferences</em><sup>([[%TWIKIWEB%.TWikiPreferences][%TWIKIWEB%]],[[%MAINWEB%.TWikiPreferences][%MAINWEB%]])</sup> |

Internationalization

FindElsewherePlugin handles international characters (I18N) in links, topics and webs.

Don't break other types of links

Input Output
FindElsewherePlugin#TopicAnchor Find Elsewhere Plugin # New Functionality Test
TWiki.WebHome Web Home
WebHome Web Home
[[TWiki.WebHome]] TWiki.WebHome
[[TWiki.WikiWord]] TWiki.WikiWord
[[TWiki.WikiWords]] TWiki.WikiWords
TWiki.WikiWord Wiki Word
TWiki.WikiWords Wiki Words
[[Main.TWikiAdminGroup][This is a link to TWikiAdminGroup in Main]] This is a link to TWikiAdminGroup in Main

FindElsewherePlugin Hints

  • You can en- or disable this plugin for webs, topics or users, using the standard TWiki preferences hierarchy
  • You can avoid single words being looked up by using !DontLookup or <nop/>DontLookup syntax
  • "Groups of webs" can use each other as lookup webs, by setting the LOOKELSEWHEREWEBS variable accordingly in their WebPreferences.

FindElsewherePlugin Settings

  • One line description, is shown in the Text Formatting Rules topic:
    • Set SHORTDESCRIPTION = Create links by looking first in the current web, then in a predefined list of other webs

  • Disable look elsewhere - sitewide (here), per web (in WebPreferences) or pr. topic
    • Set DISABLELOOKELSEWHERE = 0

  • List other webs in which to look for topics that don't exist in the current web
    • Set LOOKELSEWHEREWEBS = TWiki, Main

  • If the Wiki Word is plural but doesn't exist, also look for the singular word. Note this setting is for looking in other webs only (plural to singular is still automatically done in the current web).
    • Set DISABLEPLURALTOSINGULAR = 0

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

Plugin Installation Instructions

  • Download the ZIP file from the Plugin web (see below)
  • Unzip FindElsewherePlugin.zip in your twiki installation directory. Content:

File: Description:
data/TWiki/FindElsewherePlugin.txt Plugin topic
lib/TWiki/Plugins/FindElsewherePlugin.pm Plugin Perl module

Plugin Info

Plugin Author: TWiki:Main.MikeBarton
Change History:  
20-Apr-2006: (v1.9) - Now repects <noautolink> ... </noautolink> blocks (Dakar only) and a new NOAUTOLINK preference flag
07-Apr-2006: (v1.8) - Replaced direct usage of %regex with TWiki::Func::getRegularExpression(), replaced some implicit scalar references with explicit $ notation
08 Apr 2005: (v1.7) - Negated vars DISABLELOOKELSEWHERE and DISABLEPLURALTOSINGULAR can now be set per web (WebPreferences) or per topic.
05 Apr 2005: (v1.6) - Bugfix: Preambles for ACRONYMS were doubled.
04 Apr 2005: (v1.5) - Plugin less greedy - now leaves linktext in [[WikiWord][long links with ACRONYMS or WikiWords]] alone
03 Apr 2005: (v1.4) - Documentation update.
02 Apr 2005: (v1.3) - I18N-support added. New link style. TWiki:Codev.WebNameAsWikiName supported
01 Feb 2002: Initial version
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.0
License: GPL (GNU General Public License)
TWiki:Plugins/Benchmark: Good Style 99%, Formatted Search 99%, Find Elsewhere Plugin 99%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/FindElsewherePlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/FindElsewherePluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/FindElsewherePluginAppraisal

Related Topics: T Wiki Preferences, T Wiki Plugins, Default Plugin

-- TWiki:Main.MikeBarton - 1 Feb 2002

 
Ad Sponsor
Back to Redbourn
Copyright © We make no guarantee of the correctness of the content of this site. All material on this collaboration platform is the property of Martin Cleaver and the contributing authors.