[pmwiki-users] [[!topic |link text]]
Peter Bowers
pbowers at pobox.com
Wed Apr 29 15:16:32 CDT 2009
On Wed, Apr 29, 2009 at 4:39 PM, Peter Bowers <pbowers at pobox.com> wrote:
> On Wed, Apr 29, 2009 at 3:37 AM, John Rankin <john.rankin at affinity.co.nz> wrote:
>> Is there a reason why pmwiki.org treats this as
>>
>> [[topic |link text]]
>>
>> (i.e. links to the current group) rather than
>>
>> [[$CategoryGroup/topic |link text]]
Sorry, in my usual inciseful way I appeared to have confused the issue
rather than helping... :-)
>From a functional standpoint John was asking that [[!CatX|text]] be a
link to Category.CatX instead of to just CatX.
I was looking up the markup definitions and comparing how
[[~authorname]] is implemented to how [[!catX]] is implemented.
The former markup (for profiles) generates an intermediate markup
basically replacing the ~ with "Profiles/" (unless the profile group
has been configured otherwise). Thus [[~Abc]] becomes
[[Profiles.Abc]] and [[~Abc|Sam]] becomes [[Profiles/Abc|Sam]]. Then
later rules come in and recognize those as normal links and correctly
replace them with the expected HTML.
However, [[!CatX]] is implemented differently. It has a special
markup just for categories that goes all the way from the source all
the way to the HTML. This works fine in the simple case, but when you
add in alternatives to the markup ([[!CatX|display this]] or
[[!CatX|+]]) then this single markup rule cannot handle everything
that 3 or 4 other markup rules do on normal links. The special thing
that the [[!CatX]] markup does is sets up the HTML with a special
"class=categorylink" for greater flexibility in formatting the link.
If it wasn't for this I think [[!CatX]] could be implemented very
similarly to [[~author]] and get full link functionality on these
category links.
So I was asking if there was some other way to assign that
"class=categorylink" while following the [[~Abc]] pattern of using an
intermediate markup. So [[!CatX]] would no longer go directly to HTML
but would first go to [[Category/CatX]] and then in a second step
(using the other link rules) would go to HTML. This would allow all
the special cases for links to work with categories as well.
I don't know if this clarifies or further muddies the waters...
In few words, this markup in config.php fixes the problem:
Markup('[[!a','<[[|+','/\\[\\[\\!(.*?)\\]\\]/',"[[$CategoryGroup/$1]]");
But it makes non-existent category pages show up with the
question-mark rather than a typical category link.
-Peter
More information about the pmwiki-users
mailing list