Wiktionary:Grease pit/split.php

setHook("split", "renderComponentWordLinks"); }

function renderComponentWordLinks($input, $argv) { global $wgParser, $wgUser; $phrase = $wgParser->mTitle->getText; $words = preg_split("/([ -]+)/", $phrase, -1, PREG_SPLIT_DELIM_CAPTURE);

$skin = $wgUser->getSkin; $output = ""; foreach ($words as $key => $word) { if ($key & 1) $output .= $word; else $output .= $skin->makeLink($word); }

return $output; } ?>