X-Git-Url: https://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FHtml.java;h=900fa0a1772f0ffd5ecfcaf2fecfbd8b248168a0;hb=b063fe0a74fdf17f440a850bbb98a2de6233a679;hp=f66032bfce20032f784b6df0ab4b51ce7883fce7;hpb=86d49dbc7c3eca665b7823b5de49bb73a31c7722;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/supported/Html.java b/src/be/nikiroo/fanfix/supported/Html.java deleted file mode 100644 index f66032b..0000000 --- a/src/be/nikiroo/fanfix/supported/Html.java +++ /dev/null @@ -1,63 +0,0 @@ -package be.nikiroo.fanfix.supported; - -import java.io.File; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URISyntaxException; -import java.net.URL; - -import be.nikiroo.fanfix.Instance; - -/** - * Support class for HTML files created with this program (as we need some - * metadata available in those we create). - * - * @author niki - */ -class Html extends InfoText { - @Override - public String getSourceName() { - return "html"; - } - - @Override - protected boolean supports(URL url) { - try { - File file = new File(url.toURI()); - if (file.getName().equals("index.html")) { - file = file.getParentFile(); - } - - file = new File(file, file.getName()); - - return super.supports(file.toURI().toURL()); - } catch (URISyntaxException e) { - } catch (MalformedURLException e) { - } - - return false; - } - - @Override - public URL getCanonicalUrl(URL source) { - - try { - File fakeFile = new File(source.toURI()); - if (fakeFile.getName().equals("index.html")) { // "story/index.html" - fakeFile = new File(fakeFile.getParent()); // -> "story/" - } - - if (fakeFile.isDirectory()) { // "story/" - fakeFile = new File(fakeFile, fakeFile.getName() + ".txt"); // "story/story.txt" - } - - return fakeFile.toURI().toURL(); - } catch (Exception e) { - Instance.getTraceHandler().error( - new IOException("Cannot find the right URL for " + source, - e)); - } - - return source; - } -}