[pmwiki-users] Default styling of links to non-existent pages

christian.ridderstrom at gmail.com christian.ridderstrom at gmail.com
Sat Jan 28 04:34:53 CST 2006


On Fri, 27 Jan 2006, Patrick R. Michaud wrote:

> On Fri, Jan 27, 2006 at 11:10:21PM +0100, christian.ridderstrom at gmail.com wrote:
> > On Fri, 27 Jan 2006, Patrick R. Michaud wrote:
> > 
> > > 5+:  $IMapLinkFmt['http:']     http: links
> > >      $IMapLinkFmt['https:']    https: links
> > >      $IMapLinkFmt['PmWiki:']   links to PmWiki: InterMap shortcut
> > >      $IMapLinkFmt['Cookbook:'] links to Cookbook: InterMap shortcut
> > 
> > Would it be possible to replace the format string with a hook if so
> > desired?  Perhaps I could then use that for my 'uploads:'-links (see my
> > other rather long post). The hook function that I supply would then check
> > if the uploaded file exists, and return either a customized format string,
> > or simply the relevant HTML depending on this condition.
> 
> There's already a hook -- that's what the $LinkFunctions array does. :-)

Yes, I know about that hook, but the solution feels a bit crude to me. In
order to use it, I will have to override the entire function for an entire
class of links, while I just might want to do something for some of the
links. This is more of a gut feeling righ now than a concrete reason
though...

The $LinkFunctions at wiki.lyx.org refers to the following functions:

* LinkHTTP() - for http: and https:

* LinkIMap() - for mailto:, ftp:, news:, gopher:, nap:, file:, <:page>,
		   ThisSite:, ThisGroup:, Devel:
  where 'Devel:' refers to a different field.

* LinkUpload - for Attach:

* LinkMyUploads - for uploads:

Btw, I assume that '<:page>' stands for handling normal links such as
[[SomePage]]?  (This info about $LinkFunctions and link handling should be
documented somewhere on PmWiki I think).

Maybe this is an example... if I'd like to treat and/or format links going
to (http/https/ftp)://*.lyx.org in a special manner, I'd have to replace
the corresponding entries in $LinkFunctions with my own hook. 

I could now let the hook implement the funcionality of LinkHTTP()  and
LinkIMap(), or I could let the hook modify the arguments and then invoke 
either LinkHTTP() or LinkIMap() depending on the type of link.

Guess my gut feeling comes from writing my own function to replace
LinkUpload(), probably because I'm mostly just repeating the functionality
of that function...

I'll take a lot at how the link handling works and then get back with more 
questions.

/Christian

-- 
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr






More information about the pmwiki-users mailing list