setHook('wrmap', 'wrmapParserHook');
return true;
}
/// Format inside ... has to be like this:
///
///
/// Rodelbahn|47.143241,11.208959|Birgitzer Alm
/// ...
///
function wrmapParserHook($input, $args, $parser) {
$output = '';
$lines = explode("\n", $input);
foreach ($lines as $line) {
try {
$l = trim($line);
if (strlen($l) == 0) continue;
$columns = explode('|', $line);
if (count($columns) != 3) throw new Exception(sprintf(utf8_encode('Die Anzahl der Spalten ist nicht 3 sondern %d'), count($columns)));
$columns = list($type, $geo, $name) = $columns;
list($latitude, $longitude) = wrGeoStringToGeo($geo);
$output .= sprintf("%F,%F\n", $latitude, $longitude);
} catch (Exception $e) {
return sprintf(utf8_encode('Ungültige Zeile in der Koordinatenliste: %s. %s'), htmlspecialchars($line), htmlspecialchars($e->getMessage()));
}
}
$output = $output .= "\n";
/*
global $wgTitle, $wgUser;
$parser = new Parser();
$parserOptions = new ParserOptions();
$parserOptions->initialiseFromUser($wgUser);
$result = $parser->parse($output, $wgTitle, $parserOptions); // TODO: Make this call less complicated
*/
$result = $parser->recursiveTagParse($output); // TODO: Maybe this is already the solution?
return $result->getText();
}
?>