[Pmwiki-users] PmWiki Free Links

John Rankin john.rankin at affinity.co.nz
Thu Dec 19 14:22:31 CST 2002


I have developed an experimental local customisation to let PmWiki handle =
links other than WikiWords.

If an author writes {{I hope I never}} it turns into a page called I_Hope_=
I_Never in the current group. Group/{{concrete coloured skies}} is a =
reference to a page in another group.

The script does this by redefining $PageNamePattern to be=20
($GroupNamePattern)([.\\/])($MagicWordPattern)

wnere $MagicWordPattern is ($TitleWord)(_($TitleWord))*
and $TitleWord is [A-Z0-9]($AnyLetter*)
and $AnyLetter is [A-Za-z0-9] but could be more flexible

$FreeLinkPattern is {{($AnyLetter+)(\s+($AnyLetter+))*}}

$WikiWordPattern is unchanged. So an author can write ThisGroup/2003 or {{=
2003}}.

It works as is, but 2 additions to PmWiki.php might make it better. A line =
in Anchor that makes references to non-existent pages render as (I hope I =
never)? and a line in AsSpaced that turns "_" into " ".

I would welcome discussion on questions where I have had to make design =
decisions.

1. What should the mark-up be? I decided on {{...}} to link to the =
implementation mechanism which transforms {{free link}} into [[Group/Free_=
Link free link]].

2. What should the wiki name be? I chose title case rather than as-is or =
sentence case to be consistent with the WikiWord theme and so {{free link}}=
 and {{Free Link}} are the same page, but FreeLink is not.

3. What should the rendering be? Is it a problem that FreeLInk and Free_=
Link would appear identical if the author enables wiki word spacing? I =
decided it's not.

4. How free is free? I decided to relax the PageNamePattern by the minimum =
I could think of, rather than the maximum. I figured that this minimises =
the risk of unintended consequences.

5. Do other members of the group have a use for free links?

When I figured out how to do it (after some wrong turns), it was very easy =
to implement. Once again a tribute to the underlying design. Thanks, =
Patrick!

The weather has turned magical in time for Christmas. We're off to the =
beach today or tomorrow. Best wishes.
--=20
John Rankin
Affinity Limited
T 64 4 495 3737
F 64 4 473 7991
021 RANKIN
john.rankin at affinity.co.nz
www.affinity.co.nz






More information about the pmwiki-users mailing list