I just ran a hack to convert all of my markup to Markdown from Textile 2 in order to improve my text and be compatible with GeSHi.
[php] < ?php $query = sprintf(“SELECT ID,post_content FROM %s”, POST_TABLE);
$db = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); mysql_select_db(DB_NAME, $db);
$rows = mysql_query($query, $db); while($row = mysql_fetch_row($rows)) { $post = $row[1]; $post = preg_replace(‘/^bq./m’, ‘>’, $post); $post = preg_replace(‘/^#/m’, ’1.’, $post); $post = preg_replace(‘/ ([s[{(]|[[:punct:]])? # $pre ” # start (‘.$textile_c.’) # $atts ([^"]+) # $text s? (?:(([^)]+))(?=”))? # $title “: (S+b) # $url (/)? # $slash ([^w/;]*) # $post (?=s|$) /Ux’,’ $3‘, $post); $output[] = array(0 => $row[0], 1 => $post); }
foreach($output as $row) { $update = sprintf(“UPDATE %s SET post_content = ‘%s’ WHERE ID = %u”, POST_TABLE, mysql_real_escape_string($row[1]), $row[0]); $result = mysql_query($update, $db); } } ?> [/php]
(And if anyone knows why the above code is not monospaced, please yell!)
If anything is amiss, please let me know. I doubt I will be fixing all the issues with punctuation after links…
Thanks,
A.