Summary: alternative link text in category markup
Created: 2009-04-29 22:27
The category link markup ! is a shortcut for links to the
The category markup supports [[!Topic]] and [[!(Some)Topic]] but not variants such as [[!Topic |link text]]. At the moment, this links to a page called Topic in the current group, rather than in the category group: Topic |link text. The [[!Topic]]s variant ignores the suffix: Topics.
Several extensions to the category shortcut are possible:
While these can be added as local customisations if needed, perhaps one or more ought to be supported in the core. The first is the most important, as currently it looks as if it works, but it does not produce the expected result. It uses neither the group nor the link format for category links.
The following markup replaces the current [[!Topic]] markup and solves both that simple case as well as giving the [[!Topic|link text]] case (proposed by jr on the mailing list):
Markup('[[!', '<[[|', "/\\[\\[!([^|\\]]+)(?:\\s*\\|\\s*(.*?)\\s*)?\\]\\]/e", "Keep(MakeLink(\$pagename,PSS('$CategoryGroup/$1'), ('$2' ? PSS('$2') : NULL), '',\$GLOBALS['LinkCategoryFmt']),'L')");
Another markup which is slightly more general purpose but loses $LinkCategoryFmt:
The only way this could be used would be to introduce another element into the markup which would indicate which $XyzFmt to use:
$LinkFmt = $LinkCategoryFmt; Markup('[[!','<[[|+','/\\[\\[\\!(.*?)\\]\\]/',"[[^1^$CategoryGroup/$1]]");
This would require changing several markup rules to be aware of this new prefix...
It would have the benefit of allowing for other $LinkFmt possibilities in the future...
It *seems* like it would be possible to do something where $LinkFmt['!'] held $LinkCategoryFmt and $LinkGroup['!'] held
Peter Bowers April 30, 2009, at 06:39 AM
This is an excellent idea Peter -- I have prototyped something and I'll add it to Subversion right after I release 2.2.14. Then we can test/review/discuss it. --Petko February 26, 2010, at 10:09 PM
I agree with this, especially as it makes markup more consistent. However there is also a deeper problem that should be fixed - PITS:00447
simon December 06, 2009, at 01:55 PM