[pmwiki-users] custom markup/regular expression help

John Rankin john.rankin at affinity.co.nz
Thu Apr 27 18:05:01 CDT 2006


On Thursday, 27 April 2006 11:06 PM, Bronwyn Boltwood <bronwyn at bronwynb.info> wrote:
>On 27 Apr 2006 12:15:53 +1200, John Rankin <john.rankin at affinity.co.nz> wrote:
>> On Thursday, 27 April 2006 10:29 AM, J. Meijer <commentgg at hotmail.com> wrote:
>> >>From: "Bronwyn Boltwood" <bronwyn at bronwynb.info>
>> >>Date: Wed, 26 Apr 2006 15:48:41 -0400
>> >>
>> >>Hm.  How about these instead?
>> >>
>> >>  ;application text;
>>
>> This one could give unexpected results; sometimes you might see odd output;
>> but it may not be a problem, depending on the nature of the content and
>> writers' facility with the semicolon.
>
>I agree that semicolons could have some strange effects, but they are
>simple, which is really important in this case.  And as a trained
>writer, I know how they should be used; they should be used to connect
>what would normally be two separate but very closely related
>sentences.  

As long as you are the only writer, that's OK then. I didn't intend
to imply you were unaware of correct usage; my apologies if I gave
that impression.

>So, the markup could check for (1) no whitespace between
>the initial semicolon and the text, and (2) whitespace after the final
>semicolon.  Normal semicolon use should not fit this pattern. Would
>that resolve the problem?

(1) yes but (2) maybe not. A space normally follows a semicolon, so 
rule 2 doesn't add anything unique and it prevents you from following
;text; markup with a .,;:'"?! mark.

Try it with just rule 1:

    '/;([^\s].*?);/' -> '<span class="xxx">$1</span>' (or equivalent)

Hope this helps.

-- 
JR
--
John Rankin






More information about the pmwiki-users mailing list