Interwiki Plugin

Write ExternalSite:Page to link to a page on an external site based on aliases defined in a rules topic

Introduction

The InterwikiPlugin links ExternalSite:Page text to a page on an external site based on aliases defined in the InterWikis topic. This plugin is inspired by UseMod Wiki's inter-wiki links, https://www.usemod.com/cgi-bin/wiki.pl?InterWiki.

Syntax Rules

  • Enter ExternalSite:Page to create a link that points to the Page on the ExternalSite server. For example, type RFC:2397 to get RFC:2397.
  • Enter [[ExternalSite:Page][any label]] to specify a custom label.
  • All ExternalSite aliases are defined in the InterWikis topic.
  • Optionally, the Page can be enclosed in single quotes or double quotes. Use quotes if your Page contains spaces or other special characters. Links of quoted pages are URL encoded. Example: Photos:"San Francisco Trip 2011".
  • Add and edit aliases in InterWikis (or the one specified in the INTERWIKIPLUGIN_RULESTOPIC setting).
  • Each entry must be of format:
    | External site alias | URL | Tooltip help text |
  • Site aliases must start with an upper case letter and may contain alphanumeric letters.
  • The URL and Tooltip Text may contain optional $page variables; the variable gets expanded to the page name.
  • HELP For TWiki sites, both the web and the topic have to be specified: TWikisite:Webname/SomePage

InterwikiPlugin Settings

This plugin can be configured with preferences settings in Main.TWikiPreferences (site level), a WebPreferences (web level) or in a topic (page level). Do not change the settings here, they are here only to illustrate the default values. To overload, copy the settings to one of the aforementioned topics.

  • Link rules topic name: (default is %SYSTEMWEB%.InterWikis, pointing to InterWikis)
      * Set INTERWIKIPLUGIN_RULESTOPIC = %SYSTEMWEB%.InterWikis, %WEB%.InterWikis, AnotherWeb.CustomInterWikis

  • Inter-link format, with variables:
    $site Site alias
    $page Page (part after colon)
    $url Site URL (might contain $page)
    $label Equal to $site:$page
    $tooltip Tooltip message

      * Set INTERWIKIPLUGIN_INTERLINKFORMAT = <a href="$url" title="$tooltip" class="interwikiLink"><noautolink>$label</noautolink></a>

Plugin Installation Instructions

This plugin is pre-installed. TWiki administrators can upgrade the plugin as needed on the TWiki server.

  • Download the ZIP file from the TWiki:Plugins web (see below)
  • Unzip InterwikiPlugin.zip in your TWiki installation directory. Content:
    File: Description:
    data/TWiki/InterwikiPlugin.txt Plugin topic
    data/TWiki/InterWikis.txt Link rules topic for inter-site links
    lib/TWiki/Plugins/InterwikiPlugin.pm Plugin Perl module
  • Test: If the Plugin is correctly installed, this Wiki:InterWiki link should point to https://c2.com/cgi/wiki?InterWiki topic - try it out.

Plugin Info

  • One-line description, shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Write ExternalSite:Page to link to a page on an external site based on aliases defined in a rules topic

