[pmwiki-users] automatic link creation

Eemeli Aro eemeli at gmail.com
Tue Aug 25 16:57:41 CDT 2009

2009/8/26 adam overton <a at plus1plus1plus.org>:
> i would like to have pmwiki convert certain commonly appearing names
> (or terms, or orgs) into a links to the respective person's external
> website.

I'm not aware of any recipe that'll do this, but it is something I've
been thinking of recently of implementing. From my point of view,
however, it's more of a matter of figuring out the best way of
generating and maintaining the list of valid names to link up.

Here's what I am using to make course names at our university link to
their pages:

Markup('[[kurssi]]', '>[[',
  "Keep(MakeCourseLink(\$pagename, PSS('$2'), '$1'), 'L')");
function MakeCourseLink( $pagename, $course, $ignore ) {
  if ($ignore) return $course;
  switch($course) {
    case 'AS-0.1101':
      $tgt = 'http://goblin.tkk.fi/c/';
    case 'AS-84.3145':
      $tgt = 'http://automation.tkk.fi/AS-84-3145';
      $tgt = 'https://noppa.tkk.fi/noppa/kurssi/'
  return MakeLink($pagename, $tgt, $course);

Each course has a code that'll match the regular expression on the
second line, and for most courses the pages are on a common CMS for
them. the backtick ` at the start is to provide a way of escaping the

So for your more general case, you'll need a way to build the regular
expression for finding the names to link, and a way of mapping each
name to a link target.


More information about the pmwiki-users mailing list