X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FBasicSupport.java;h=f1635589bfd70b0dca80b5972dcfd241bda895f8;hp=0a5ec3686e1be43c52a328d1a1be86e805ad21fe;hb=1387a30ab59dbf4071f2c5e5e0e08ca98c75b726;hpb=fccaa18aed16a157e07769e407a4cc42925661fb diff --git a/src/be/nikiroo/fanfix/supported/BasicSupport.java b/src/be/nikiroo/fanfix/supported/BasicSupport.java index 0a5ec36..f163558 100644 --- a/src/be/nikiroo/fanfix/supported/BasicSupport.java +++ b/src/be/nikiroo/fanfix/supported/BasicSupport.java @@ -374,7 +374,25 @@ public abstract class BasicSupport { sourceNode = loadDocument(source); try { - return doProcess(pg); + Story story = doProcess(pg); + + // Check for "no chapters" stories + if (story.getChapters().isEmpty() + && story.getMeta().getResume() != null + && !story.getMeta().getResume().getParagraphs().isEmpty()) { + Chapter resume = story.getMeta().getResume(); + resume.setName(""); + resume.setNumber(1); + story.getChapters().add(resume); + story.getMeta().setWords(resume.getWords()); + + String descChapterName = Instance.getInstance().getTrans() + .getString(StringId.DESCRIPTION); + resume = new Chapter(0, descChapterName); + story.getMeta().setResume(resume); + } + + return story; } finally { close(); } @@ -414,7 +432,7 @@ public abstract class BasicSupport { story.setChapters(new ArrayList()); List> chapters = getChapters(pgGetChapters); pgGetChapters.done(); // 20% - + if (chapters != null) { Progress pgChaps = new Progress("Extracting chapters", 0, chapters.size() * 300); @@ -445,10 +463,11 @@ public abstract class BasicSupport { words += cc.getWords(); story.getChapters().add(cc); - story.getMeta().setWords(words); i++; } + + story.getMeta().setWords(words); pgChaps.setName("Extracting chapters"); pgChaps.done(); @@ -471,7 +490,8 @@ public abstract class BasicSupport { * the chapter name * @param content * the content of the chapter - * @return the {@link Chapter} + * + * @return the {@link Chapter}, never NULL * * @throws IOException * in case of I/O error