1 package be
.nikiroo
.fanfix
.supported
;
4 import java
.io
.IOException
;
5 import java
.net
.MalformedURLException
;
6 import java
.net
.URISyntaxException
;
9 import be
.nikiroo
.fanfix
.Instance
;
12 * Support class for HTML files created with this program (as we need some
13 * metadata available in those we create).
17 class Html
extends InfoText
{
19 public String
getSourceName() {
24 protected boolean supports(URL url
) {
25 if (url
.getPath().toLowerCase()
26 .endsWith(File
.separatorChar
+ "index.html")) {
28 File file
= new File(url
.toURI()).getParentFile();
29 return super.supports(file
.toURI().toURL());
30 } catch (URISyntaxException e
) {
31 } catch (MalformedURLException e
) {
39 public URL
getCanonicalUrl(URL source
) {
40 if (source
.toString().endsWith(File
.separator
+ "index.html")) {
42 File fakeFile
= new File(source
.toURI()); // "story/index.html"
43 fakeFile
= new File(fakeFile
.getParent()); // "story"
44 fakeFile
= new File(fakeFile
, fakeFile
.getName()); // "story/story"
45 return fakeFile
.toURI().toURL();
46 } catch (Exception e
) {
47 Instance
.getTraceHandler().error(
48 new IOException("Cannot find the right URL for "