X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Foutput%2FBasicOutput.java;h=33a42c574bed176d90556bce1c447fba61ed26fe;hb=b4dc6ab518ded2dd92e4cbb02ac615b1d57e8e6d;hp=e2bf2ff89fc0e28c382b8c8fa20db5a357b27e49;hpb=68686a37a591a767f6d1af428ea0d5f3d3a1ddc1;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/output/BasicOutput.java b/src/be/nikiroo/fanfix/output/BasicOutput.java index e2bf2ff..33a42c5 100644 --- a/src/be/nikiroo/fanfix/output/BasicOutput.java +++ b/src/be/nikiroo/fanfix/output/BasicOutput.java @@ -36,7 +36,12 @@ public abstract class BasicOutput { /** ZIP with (PNG) images */ CBZ, /** LaTeX file with "book" template */ - LATEX; + LATEX, + /** HTML files in a dedicated directory */ + HTML, + + ; + public String toString() { return super.toString().toLowerCase(); } @@ -58,6 +63,20 @@ public abstract class BasicOutput { return desc; } + /** + * The default extension to add to the output files. + * + * @return the extension + */ + public String getDefaultExtension() { + BasicOutput output = BasicOutput.getOutput(this, false); + if (output != null) { + return output.getDefaultExtension(); + } + + return null; + } + /** * Call {@link OutputType#valueOf(String.toUpperCase())}. * @@ -73,7 +92,7 @@ public abstract class BasicOutput { /** * Call {@link OutputType#valueOf(String.toUpperCase())} but return NULL - * for NULL instead of raising exception. + * for NULL and empty instead of raising an exception. * * @param typeName * the possible type name @@ -81,7 +100,7 @@ public abstract class BasicOutput { * @return NULL or the type */ public static OutputType valueOfNullOkUC(String typeName) { - if (typeName == null) { + if (typeName == null || typeName.isEmpty()) { return null; } @@ -208,12 +227,10 @@ public abstract class BasicOutput { /** * The default extension to add to the output files. - *

- * Cannot be NULL! * * @return the extension */ - protected String getDefaultExtension() { + public String getDefaultExtension() { return ""; } @@ -423,6 +440,8 @@ public abstract class BasicOutput { return new Cbz().setType(type, infoCover, infoCover); case LATEX: return new LaTeX().setType(type, infoCover, infoCover); + case HTML: + return new Html().setType(type, infoCover, infoCover); } }