WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#12335 closed defect (bug) (fixed)

wpautop() adds pee's around closing tag of HTML 5 block-level element figure

Reported by: springfeld Owned by: rmccue
Milestone: 3.0 Priority: low
Severity: trivial Version: 2.9.2
Component: Formatting Keywords: has-patch
Focuses: Cc:

Description

If you add a figure-element into a post, it will only be altered on the last line. The ending tag of a HTML 5 block-level element figure is delivered as <p></figure></p> while the rest of the block is not altered.

I found the line, where block-level elements are listed, and the figure element - as well as other upcoming HTML 5 elements - isn't listed there:
http://core.trac.wordpress.org/browser/trunk/wp-includes/formatting.php#L188

Attachments (5)

html5-snippet.html (652 bytes) - added by springfeld 9 years ago.
HTML 5 snippet to copy and paste into a post
html5-snippet-output.html (856 bytes) - added by springfeld 9 years ago.
WordPress output: post-content after posting above snippet
12335.diff (1018 bytes) - added by rmccue 9 years ago.
Add new HTML 5 block-level elements to wpautop
12335-video.diff (1.5 KB) - added by rmccue 9 years ago.
Add exception for video/audio tags, in the vain of object tags
12335.2.diff (1.6 KB) - added by rmccue 9 years ago.
Include summary, figcaption, menu

Download all attachments as: .zip

Change History (13)

@springfeld
9 years ago

HTML 5 snippet to copy and paste into a post

@springfeld
9 years ago

WordPress output: post-content after posting above snippet

#1 @springfeld
9 years ago

As you can see (in the second file I uploaded which is generated by pasting the content of the first file) wpautop also assigns a paragraph around the start-tag (<p><figure ...></p>) and not only to the closing one.

My mistake.

#2 @scribu
9 years ago

  • Milestone changed from Unassigned to 3.0

#3 @dd32
9 years ago

Can someone come up with a list of HTML5 block-level element names?

#4 @rmccue
9 years ago

  • Cc me@… added
  • Owner set to rmccue
  • Status changed from new to assigned

Sure can.

#5 @rmccue
9 years ago

The elements are: section|article|aside|hgroup|header|footer|nav|figure|details

Attaching patch.

@rmccue
9 years ago

Add new HTML 5 block-level elements to wpautop

#6 @rmccue
9 years ago

  • Keywords has-patch added

Note: we'll probably need to add more exceptions for <video> and <audio> in the vain of the current <object> exception.

@rmccue
9 years ago

Add exception for video/audio tags, in the vain of object tags

#7 @rmccue
9 years ago

Tested, and working with the given example.

@rmccue
9 years ago

Include summary, figcaption, menu

#8 @nacin
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

video/audio/source best left to #10151.

(In [13982]) Add block-level HTML5 elements to wpautop(). props rmccue. fixes #12335

Note: See TracTickets for help on using tickets.