[pmwiki-users] links automatically display page title
Peter Bowers
pbowers at pobox.com
Sat Jan 15 08:34:56 CST 2011
On Sat, Jan 15, 2011 at 1:19 PM, Markus Heinzer <keusen at gmail.com> wrote:
> Hello to all
> Could somebody give me a hint to the construction of a wiki markup that will
> work like this:
> Links like [[TargetPage]] display automatically the title of the linked
> page, like [[TargetPage|+]] would.
> Links like [[TargetPage|Target]] still display "Target" (normal pmwiki
> behaviour).
This is copied from the [[+ rule in stdmarkup.php:
Markup('[[|+', '<[[|',
"/(?>\\[\\[([^|\\]]+))\\|\\s*\\+\\s*]]/e",
"Keep(MakeLink(\$pagename, PSS('$1'),
PageVar(MakePageName(\$pagename,PSS('$1')), '\$Title')
),'L')");
So something like this should theoretically work (just changed the
pattern to not look for "|+"):
Markup('[[title', '<[[|',
"/(?>\\[\\[([^|\\]]+))\\s*]]/e",
"Keep(MakeLink(\$pagename, PSS('$1'),
PageVar(MakePageName(\$pagename,PSS('$1')), '\$Title')
),'L')");
Of course you're going to have to disable the "[[" rule so they don't
fight over the free links... Search for DisableMarkup() for that -- I
think it's as simple as:
DisableMarkup('[[');
-Peter
More information about the pmwiki-users
mailing list