[pmwiki-users] Special handling of links (Was: Default styling of links to ..

Patrick R. Michaud pmichaud at pobox.com
Fri Jan 27 16:12:53 CST 2006


On Fri, Jan 27, 2006 at 10:41:15PM +0100, christian.ridderstrom at gmail.com wrote:
> On Fri, 27 Jan 2006, Patrick R. Michaud wrote:
> > default styling of links to non-existent pages, but could use feedback.
> 
> Now, in the general case it's probably not realistic to expect pmwiki.php 
> to go to an arbitrary URI and check if a page exists. There are however 
> some cases where it'd be very useful:
> 
> * The link goes to an uploaded file (e.g. similar to Attach:)
> * The link goes to a local file (e.g. file:...:)
> * The link goes to a wiki page in a different field on the same server
> 
> I have some thoughts on how this can be handled (and perhaps implemented), 
> but first I'd like some thoughts on this in general. 

My primary thought is that "in general" it's very difficult
to establish a good correspondence between url paths and the
filesystem.  It's super-difficult even in PmWiki's limited
cases, the general case is likely to be much more difficult.

That said, we could potentially come up with a new version of
LinkIMap that in addition to holding urls for each scheme could
optionally hold filesystem locations to check for file existence,
and an alternate format to use if the file doesn't exist.  Thus,
we'd have something like

    $IMapFilesystem['uploads:'] = '/path/to/uploads/$1';

and then when formatting a link, it checks for the
existence of the corresponding file in the filesystem and 
chooses a different format string (from another array)
if it doesn't exist.

But keep in mind that this still gets really tricky, or
at least a little ad-hocish.  For example, given an InterMap-link 
to another field on the same server

    OtherField:Main/HomePage

there's not a "Main/HomePage" file that we can accurately test.  
(There's a "Main.HomePage" file, but not "Main/HomePage".)

Still, it's quite a good idea.  I like the fact that it would
be a generalized form of what the uploads code is doing now
(i.e., it's not really "more" code, it's just a refactoring
of existing code).

Pm




More information about the pmwiki-users mailing list