Ticket #1170 (closed defect (bug): fixed)
Nested blockquotes unallowed?
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 2.3 |
| Component: | General | Version: | 2.2 |
| Severity: | minor | Keywords: | has-patch commit |
| Cc: |
Description
I want to put nested blockquotes -- which is allowed in XHTML 1.0 (all flavors) -- into a post. However, the blockquote tag is being closed automatically before the nested blockquote tag.
Attachments
Change History
comment:2
anonymousbugger — 7 years ago
The problem is in the wpautop() function in functions-formatting.php
The problem can be circumvented by disabling "WordPress should correct invalidly nested XHTML automatically" under "Options > Writing"
Of course a fix would be preferable to avoidance.
comment:3
anonymousbugger — 7 years ago
Actually, ignore my previous comment, it's in balanceTags() on line 328.
comment:4
MC_incubus — 7 years ago
Honestly, balanceTags() ("WordPress should correct invalidly nested XHTML automatically") is more trouble than it is worth for people who know how to close tags and want to do more than <em> and <strong> markup.
comment:5
anonymousbugger — 7 years ago
well what about this ?
comment:6
coffee2code — 7 years ago
balanceTags() in its present incarnation will likely never ensure 100% XHTML-ization of posts. In this example, you trip an uncommon(?) situation where a tag is allowed to be immediately nested within itself. balanceTags() already allows for this for [div]. I've attached a patch that also allows it for [blockquote]. Any other situations like this that anyone can think of?
comment:8
MC_incubus — 7 years ago
- Owner changed from anonymous to rboren
- Status changed from new to assigned
comment:9
coffee2code — 7 years ago
I suppose 'span' might be another immediately nestable tag. I've attached a revised patch, bug1170_functions-formatting2.diff which adds it. I've also shorted two condition statements (which are within a while loop) by defining $single_tags and $nestable_tags arrays at the start of the function and using in_array() for the checks. Hopefully that's slightly more efficient, but at the very least should clarify what it's doing.
edited on: 04-22-05 13:57
comment:10
mdawaffe — 5 years ago
- Keywords has-patch 2nd-opinion added
- Milestone set to 2.1
bug1170_functions-formatting2.diff looks good.
comment:12
rob1n — 5 years ago
- Status changed from assigned to closed
- Resolution set to worksforme
Works for me, running 2.1.
Unless you mean the quicktags (the formatting buttons), but that's clumsy to get around.
comment:14
link92 — 5 years ago
- Status changed from closed to reopened
- Resolution worksforme deleted
- Milestone set to 2.3
This is not fixed. If you're unable to recreate this (which really isn't have hard, as all you do is nest a blockquote within another), here's a simple how to:
- Create a new post
- As the content, put <blockquote><blockquote><p>Can you quote me?</p></blockquote><p>Look, I can quote you!</p></blockquote>
- Save.
- Observe it being changed to <blockquote></blockquote><blockquote><p>Can you quote me?</p></blockquote><p>Look, I can quote you!</p>
comment:15
Nazgul — 5 years ago
- Status changed from reopened to closed
- Resolution set to worksforme
- Milestone 2.3 deleted
On what version does that hapen? I just tried your snippet on trunk:
In:
<blockquote><blockquote><p>Can you quote me?</p></blockquote><p>Look, I can quote you!</p></blockquote>
Out:
<blockquote><blockquote> <p>Can you quote me?</p> </blockquote> <p>Look, I can quote you!</p> </blockquote>
Which appears correct to me.
comment:16
link92 — 5 years ago
2.0.10, 2.2, and trunk, in the text editor.
comment:17
intoxination — 5 years ago
This still exists in 2.2. If a post runs through BlanaceTags, it removes the nesting on BlockQuotes.
This patch also works great for fixing it.
comment:18
foolswisdom — 5 years ago
- Keywords 2nd-opinion removed
- Status changed from closed to reopened
- Version changed from 1.5 to 2.2
- Resolution worksforme deleted
- Milestone set to 2.3
Jamie Holly (intoxination) provided more information to the wp-hackeres mailing list. Thank you!
It still exists
in 2.2. Basically if you have a post that contains nested quotes it will remove the nesting once it runs through balanceTags. For example this:
Hey Now <blockquote>Your <blockquote>An</blockquote> All</blockquote> Star
Running through balanceTags changes to this:
<p>Hey Now</p> <blockquote><p>Your</p> </blockquote> <blockquote><p>An</p> </blockquote> <p>All</p> <p>Star</p>
I manually applied the patch attached to the ticket to 2.2 and it did fix it.
The problem occurs when saving a post with "WordPress should correct invalidly nested XHTML automatically" checked. Since the content goes through the balanceTags filter on content_save_pre it only applies at save/publish time.
comment:19
Nazgul — 5 years ago
- Keywords commit added
That explains why I couldn't reproduce it, as "WordPress should correct invalidly nested XHTML automatically" is turned of on my blog.
I've confirmed the bug and also the fix.
The patch I attached is a refresh of the already exiting one against trunk.
comment:20
rob1n — 5 years ago
- Status changed from reopened to closed
- Resolution set to fixed

