Make WordPress Core

Opened 19 years ago

Closed 18 years ago

Last modified 13 years ago

#1024 closed defect (bug) (fixed)

wp filters turn <hr /> into <hr /><br />

Reported by: anonymousbugger's profile anonymousbugger Owned by: shorty114's profile shorty114
Milestone: 2.1 Priority: normal
Severity: minor Version: 2.1
Component: Administration Keywords: bg|has-patch
Focuses: Cc:

Description

blah

<hr />

<h1>blah</h1>

becomes:

blah

<hr /><br />

<h1>blah</h1>

-- denis _\@/_ semiologic.com

Attachments (2)

formatting.php.diff (914 bytes) - added by filosofo 18 years ago.
1024.patch (2.1 KB) - added by shorty114 18 years ago.
Based on latest svn 11/29/06 2:48 pm PST

Download all attachments as: .zip

Change History (12)

#1 @anonymousbugger
19 years ago

  • Patch set to No

#2 @anonymousbugger
19 years ago

should read:

blah

<hr />

<h1>blah</h1>

becomes:

blah

<hr /><br />

<h1>blah</h1>

#3 @anonymousbugger
19 years ago

<hr /><br /> rather, but you get the point. ;)

#4 @anonymousbugger
19 years ago

and mantis turns line break code into regular linebreaks, which is a bug too! ;)

#5 @anonymousbugger
19 years ago

<p><hr /></p> (workaround for those who get the same bug)

#6 @filosofo
18 years ago

  • Keywords bg|has-patch added
  • Milestone set to 2.1
  • Owner changed from anonymous to filosofo
  • Version set to 2.1

I've attached a patch

#7 @Dreamseer
18 years ago

There has to be changed even more, to handle additional forms in posts or pages which use

<fieldset>

or

<legend>

Unfortunately this is my first post to WordPress Trac, so I don't know how to change WordPress code. Maybe someone can change these lines in function wpautop():

	$pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "$1", $pee);
	$pee = preg_replace('!(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); 
	if ($br) $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
	$pee = preg_replace('!(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*<br />!', "$1", $pee);

to

	$pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|fieldset|legend|blockquote|address|math|p|h[1-6])[^>]*>)!', "$1", $pee);
	$pee = preg_replace('!(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|fieldset|legend|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); 
	if ($br) $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
	$pee = preg_replace('!(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|fieldset|legend|blockquote|address|math|p|h[1-6])[^>]*>)\s*<br />!', "$1", $pee);

#8 @shorty114
18 years ago

  • Owner changed from filosofo to shorty114
  • Status changed from new to assigned

Added patch which uses Dreamseer's patch.

@shorty114
18 years ago

Based on latest svn 11/29/06 2:48 pm PST

#9 follow-up: @matt
18 years ago

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

This appears to work fine.

#10 in reply to: ↑ 9 @propostaff
13 years ago

Nothing.

Last edited 13 years ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.