Ticket #1170 (closed defect: fixed)

Opened 4 years ago

Last modified 1 year ago

Nested blockquotes unallowed?

Reported by: anonymousbugger Assigned to: ryan
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

bug1170_functions-formatting.php (0.7 kB) - added by anonymousbugger on 05/21/05 06:37:19.
bug1170_functions-formatting2.diff (1.3 kB) - added by anonymousbugger on 05/21/05 06:37:19.
1170.diff (1.3 kB) - added by Nazgul on 05/31/07 21:35:03.

Change History

03/25/05 21:35:15 changed by anonymousbugger

  • Patch set to No.

03/29/05 01:30:56 changed by anonymousbugger

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.

03/29/05 01:38:43 changed by anonymousbugger

Actually, ignore my previous comment, it's in balanceTags() on line 328.

03/29/05 07:54:09 changed by MC_incubus

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.

03/29/05 10:12:56 changed by anonymousbugger

well what about this ?

03/29/05 20:54:45 changed by coffee2code

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?

03/29/05 22:04:28 changed by coffee2code

  • Patch changed from No to Yes.

04/22/05 09:15:55 changed by MC_incubus

  • owner changed from anonymous to rboren.
  • status changed from new to assigned.

04/22/05 13:56:01 changed by coffee2code

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

05/21/05 06:37:19 changed by anonymousbugger

  • attachment bug1170_functions-formatting2.diff added.

08/31/06 18:59:02 changed by mdawaffe

  • keywords set to has-patch 2nd-opinion.
  • milestone set to 2.1.

bug1170_functions-formatting2.diff looks good.

11/29/06 22:41:25 changed by matt

  • milestone changed from 2.1 to 2.2.

02/14/07 02:45:53 changed by rob1n

  • 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.

02/14/07 03:32:24 changed by rob1n

  • milestone deleted.

05/30/07 13:14:53 changed by link92

  • status changed from closed to reopened.
  • resolution 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:

  1. Create a new post
  2. As the content, put <blockquote><blockquote><p>Can you quote me?</p></blockquote><p>Look, I can quote you!</p></blockquote>
  3. Save.
  4. Observe it being changed to <blockquote></blockquote><blockquote><p>Can you quote me?</p></blockquote><p>Look, I can quote you!</p>

05/30/07 13:39:09 changed by Nazgul

  • status changed from reopened to closed.
  • resolution set to worksforme.
  • milestone 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.

05/31/07 19:23:00 changed by link92

2.0.10, 2.2, and trunk, in the text editor.

05/31/07 20:27:08 changed by intoxination

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.

05/31/07 21:00:20 changed by foolswisdom

  • keywords changed from has-patch 2nd-opinion to has-patch.
  • status changed from closed to reopened.
  • version changed from 1.5 to 2.2.
  • resolution 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.

05/31/07 21:35:03 changed by Nazgul

  • attachment 1170.diff added.

05/31/07 21:36:33 changed by Nazgul

  • keywords changed from has-patch to has-patch commit.

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.

06/01/07 02:33:03 changed by rob1n

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [5623]) Fix nestable HTML, including <blockquote>'s. Props anonymousbugger (!) and Nazgul. fixes #1170