Using line breaking and <hr /> results in an invalid markup

wrwrwr - January 20, 2008 - 19:15
Project:Drupal
Version:5.x-dev
Component:filter.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Line breaking filter does not treat hr as a block level element and encloses it in paragraph tags (if used with empty lines above and below). This is invalid in XHTML.

Attached patch adds the hr tag to a list of block elements in _filter_autop. Possibly some more tags should be added (fieldset?, center for html?), but the list doesn't correspond to any DTD, so it's hard to tell.

  $block = '(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|p|h[1-6]|hr)';

Patch is created against the head, but tested only on the 5.6 branch (code is the same).

AttachmentSize
filter.module.patch911 bytes

#1

alexanderpas - January 20, 2008 - 21:22
Version:5.6» 6.0-rc2
Status:needs review» reviewed & tested by the community

Confirming this bug, also in 6.0-rc2

code seems correct.

HR should be considered a block level element.

#2

Gábor Hojtsy - January 21, 2008 - 15:17
Status:reviewed & tested by the community» fixed

Committed, thanks.

#3

Anonymous (not verified) - February 4, 2008 - 16:06
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

#4

Damien Tournoud - May 18, 2009 - 17:16
Version:6.0-rc2» 5.x-dev
Status:closed» patch (to be ported)

Apparently this is an issue on 5.x too.

#5

alexanderpas - May 24, 2009 - 23:23
Status:patch (to be ported)» needs review

ported to D5 ;)

AttachmentSize
hr_block-D5.patch 928 bytes

#6

Damien Tournoud - May 24, 2009 - 23:25
Status:needs review» reviewed & tested by the community

Straightforward port, thanks @alexanderpas.

#7

drumm - June 3, 2009 - 17:52
Status:reviewed & tested by the community» fixed

Committed to 5.x.

#8

System Message - June 17, 2009 - 18:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.