# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: C:\xampp\htdocs\wordpress\sandbox\wp-includes
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: formatting.php
--- formatting.php Base (BASE)
+++ formatting.php Locally Modified (Based On LOCAL)
@@ -178,6 +178,16 @@
 	$pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee);
 	$pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee);
 	$pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
+
+	// Pull out any PRE tags so they're not affected at all
+	$pres = array();
+	if ( strpos($pee, '<pre') !== false ){
+		preg_match_all( '!<pre[^>]*>.+?</pre>!is', $pee, $pres );
+		if ( count( $pres ) ){
+			$pee = preg_replace( '!<pre[^>]*>.+?</pre>!is', '<WPPreservePre />', $pee );
+		}
+	}
+
 	if ( strpos($pee, '<object') !== false ) {
 		$pee = preg_replace('|\s*<param([^>]*)>\s*|', "<param$1>", $pee); // no pee inside object/embed
 		$pee = preg_replace('|\s*</embed>\s*|', '</embed>', $pee);
@@ -203,8 +213,18 @@
 	}
 	$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee);
 	$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
-	if (strpos($pee, '<pre') !== false)
-		$pee = preg_replace_callback('!(<pre[^>]*>)(.*?)</pre>!is', 'clean_pre', $pee );
+	
+	// Substitute our preserved PREs back in
+	if ( count( $pres ) ){
+		foreach ( $pres as $pre ){
+			$pee = preg_replace( '!<WPPreservePre />!', $pre[0], $pee, 1 );
+		}
+	}
+
+	// We don't need this any more. Better to leave all <pre> content untouched
+//	if (strpos($pee, '<pre') !== false)
+//		$pee = preg_replace_callback('!(<pre[^>]*>)(.*?)</pre>!is', 'clean_pre', $pee );
+	
 	$pee = preg_replace( "|\n</p>$|", '</p>', $pee );
 
 	return $pee;
