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

Waylan Limberg waylan at gmail.com
Wed Nov 9 12:54:48 CST 2005

On 11/9/05, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> 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'
>     rel='nofollow'>\$LinkText</a>";
> where $LinkAlt ends up containing the text inside the quotes.
> See http://www.pmwiki.org/wiki/Test/LinkTitles for
> a demonstration.
Excellent! However, without it working for page links, it is of little
use to me. And as far as that goes, the title of the page seems more
practical. Why should I type the title in each time I link to the page
when I have a page title anyway. (I'm using my EditTitle recipe which
requires every page to have a title)

Although, I have noticed that the title does not come through on all
links only some (the others get the page name), and I can't seem to
identify any consistent pattern to narrow down the cause. For an
example see this page: http://warrenforestcourt.org/Rules/Rules.
Navigate through the trail and note the titles on the sidebar, the
trail links and in the page content as you move from page to page.
When you get to the third page, you should note that the title to the
"| Rules |" link in the trail losses the title but does not on the
sidebar. As you continue, you'll see some other anomalies which I
don't recall at the moment.

> > 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
> function.
I kind of figured. Thanks for the pointers. I think at this time I'll
just leave the action links alone. But I would like the page links to
work consistently when using the page title.

Waylan Limberg
waylan at gmail.com

More information about the pmwiki-users mailing list