public String parseFunction(char[] src, int beginIndex, int endIndex, IWikiModel model) throws IOException {
List<String> list = new ArrayList<String>();
WikipediaScanner.splitByPipe(src, beginIndex, endIndex, list);
if (list.size() > 0) {
String arg0 = parse(list.get(0), model);
INamespace namespace = model.getNamespace();
try {
int numberCode = Integer.valueOf(arg0).intValue();
if (numberCode >= (-2) || numberCode <= 15) {
return namespace.getNamespaceByNumber(numberCode);
}
} catch (NumberFormatException nfe) {
// the given argument could not be parsed as integer number
arg0 = arg0.replace(' ', '_');
String value = namespace.getNamespaceByLowercase(arg0.toLowerCase());
if (value != null) {
return value;
}
return "[[:Template:Ns:" + arg0 + "]]";
}