X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FBasicSupport.java;h=d6801c0dfaf7ba8cb26aff123392196241076d4e;hp=61a4500759bccb26366d23ade04f07053c169dcb;hb=b4dc6ab518ded2dd92e4cbb02ac615b1d57e8e6d;hpb=333f0e7b5e333e8f6222881ce35398f403fc4121 diff --git a/src/be/nikiroo/fanfix/supported/BasicSupport.java b/src/be/nikiroo/fanfix/supported/BasicSupport.java index 61a4500..d6801c0 100644 --- a/src/be/nikiroo/fanfix/supported/BasicSupport.java +++ b/src/be/nikiroo/fanfix/supported/BasicSupport.java @@ -14,8 +14,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; -import javax.imageio.ImageIO; - import be.nikiroo.fanfix.Instance; import be.nikiroo.fanfix.bundles.Config; import be.nikiroo.fanfix.bundles.StringId; @@ -24,6 +22,7 @@ import be.nikiroo.fanfix.data.MetaData; import be.nikiroo.fanfix.data.Paragraph; import be.nikiroo.fanfix.data.Paragraph.ParagraphType; import be.nikiroo.fanfix.data.Story; +import be.nikiroo.utils.IOUtils; import be.nikiroo.utils.StringUtils; /** @@ -609,7 +608,7 @@ public abstract class BasicSupport { InputStream in = null; try { in = Instance.getCache().open(url, getSupport(url), true); - return ImageIO.read(in); + return IOUtils.toImage(in); } catch (IOException e) { } finally { if (in != null) { @@ -764,6 +763,22 @@ public abstract class BasicSupport { boolean singleQ = line.startsWith("" + openQuote); boolean doubleQ = line.startsWith("" + openDoubleQuote); + // Do not try when more than one quote at a time + // (some stories are not easily readable if we do) + if (singleQ + && line.indexOf(closeQuote, 1) < line + .lastIndexOf(closeQuote)) { + newParas.add(para); + return newParas; + } + if (doubleQ + && line.indexOf(closeDoubleQuote, 1) < line + .lastIndexOf(closeDoubleQuote)) { + newParas.add(para); + return newParas; + } + // + if (!singleQ && !doubleQ) { line = openDoubleQuote + line + closeDoubleQuote; newParas.add(new Paragraph(ParagraphType.QUOTE, line));