[pmwiki-users] need help building a markup expression for pagenames
noskule
noskule at gmx.net
Wed Aug 29 13:48:21 CDT 2007
carlos.ab at gmail.com schrieb:
> Em Terça 28 Agosto 2007 19:04, carlos.ab at gmail.com escreveu:
>> Em Terça 28 Agosto 2007 12:54, noskule escreveu:
>>
>> Have you tried ucfirst() function?
>>
>> $MarkupExpr['removespace'] = 'RemoveSpace($args[0])';
>>
>> function RemoveSpace($in) {
>> $out = ucfirst($in);
>> $out = str_replace(" ","" ,$out);
>> return $out;
>> }
>
> Oops!
> I meant ucwords() function.
>
> $MarkupExpr['removespace'] = 'RemoveSpace($args[0])';
>
> function RemoveSpace($in) {
> $out = ucwords($in);
> $out = str_replace(" ","" ,$out);
> return $out;
> }
>
hi carlos
thanks for the code. I checked it and it worked for removing spaces and
capitalize the letter after the space. But special chars are not
removed, so I added a preg-replace
$MarkupExpr['wikiword'] = 'WikiWord($args[0])';
function WikiWord($in) {
$out = ucwords($in);
$out = str_replace(" ","" ,$out);
$out = preg_replace("/[^-\d\w]*/","",$out);
return $out;
}
so far I tested it works, do you think its ok or could it made easyer
grz nos
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>
More information about the pmwiki-users
mailing list