}
}
// Check for functions
if (!done) {
PageElementFunction function = analysis.isInFunction(currentIndex);
if ((function != null) &&
(function.getBeginIndex() == currentIndex)) {
MagicWord magicWord = function.getMagicWord();
String magicWordName = magicWord.getName();
boolean isOk = false;
if (MagicWord.DEFAULT_SORT.equals(magicWordName) ||
MagicWord.FORMAT_NUM.equals(magicWordName) ||
MagicWord.DISPLAY_TITLE.equals(magicWordName)) {
isOk = true;
}
if (!isOk &&
MagicWord.TAG.equals(magicWordName) &&
(function.getParameterCount() > 0) &&
(PageElementTag.TAG_WIKI_REF.equals(function.getParameterValue(0)))) {
isOk = true;
}
if (!isOk) {
result = true;
done = true;
if (errors == null) {
return true;
}
CheckErrorResult errorResult = createCheckErrorResult(
analysis, function.getBeginIndex(), function.getEndIndex());
if (MagicWord.PAGE_NAME.equals(magicWordName)) {
errorResult.addReplacement(page.getTitle());
}
if (MagicWord.IF_EXPR.equals(magicWordName)) {
for (int param = 1; param < function.getParameterCount(); param++) {
errorResult.addReplacement(function.getParameterValue(param));
}
}
if ((analysis.isInTag(currentIndex, PageElementTag.TAG_WIKI_GALLERY) == null) &&
(analysis.isInTag(currentIndex, PageElementTag.TAG_WIKI_INCLUDEONLY) == null) &&
(analysis.isInTag(currentIndex, PageElementTag.TAG_WIKI_REF) == null) &&
(analysis.isInTag(currentIndex, PageElementTag.TAG_WIKI_TIMELINE) == null)) {
errorResult.addReplacement(
"{{subst:" +
contents.substring(function.getBeginIndex() + 2, function.getEndIndex()));
}
errors.add(errorResult);
nextIndex = function.getEndIndex();
} else {
nextIndex = currentIndex + 2;
}
}
}