Make WordPress Core

Opened 17 years ago

Closed 13 years ago

Last modified 13 years ago

#6870 closed defect (bug) (fixed)

Nest Q[uotation] elements mishandled by preprocessor, possibly trashing entry.

Reported by: oeconomist's profile oeconomist Owned by: nacin's profile nacin
Milestone: 3.3 Priority: normal
Severity: normal Version: 2.5.1
Component: Formatting Keywords: has-patch commit
Focuses: Cc:

Description

In HTML, one is allowed to nest Q[uotation] elements within Q[uotation] element. The WordPress editor sees nested quotation elements as in error, and attempts to fix things by closing the outer element when it reaches the inner element. I note also that a spurious DIV-closing tag may be placed at the end of an entry containing nested Q[uotation] elements, causing the rest of the 'blog page to be rendered incorrectly. Users are forced either to forgo best HTML practice, or to bypass the WordPress editor to fix the entry.

(Bug was also found in Version 2.5.)

Attachments (1)

6870.diff (705 bytes) - added by solarissmoke 13 years ago.
q elements are nestable

Download all attachments as: .zip

Change History (23)

#1 @matt
16 years ago

  • Keywords wpautop added; Q[uotation] element removed
  • Milestone changed from 2.7 to 2.9

#2 @Denis-de-Bernardy
16 years ago

  • Component changed from General to Formatting
  • Owner anonymous deleted

#3 @ryan
15 years ago

  • Milestone changed from 2.9 to Future Release

#4 @solarissmoke
14 years ago

  • Keywords posting editor wpautop removed
  • Resolution set to worksforme
  • Status changed from new to closed

Assuming this ticket is referring to nested blockquote elements - it seems to work fine in trunk, wpautop doesn't mess them up.

#5 @dd32
14 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

Assuming this ticket is referring to nested blockquote elements -

I believe it was refering to the inline variant, the <q>..</q> Quotation element, can you re-test with that one too?

#6 @solarissmoke
14 years ago

Tested with nested inline quote tags as below and that also works fine:

<q>This is a quotation that quotes <q>another quotation</q> inside it.</q>

#7 @solarissmoke
14 years ago

  • Resolution set to worksforme
  • Status changed from reopened to closed

Feel free to reopen if there is an issue.

#8 @dd32
14 years ago

  • Milestone Future Release deleted

most likely fixed with one of the many formatting updated over the versions. thanks for testing :)

#9 @oeconomist
13 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

It is still broken on WordPress 3.1.3 running on my host. If it's fixed in some forthcoming version, that's cool. It the test was run on 3.1.3, then the reason for different behaviors needs to be explored.

#10 @solarissmoke
13 years ago

  • Keywords reporter-feedback added

I tested using the code in comment:6, and it works fine in 3.1.3. Please post a code snippet that breaks for you.

Note that inserting line breaks in between the tags will cause problems with wpautop - but that is a wider autop issue that affects all inline tags.

#11 follow-up: @oeconomist
13 years ago

solarissmoke—

The very string that you present above

<q>This is a quotation that quotes <q>another quotation</q> inside it.</q>

breaks for me.

Is it possible that your inline-quote plugin causes your installation to handle nested quotations correctly, while a bare installation will not?

#12 in reply to: ↑ 11 @solarissmoke
13 years ago

Replying to oeconomist:

Is it possible that your inline-quote plugin causes your installation to handle nested quotations correctly, while a bare installation will not?

Nope, I'm testing on a fresh checkout of 3.1.3 with no plugins installed :). What is that string being converted to in your output html?

#13 @oeconomist
13 years ago

A post with nothing but that string entered becomes

<p><q>This is a quotation that quotes </q><q>another quotation</q> inside it.</p>

which is then unsurprisingly rendered as

“This is a quotation that quotes ”“another quotation” inside it.

In other words, just as originally reported, the outer quotation is closed when the inner quotation is encountered.

#14 @solarissmoke
13 years ago

  • Keywords reporter-feedback removed

Ah, found the problem. It's with balance_tags.

Last edited 13 years ago by solarissmoke (previous) (diff)

@solarissmoke
13 years ago

q elements are nestable

#15 @solarissmoke
13 years ago

  • Keywords has-patch added

#16 @ocean90
13 years ago

  • Milestone set to Future Release

#17 @oeconomist
13 years ago

*sigh*

“No comment.”

#18 @coffee2code
13 years ago

+1

I was responsible for the introduction of the self-nesting tag handling in balance_tags(). The omission of the <q> tag was an oversight (for the life of me I can't find where I added a patch to rectify that lo those many years ago). Anyhow, the change is trivial and has no negative side effects.

As further proof as to whether the <q> tag is self-nestable, the W3C itself does so in an example in the HTML 4.01 spec section pertaining to <q> here.

#19 @nacin
13 years ago

  • Keywords commit needs-unit-tests added
  • Milestone changed from Future Release to 3.3

#20 @nacin
13 years ago

#1170 - that's an old one.

#21 @nacin
13 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from reopened to closed

In [18585]:

Add 'q' tag to nestable tags list in force_balance_tags(). props solarissmoke, fixes #6870.

Note: See TracTickets for help on using tickets.