前回のwordpressのformatterがキモいタグを生成するので、どうにかするはME2.2.3以外でpatchすると、管理画面で激しくwarningが出てエライことになる。ので、v2.3.3用のpatch。
--- www/wp-includes/formatting.php.orig Thu Feb 28 16:37:29 2008
+++ www/wp-includes/formatting.php Thu Feb 28 16:39:27 2008
@@ -63,7 +63,7 @@
$pee = $pee . "\n"; // just to make things a little easier, pad the end
$pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
// Space things out a little
- $allblocks = '(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr)';
+ $allblocks = '(?:code|table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr)';
$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
@@ -88,6 +88,10 @@
if (strpos($pee, '<pre') !== false)
$pee = preg_replace_callback('!(<pre.*?>)(.*?)</pre>!is', 'clean_pre', $pee );
$pee = preg_replace( "|\n</p>$|", '</p>', $pee );
+ $pee = preg_replace('| {4}|', str_repeat(' ',4), $pee);
+ $pee = str_replace('\\', '\\\\', $pee);
+ $pee = preg_replace('|<code>.*?</code>|se', "str_replace(array('<p>', '</p>'), array('', '<br /><br />'), '$0')", $pee);
+ $pee = StripSlashes($pee);
return $pee;
}