[wp-trac] Re: [WordPress Trac] #7988: wpautop p (paragraph) bug
with div
WordPress Trac
wp-trac at lists.automattic.com
Tue Oct 28 21:33:06 GMT 2008
#7988: wpautop p (paragraph) bug with div
--------------------------------------------+-------------------------------
Reporter: filosofo | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.7
Component: General | Version: 2.7
Severity: normal | Resolution:
Keywords: wpautop p formatting has-patch |
--------------------------------------------+-------------------------------
Comment (by filosofo):
Replying to [comment:4 azaozz]:
> followed by zero or more space chars (not needed since the `([^<]+)`
will match all space chars),
I had thought that maybe there was a reason for not capturing those space
characters, but I don't see it in later lines.
> It probably should look for </div>, </address> or </form>, then look
behind if the last tag before them was <p> and if yes, close the <p>.
How about this, which I've included in patch wpautop.morespecific.diff:
{{{
$pee =
preg_replace('#<p>\s*?(?!</div|</address|</form)(\S.*)(</(?:div|address|form)[^>]*>)#',
"<p>$1</p>$2", $pee);
}}}
Look for a {{{<p>}}}, perhaps followed by space, followed by a string
that's at least one non-space character that's not the beginning of a
{{{</div>}}}, {{{</address>}}}, or {{{</form>}}}, and that string is
followed by {{{</div>}}}, {{{</address>}}}, or {{{</form>}}}. It also has
the advantage of being able to handle text like 2 < 3.
> Also, not sure what the next line in autop is for:
>
> {{{
> $pee = preg_replace( '|<p>|', "$1<p>", $pee );
> }}}
>
> Doesn't seem to do anything.
Yes, you're right.
Here's the changeset where both these lines came in: [4565]
The odd thing is that these lines don't seem to have anything to do with
the ticket the changeset's supposed to solve, and they're not included in
that ticket's attached patch.
--
Ticket URL: <http://trac.wordpress.org/ticket/7988#comment:5>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list