01172: Add "title" attribute to internal links.

Summary: Add "title" attribute to internal links.
Created: 2010-02-22 20:53
Status: Closed - added in 2.2.35
Category: Feature
From: Petko
Priority: 541
Version: 2.2.14


This is a split from PITS:00657 (Add title attributes to external links). Some of the comments suggested title attributes to internal links, intermap links, links to attachments and inline images.

Currently (version 2.2.14) PmWiki can show tooltip titles with the following format:

* [[http://pmwiki.org"PmWiki home" | external link ]], the title is "PmWiki home"
* [[Wikipedia:Wiki"Article on Wikipedia"| InterMap link ]], the title is "Article on Wikipedia"
* [[Attach:000962.png"Uploaded file" | Attach: link]], the title is "Uploaded file".
* Inline image Attach:000962.png"Logo", the alt/title is "Logo".

The only link title format, from the discussed in PITS:00657, and currently not yet implemented, is for titles in internal links. This entry is a discussion about how to best implement this feature.

Note: Links without a link text have their "tooltip title" printed in the page:

* [[http://pmwiki.org"PmWiki home"]]

While this could be fixed in the core, there is a PmWiki convention that in [[...]] links without specified text, everything is printed.

Note: Free external links don't work the same way:

* http://pmwiki.org"PmWiki home"

Comments welcome, especially on how should an external link title be specified. --Petko February 22, 2010, at 09:00 PM

I support a consistent syntax, and a change to the convention, ie [[http://pmwiki.org"PmWiki home"]] displaying as http://pmwiki.org with a tool tip works for me (but I would be happy to have to supply the brackets to declare the link - ie http://pmwiki.org"PmWiki home" displaying as http://pmwiki.org"PmWiki home"

simon October 17, 2010, at 03:30 PM

I don't understand why there is no support for tool tips on internal links. As far as I can see, the text between double quotes is already being captured, thus you can set this working out of the box:

$LinkPageSelfFmt = "<a class='selflink' href='\$LinkUrl' title='\$LinkAlt'>\$LinkText</a>";
$LinkPageExistsFmt = "<a class='wikilink' href='\$LinkUrl' title='\$LinkAlt'>\$LinkText</a>";

Btw, simon suggestion about requiring brackets for tool tips sounds ok to me. It would be something special in [[...]] links, like the parenthesis are. -- simkin October 28, 2011, at 07:48 PM

All links can now have tooltip titles. Previously, only images and external links could have tooltip titles, now this feature is enabled for internal links. To set a tooltip title, add it in quotes after the link address:

  [[Main.HomePage"This is a tooltip title"]]
  [[Main.HomePage"This is a tooltip title"|Home]]
  [[http://www.pmwiki.org"Home of PmWiki"]]
  Attach:image.jpg"Tooltip title of the image"

Introduced in version 2.2.35 (2011-11-11)