#1170 closed defect (bug) (fixed)
Nested blockquotes unallowed?
Reported by: | anonymousbugger | Owned by: | ryan |
---|---|---|---|
Milestone: | 2.3 | Priority: | normal |
Severity: | minor | Version: | 2.2 |
Component: | General | Keywords: | has-patch commit |
Focuses: | 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 (3)
Change History (26)
#4
@
20 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.
#6
@
20 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?
#9
@
20 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
#10
@
18 years ago
- Keywords has-patch 2nd-opinion added
- Milestone set to 2.1
bug1170_functions-formatting2.diff looks good.
#12
@
18 years ago
- Resolution set to worksforme
- Status changed from assigned to closed
Works for me, running 2.1.
Unless you mean the quicktags (the formatting buttons), but that's clumsy to get around.
#14
@
17 years ago
- Milestone set to 2.3
- Resolution worksforme deleted
- Status changed from closed to reopened
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>
#15
@
17 years ago
- Milestone 2.3 deleted
- Resolution set to worksforme
- Status changed from reopened to closed
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.
#17
@
17 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.
#18
@
17 years ago
- Keywords 2nd-opinion removed
- Milestone set to 2.3
- Resolution worksforme deleted
- Status changed from closed to reopened
- Version changed from 1.5 to 2.2
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.
#19
@
17 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.
This ticket was mentioned in PR #1171 on WordPress/wordpress-develop by gziolo.
4 years ago
#21
Trac ticket:
Replaces: #1170.
Related Gutenberg PRs:
https://github.com/WordPress/gutenberg/pull/30528
https://github.com/WordPress/gutenberg/pull/30517
4 years ago
#22
I have just tested https://github.com/WordPress/gutenberg/pull/30122 to confirm that everything was applied correctly and it works as expected.
4 years ago
#23
I applied a few tweaks to the configuration. It should be good to go after some addition testing.
peterwilsoncc commented on PR #1171:
4 years ago
#24
Committed in https://core.trac.wordpress.org/changeset/50678
The trac ticket remains open in case anything is discovered between the release candidate and release proper.
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.