01095: alternative link text in category markup
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: link text. The [[!Topic]]s variant ignores the suffix: Topics.
* [[!Topic]] * [[!(Some)Topic]] * [[!Topic |link text]] * [[!Topic"Subject"|with tooltip]] * [[!Topic]]Suffix * [[!Topic|+]] * [[!Topic|#]]
[[!Topic|#]] links to PITS/Topic and not to Category/Topic. It works on my own wiki. --Petko January 01, 2022, at 07:41 PM
Several extensions to the category shortcut are possible:
- [[!Topic |link text]]
- [[!Topic |+]]
- [[!Topic |#]]
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
The only way this could be used would be to introduce another element into the markup which would indicate which $XyzFmt to use:
[[^1^Topic]] or [
[[^1^Category.Topic|link text]] could both use $LinkFmt. This would not necessarily have to be a "visible" markup which authors use since the markup rule above could produce it:
$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
$CategoryGroup and a single set of markups could handle all of them with flexibility? The extension could be $LinkFmt['~'] would be null and $LinkGroup['~'] would hold 'Profile'... This could be a pretty generic and flexible and standard way of handling links with prefixes without risking some of them not responding to the |text and another not being aware of the |+ title directive and etc...
Peter Bowers April 30, 2009, at 06:39 AM
I agree with this, especially as it makes markup more consistent. However there is also a deeper problem that should be fixed - PITS:00447