[Pmwiki-users] transforming + / - lists to *

Knut Alboldt alboldt
Mon Jun 14 09:31:43 CDT 2004


At 16:54 14.06.2004, you wrote:
>At 16:29 14.06.2004, Pm wrote:
>>On Mon, Jun 14, 2004 at 11:29:26AM +0200, Knut Alboldt wrote:
>> > Is there an easy way to transform
>> > +
>> > ++
>> > +++
>> > etc at the beginning of a line to something like
>> > * %green%
>> > ** %green%
>> > *** %green%
>> >
>> > Can this be done by using Double-Brackets or inlinereplacement (in pmwiki
>> > v1.x) ?
>>
>>$DoubleBrackets['/^(\\++)/e'] =
>>   "str_replace('+','*','$1').' %green%'";
>>$DoubleBrackets['/^(-{1,3})/e'] =
>>   "str_replace('-','*','$1').' %red%'";

I refined it a bit (it messed up with more than 3 -):

$DoubleBrackets['/^(-{1,3}[^-]+)/e'] = "str_replace('-','*','$1').' %red%'";


>Wonderful ! No I'll move my text-todo-lists to pmwiki !
>
>>Note that I've limited '-' to three levels, since '----' at the
>>beginning of a line is used for horizontal rules.
>
>Knut




More information about the pmwiki-users mailing list