List<CheckErrorAlgorithm> usedAlgorithms) {
if ((page == null) || (contents == null)) {
return contents;
}
EnumWikipedia wiki = page.getWikipedia();
WPCConfiguration config = wiki.getConfiguration();
// Fix Check Wiki errors
if (algorithms != null) {
for (CheckErrorAlgorithm algorithm : algorithms) {
if (algorithm.isAvailable() &&
CheckErrorAlgorithms.isAlgorithmActive(wiki, algorithm.getErrorNumber())) {
String currentContents = contents;
PageAnalysis analysis = page.getAnalysis(currentContents, true);
contents = botFix ? algorithm.botFix(analysis) : algorithm.automaticFix(analysis);
if ((usedAlgorithms != null) && (!contents.equals(currentContents))) {
usedAlgorithms.add(algorithm);
}
}
}
}
// Auto formatting options
if (!page.isInMainNamespace()) {
return contents;
}
if (!config.getBoolean(WPCConfigurationBoolean.AUTO_ACTIVE)) {
return contents;
}
contents = fixSpaceAroundTitle(page, contents);
contents = fixLinkDefaultsortCategory(page, contents);
contents = fixLangLinksAfterCategory(page, contents);