From the Eliovir

Pm Wiki: Link I Map

This page describes an internal function in PmWiki’s engine called LinkIMap(). The contents are not intended for those with a weak heart ;-) Admins (advanced)

Also see: PmWiki.Functions#LinkIMap, PmWiki.MakeLink

Syntax
  LinkIMap($pagename,$imap,$path,$title,$text,$fmt=NULL)

The function LinkIMap() handles links of the form scheme:path, which includes http:, https:, ftp: as well as the inter map links such as Cookbook:, PmWiki: etc.

The basic markup behind the eventual invocations of this function is as follows:

[[ <target><title> | <link-text> ]]
[[ <link-text>  <target><title> ]]
http://<URI><title>

The arguments to the function are as follows:

The array $IMap is the primary array used by LinkIMap(). It says how to format a URL according to the given scheme. By default, this array is generally set as follows:

	$IMap['http:'] 	    = 'http:$1';
	$IMap['https:']     = 'https:$1';
	$IMap['ftp:']       = 'ftp:$1';
	$IMap['mailto:']    = 'mailto:$1';
        ...
        $IMap['Cookbook:']  = 'http://www.pmwiki.org/wiki/Cookbook/$1';
        $IMap['PmWiki:']    = 'http://www.pmwiki.org/wiki/PmWiki/$1';
	$IMap['Wikipedia:'] = 'http://www.wikipedia.com/wiki/$1'; 

Note that the $1 in each case is used as a placeholder for the path component.

LinkIMap() then uses the value of $UrlLinkFmt to generate the link. The default value of $UrlLinkFmt is as follows:

“<a class=‘urllink’ href=‘\$LinkUrl’ rel=‘nofollow’>\$LinkText</a>”

Then there is also the array $IMapLinkFmt that allows each scheme to have its own custom formatting default. The vanilla version of PmWiki doesn’t use this array yet, although some cookbook recipes probably do.

Examples of custom formats to allow different styling via classes:

Category: PmWiki Internals

Copyright © 2005–2025 the Main wiki and its authors

Retrieved from http://eliovir.free.fr/index.php5/PmWiki/LinkIMap

Page last modified on August 27, 2009, at 02:44 AM EST