<?php if (!defined('PmWiki')) exit();
/**********************************************************************
   Copyright 2004 Mike Ivanov <mike70i@yahoo.com>
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   Copyright 2005 Patrick Michaud <pmichaud@pobox.com>
   -- Improved recipe for PmWiki 2
  
**********************************************************************/

function TitleOf($pagename, $pn) {
  global $PCache;
  $pn = MakePageName($pagename, $pn);
  if( !isset( $PCache[$pn]['title'] ) ) 
    PCache($pn, ReadPage($pn, READPAGE_CURRENT));
  return FmtPageName('$Title', $pn);
}

## [[target |+]]
Markup('[[|+', '<[[|',
  "/\\[\\[([^|\\]]+)\\s*\\|\\s*\\+\\s*\\]\\]($SuffixPattern)/e",
  "Keep(MakeLink(\$pagename,PSS('$1'),
                 TitleOf(\$pagename, PSS('$1')),'$2'),'L')");