10/17/2004

Really Like WordPress

Filed under: General — site admin @ 10:38 pm

I am using WordPress now as my blogging software. It is much nicer than the previous stuff I was using. It even has a bbcode plugin that can be found here:
http://www.procata.com/software/wordpress-bbcode/

Unfortunately this code did not handle the [ code ] bbcode block properly. It simply replaced it with a < code > block.

This function is in the bbcode.php file, in the extended filter class (roughly line 826). You need to go past the array declarations and before the class closing }.

I would have posted it here but... but I found another problem in WordPress. The wp-admin/post.php file butchered the backslashed regular expression. Apparantly WP does not handle backslashes in posts very well -- php parses them for us and you are left with whatever was after the backslash.

Either way here is a new copy of the plugin with my modification. It uses two styles, and a pre tag for formatting the code (codebody and quotecodeheader). Thanks goes out to Kailash at www.boastology.com. I used his 2.9b bbcode parsing code as a model for this change.

Here is a link to the updated file. You can right click on it and save it to your machine.

To install you can follow the instructions from Jeff Moore's original plug-in's site:
http://www.procata.com/software/wordpress-bbcode/

You will need to add one more change to WordPress, because WordPress adds paragraph marks <p> to blank lines even within code blocks:

On line 54 of functions-formatting.php add the following code lines:

Code:
$text = preg_replace('/[ \t]*<p>[ \t]*/', '', $text);
$text = str_replace('</p>', '', $text);

When completed the function should look like this:

Code:
function clean_pre($text) {
	$text = str_replace('<br />', '', $text);
	$text = preg_replace('/[ \t]*<p>[ \t]*/', '', $text);
	$text = str_replace('</p>', '', $text);
	return $text;
}

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

Couldn't find your convert utility. Check that you have ImageMagick installed.