in src/main/java/com/atlassian/uwc/converters/mindtouch/LinkParser.java [58:94]
protected String fixUnderscores(String input, String href, Page page) {
if (getProperties() != null && getProperties().containsKey("exportdir")) {
String exportdir = getProperties().getProperty("exportdir", null);
if (exportdir == null) return input;
File export = new File(exportdir);
if (!export.exists() || !export.isDirectory()) {
log.warn("exportdir does not exist or is not a directory. " + exportdir);
return input;
}
Matcher parentFinder = parents.matcher(href);
if (parentFinder.find()) {
String parentString = parentFinder.group(1);
String[] parentArray = parentString.split("/");
File[] exportfiles = export.listFiles(nosvnfilter);
File rootFile = null;
//get list of export pages to work with (ignore mindtouch root page, if it's there)
boolean foundMindtouchAsRoot = false;
for (File file : exportfiles) {
if (file.isDirectory() && file.getName().endsWith("_MindTouch_subpages")) {
foundMindtouchAsRoot = true;
rootFile = file;
break; //should only be one
}
}
File[] rootFiles;
if (!foundMindtouchAsRoot) rootFiles = exportfiles;
else rootFiles = rootFile.listFiles(nosvnfilter);
//walk the tree to get the leaf file for the input/href/page
File leafFile = getFile(parentArray, rootFiles);
if (leafFile == null) return input;
return fixUnderscores(input, leafFile);
}
else return input;
}
return input;
}