Extension:TransformChanges

I've found the format of the recent changes and watchlists to be difficult to read and generally unpleasent looking, so I've made a quick extension to reformat them from a bullet list into a table. It also adds CSS classes to the table, rows and columns for easy customisation of styles.

Installation
Save the code below into a file and include in your LocalSettings.php file, or just insert the code directly if you prefer. $wgHooks['SpecialPageExecuteAfterPage'][] = 'wfTransformChanges'; function wfTransformChanges { $title = $GLOBALS['wgTitle']->getDBkey; if ($title != 'Recentchanges' && $title != 'Watchlist') return true; $text =& $GLOBALS['wgOut']->mBodytext; $text = preg_replace_callback('| (.+?)|s','wfTransformChangesUL',$text); return true; }

function wfTransformChangesUL($match) { global $wgTransformChangesRow; $wgTransformChangesRow = 0; $rows = preg_replace_callback('|(.+?)|s','wfTransformChangesLI',$match[1]); return " "; }

function wfTransformChangesLI($match) {

# Change the order of the columns here if you like $cols = array('time','title','comment','user','talk','diff','info');

global $wgTransformChangesRow; $wgTransformChangesRow = ++$wgTransformChangesRow%2; $error = ' Error: match failed! '; $row = ''; if (preg_match('|^(.+?); (\\d+:\\d+)(.+?)().+?(\\(.+?\\))|',$user,$m)) list(,$user,$talk) = $m; if (preg_match('|\\((.+)\\)|',$comment,$m)) $comment = $m[1]; foreach ($cols as $col) $row .= "{$$col} "; } else $row = $error; return "$row \n"; }

CSS Styles
To make it render properly some CSS styles should be added to your stylesheet, for example here's the styles that we've added on the Organic Design recent changes. table.changes { border:none; width:100%; } table.changes tr { margin:0; padding:0; } table.changes tr.bg0 { background:white; } table.changes tr.bg1 { background:#eee; } table.changes td { margin:0; padding: 1px 4px 0 4px; vertical-align: top; } td.comment { width:100%; } td.user, td.talk, td.diff, td.info { white-space: nowrap; } td.talk, td.diff { font-size: 90%; }