[Pmwiki-users] PmWiki Free Links

Patrick R. Michaud pmichaud at sci.tamucc.edu
Thu Dec 19 14:34:12 CST 2002


Can you send me the code for the local customization?  The syntax
looks clean/clever enough that I may just make it an official part
of PmWiki unless I get lots of objections from others.  I hadn't
really thought about just doing a string substitution converting
free links to valid wiki word patterns; I was thinking that I'd have
to modify the wiki word pattern itself.  Very clever!

One question--what if I want a link to {{free link}} page but with
different text?  Would I have to know to use [[Group/Free_Link different
text]]?  I.e., [[{{free link}} different text]] wouldn't work?

Dr. Patrick R. Michaud 
Professor, Department of Computing and Mathematical Sciences
Director, CBI-Division of Nearshore Research
Texas A&M University-Corpus Christi
6300 Ocean Drive, Corpus Christi TX 78412
email: pmichaud at tamucc.edu   voice: 361-825-2751   fax: 361-825-2795

On 20 Dec 2002, John Rankin wrote:

> 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 
> ($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.

More information about the pmwiki-users mailing list