setHook('wrmap', 'wrmapParserHook'); return true; } /// Format inside ... has to be like this: /// /// /// Rodelbahn|47.143241 N 11.208959 E|Birgitzer Alm /// ... /// /// /// The extension produces a format like this: /// /// 47.241731, 11.358994, Birgitzer Alm /// Die Birgitzer Alm ist nett /// 47.17607, 11.542763, Naviser Hütte /// Die Naviser Hütte /// function wrmapParserHook($input, $args, $parser) { $output = ''; // TODO: Varable coordinates $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, %s\n", $latitude, $longitude, htmlspecialchars($name)); } 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 return $result->getText(); */ $result = $parser->recursiveTagParse($output); // TODO: Maybe this is already the solution? return $result; } ?>