Version 1.0.0
[fanfix.git] / src / be / nikiroo / fanfix / supported / BasicSupport.java
index 61a4500759bccb26366d23ade04f07053c169dcb..d6801c0dfaf7ba8cb26aff123392196241076d4e 100644 (file)
@@ -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));