[pmwiki-users] Link Formats and the title attribute.

Patrick R. Michaud pmichaud at pobox.com
Wed Nov 9 12:16:53 CST 2005

On Thu, Nov 03, 2005 at 01:17:24PM -0500, Waylan Limberg wrote:
> On 11/2/05, Clemens Gruber <cgruber at uni-osnabrueck.de> wrote:
> >
> > PM has added the title-attribute to the img-tag in Version 2.0.beta52
> > (29-Jul-2005), s. http://pmwiki.org/wiki/PmWiki/ChangeLog
> > ...
> > Perhaps you can "steal" her some ideas.
> Thanks for the tip. Actually I was already aware of that, but just
> haven't checked that code out yet. Any idea where it is?
> The problem as I see it is that the MakeLink() function seems to have
> no knowledge of the title attribute. As such there is no easy way to
> pass it in, of have it altered based on some tests etc. 

Actually, the MakeLink() function *does* understand title, it
expects any title to be in quotation marks immediately following 
the link.  Thus   Attach:image.gif"Title", and one can even do
http://www.pmwiki.org/"PmWiki".  I don't think the quotation marks
work for page links yet but I'd have to check.

The MakeLink() function extracts any title and passes it along
as the fourth argument to the appropriate formatting routine
such as LinkPage or LinkIMap.  So, if one wanted a title
attribute to be available in a url link, it can be done with:

  $UrlLinkFmt =  
    "<a class='urllink' href='\$LinkUrl' title='\$LinkAlt' 

where $LinkAlt ends up containing the text inside the quotes.

See http://www.pmwiki.org/wiki/Test/LinkTitles for
a demonstration.

> Does anyone know if I could set a $LinkPageActionFmt or
> something of the sort to address this? Something like:
> $LinkPageActionFmt = "<a class='actionlink' href='\$LinkUrl'
> title='\$Action: \$Titlespaced'>\$LinkText</a>";

This takes a *lot* more work, because it means that PmWiki
must parse out the url being passed in and figure out what 
action is being performed.  At the moment when generating 
links PmWiki just passes any '?' arguments directly to
the browser, it doesn't have to do any interpretation of
them.  However, this could be done with a custom MakeLink


More information about the pmwiki-users mailing list