Plugin Author: TWiki:Main/AndreaSterbini, TWiki:Main/PeterThoeny
Copyright: © 2001-2009 Andrea Sterbini,
© 2001-2018 Peter Thoeny, TWiki.org,
© 2001-2018 TWiki:TWiki/TWikiContributor
License: GPL (GNU General Public License)
Plugin Version: 2018-07-05
2018-07-05: TWikibug:Item7841: Copyright update to 2018
2017-08-12: TWikibug:Item7703: Change inter-wiki rule for TWikibug: from https://develop.twiki.org/~twiki/cgi-bin/view/Bugs to https://develop.twiki.org/do/view/Bugs/
2016-01-08: TWikibug:Item7708: Copyright update to 2016
2015-06-18: TWikibug:Item7568: Add "Map" rule to point to Google maps
2015-02-02: TWikibug:Item7610: Change URL of TWikibug interwiki rule from /~twiki4/ to /~twiki/ (server migration)
2015-01-10: TWikibug:Item7604: Switch from GPL v2 to v3
2014-10-03: TWikibug:Item7368: More descriptive SHORTDESCRIPTION
2013-02-22: TWikibug:Item7161: Fast CGI/mod_perl unfriendly-ness fixed -- TWiki:Main.HideyoImazu
2013-02-12: TWikibug:Item7144: Add external link icons if $cfg{Links} is present -- TWiki:Main.MahiroAndo
2013-01-28: TWikibug:Item7091: Use TWISTY in installation instructions and change history
2012-10-25: TWikibug:Item6979: Enhance INTERWIKIPLUGIN_RULESTOPIC to accept multiple topics and to deal with variable expansion -- TWiki:Main.MahiroAndo
2012-09-05: TWikibug:Item6837: Doc fixes
2010-08-04: TWikibug:Item6786: Fix for TWiki.org specific link fix no longer working as implemented in Item6731 - bug was introduced by Item6731 -- TWiki:Main.PeterThoeny
2010-06-06: TWikibug:Item6701: Adding TWikisvn link rule -- TWiki:Main.PeterThoeny
2010-05-25: TWikibug:Item6731: Small code fixes; documentation of Timothe's enhancements -- TWiki:Main.PeterThoeny
2011-05-25: TWikibug:Item6731: Allow quotes in page pattern, and URL-encode quoted page patterns -- TWiki:Main.TimotheLitt
2010-07-12: TWikibug:Item6521 - add ~ and % to allowed characters in page part of Site:page link
2010-06-23: TWikibug:Item6503 - fix TWiki.org specific TWiki:Web.Topic interwiki links to have .../view/Web/Topic type URLs
2010-05-15: TWikibug:Item6433 - doc improvements; replacing TWIKIWEB with SYSTEMWEB
28 Feb 2009: 17851 - TWikibug:Item5025 - Added = and & to page regex, allowing links such as Site:ID=1234&sel=56
03 Aug 2008: TWiki 4.2.1 release version
22 Jan 2008: TWiki 4.2.0 release version
25 Nov 2007: 15752 - TWikibug:Item5006 - Renamed Bugs rule to TWikibug rule (PTh)
13 Aug 2007: 14545 - TWikibug:Item4451 - Added Bugs: rule (TWiki:Main.CrawfordCurrie)
11 Aug 2007: 14538 - Fixed broken ISBN link (TWiki:Main.PeterThoeny)
08 Nov 2006: 11935 - Added css class="interwikiLink" (TWiki:Main.PeterThoeny)
07 Nov 2006: 11924 - Added INTERLINKFORMAT; removed redundant SUPPRESSTOOLTIP; allow @ signs in page part of interwiki link; support single digit page part (TWiki:Main.PeterThoeny)
26 Feb 2005: 1.008 TWiki:Main.CrawfordCurrie cleaned up code and made Dakar-ready
25 Aug 2004: 1.005 TWiki:Main.PeterThoeny updated InterWikis link rules (no code change)
09 Mar 2004: Internal changes: Use only official TWiki::Func Plugin API; for increased speed, moved Interwiki link handling from outsidePREHandler to startRenderingHandler
16 Feb 2004: Support [[Site:Page][label]] Interwiki links (PTh); use TWiki::Func interface for I18N regular expressions (Walter Mundt)
18 Jan 2003: Allow number sign # in Page name (PTh)
31 Aug 2002: Allow percent sign % in page name (PTh)
27 Jul 2001: Allow numbers 0-9 in site name
26 Jul 2001: Fixed alternating missed link bug due to greedy $postfixPattern (fix by Richard Donkin)
14 Jul 2001: Changed to plug & play
16 Jun 2001: Made tooltips optional; prevent Module::Sub type of link
12 Jun 2001: Added optional tool tips (IE only); added the link rules topic name variable; added flexible link patterns; optional $page in URL
10 Jun 2001: Changed rules topic to table-based syntax
20 Feb 2001: TWiki:Main.AndreaSterbini, TWiki:Main.PeterThoeny - Initial version
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.0
Benchmarks: GoodStyle 100%, FormattedSearch 98%, InterwikiPlugin 98%
Plugin Home: https://TWiki.org/cgi-bin/view/Plugins/InterwikiPlugin
Feedback: https://TWiki.org/cgi-bin/view/Plugins/InterwikiPluginDev
Appraisal: https://TWiki.org/cgi-bin/view/Plugins/InterwikiPluginAppraisal

Related Topics: TWikiPlugins, DeveloperDocumentationCategory, AdminDocumentationCategory, TWikiPreferences, InterWikis

Edit | Attach | Watch | Print version | History: r28 < r27 < r26 < r25 < r24 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r28 - 2018-07-06 - TWikiContributor
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.InterwikiPlugin.