*/
class Html extends InfoText {
@Override
- public String getSourceName() {
- return "html";
+ protected boolean supports(URL url) {
+ try {
+ File txt = getTxt(url);
+ if (txt != null) {
+ return super.supports(txt.toURI().toURL());
+ }
+ } catch (MalformedURLException e) {
+ }
+
+ return false;
}
@Override
- protected boolean supports(URL url) {
- File txt = getTxt(url);
- return txt != null && txt.exists();
+ protected File getInfoFile() {
+ File source = getSourceFile();
+ if ("index.html".equals(source.getName())) {
+ source = source.getParentFile();
+ }
+
+ String src = source.getPath();
+ File infoFile = new File(src + ".info");
+ if (!infoFile.exists() && src.endsWith(".txt")) {
+ infoFile = new File(
+ src.substring(0, src.length() - ".txt".length()) + ".info");
+ }
+
+ return infoFile;
}
@Override
try {
source = txt.toURI().toURL();
} catch (MalformedURLException e) {
- Instance.getTraceHandler().error(
- new IOException("Cannot convert the right URL for "
- + source, e));
+ Instance.getInstance().getTraceHandler()
+ .error(new IOException("Cannot convert the right URL for " + source, e));
}
- } else {
- Instance.getTraceHandler().error(
- new IOException("Cannot find the right URL for " + source));
}
return source;