[pmwiki-users] Tring to resplace Author link [[~author]], won't come out right

Chuck Goldstein cgpmw13 at codingmaniac.com
Fri May 5 12:34:54 CDT 2017


On 05/03/2017 17:06, ccox at endlessnow.com wrote:
> So, the author link markup is defined in scripts/author.php
>
> So I figured I could just copy what was there and make some changes in
> my config.php (adding action=browse):
>
>
> SDV($AuthorGroup,'Profiles');
> Markup('[[~','<links','/\\[\\[~(.*?)\\]\\]/',"[[$AuthorGroup/$1?action=browse|$1]]");
>
>
> But inside of PageActions wehre there is:
>
> * %item rel=nofollow class=profile   accesskey="$[ak_profile]"%''
> [[~{$Author} | Welcome {$Author} ]]''
>
> I end up seeing:
>
> Welcome author ?action=browse|author | Welcome author/
>
> /Instead of just:
>
> Welcome author
>
> which is what I see without my override.
>
> Any ideas on how to fix this?
>
>
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users

The problem is that the pattern extracts everything between '~' and ']]' 
into $1.  Your replacement assumes that $1 contains only the author.

The most reasonable solution is to place the '?action=browse' in 
PageActions:

> Markup('[[~','<links','/\\[\\[~(.*?)\\]\\]/',"[[$AuthorGroup/\$1]]");
>
> [[~{$Author}?action=browse | Welcome {$Author} ]]

If you really want to do this in the Markup rule:

> Markup('[[~','<links','/\\[\\[~([^\]|]*)(.*?)\\]\\]/',"[[$AuthorGroup/\$1?action=browse\$2]]");
>
> [[~{$Author} | Welcome {$Author} ]]


Chuck G





More information about the pmwiki-users mailing list