Hi, I'm back to the Internet.

I've fixed some little bugs in the WikiCreole plugin. One of them was
hard to fix: I'm trying to match two end of paragraph tags (</p>)
separated by one end of line, and remove one of them:

bla bla bla.</p>
</p>

That happens when [(include)] is called in its own paragraph. I could
use %%[(include)]%%  instead (a trick explained in the WikiCreole
plugin), but I can not ask the editor to do that. I'm searching for a
transparent solution.

I can match </p> followed by an end of line, but not the following </
p>. These are my tries:

MarkUp('end', 'paragraphsRemoveP06', '/<\/p>$$$/m', 'WORKS?</p>'); //
yes (same effect than with one $)
MarkUp('end', 'paragraphsRemoveP06', '/<\/p>$$/m', 'WORKS?</p>'); //
yes (same effect than with one $)
MarkUp('end', 'paragraphsRemoveP06', '/<\/p>$/m', 'WORKS?</p>'); //
yes
MarkUp('end', 'paragraphsRemoveP06', '/<\/p>$/s', 'WORKS?</p>'); //
yes
MarkUp('end', 'paragraphsRemoveP06', '/<\/p>$^<\/p>/m', 'WORKS?</
p>'); // no
MarkUp('end', 'paragraphsRemoveP06', '/<\/p>$^<\/p>/s', 'WORKS?</
p>'); // no
MarkUp('end', 'paragraphsRemoveP06', '/<\/p>\n*/m', 'WORKS?</p>'); //
yes
MarkUp('end', 'paragraphsRemoveP06', '/<\/p>\n*<\/p>/m', 'WORKS?</
p>'); // no, WHY?!
MarkUp('end', 'paragraphsRemoveP06', '/<\/p>\n/m', 'WORKS?</p>'); //
yes (Unix end of line)
MarkUp('end', 'paragraphsRemoveP06', '/<\/p>\n<\/p>/m', 'WORKS?</
p>'); // no, WHY?!
MarkUp('end', 'paragraphsRemoveP06', '/<\/p>\n\n/m', 'WORKS?</p>'); //
no
MarkUp('end', 'paragraphsRemoveP06', '/<\/p>\r/m', 'WORKS?</p>'); //
no
MarkUp('end', 'paragraphsRemoveP06', '/<\/p>\r\n/m', 'WORKS?</p>'); //
no (Windows-DOS end of line)
MarkUp('end', 'paragraphsRemoveP06', '/<\/p>^<\/p>/m', 'WORKS?</
p>'); // no

I wonder why the tries marked with "WHY?" don't work. They do work
when I test them using the following online tester:

http://regexpal.com/

At the end I found a simpler solution. I modified this:

MarkUp('fmt', 'paragraphs', '/(.+?)(\n|$)(\n|$)+/s', '<p>$1</p>
$2'); // main rule to create paragraphs

This way:

MarkUp('fmt', 'paragraphs', '/(.+?)(\n|$)(\n|$)+/s', '<p>$1</p>'); //
main rule to create paragraphs

Now no </p> tag is followed by an end of line and one of the current
simple substitutions does the job:

$BOLTreplaceTable['HTML']['in'][] = '</p></p>';
$BOLTreplaceTable['HTML']['out'][] = '</p>';

But anyway I wonder about matching two texts separated by an end of
line. Any regex expert out there? Or is it something related to the
MarkUp function?

Cheers,
Marcos

--
http://alinome.net
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to