git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
change config names
[fanfix.git]
/
src
/
be
/
nikiroo
/
fanfix
/
output
/
Text.java
diff --git
a/src/be/nikiroo/fanfix/output/Text.java
b/src/be/nikiroo/fanfix/output/Text.java
index 4acfa762cd82788fcad70707e073983e65b08293..4a45e5430fba9465b1e92a590bcae9cc18b28360 100644
(file)
--- a/
src/be/nikiroo/fanfix/output/Text.java
+++ b/
src/be/nikiroo/fanfix/output/Text.java
@@
-5,7
+5,6
@@
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
-import java.net.URL;
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.bundles.StringId;
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.bundles.StringId;
@@
-18,12
+17,13
@@
import be.nikiroo.fanfix.data.Story;
class Text extends BasicOutput {
protected BufferedWriter writer;
protected File targetDir;
class Text extends BasicOutput {
protected BufferedWriter writer;
protected File targetDir;
+ private boolean nextParaIsCover = true;
@Override
public File process(Story story, File targetDir, String targetName)
throws IOException {
String targetNameOrig = targetName;
@Override
public File process(Story story, File targetDir, String targetName)
throws IOException {
String targetNameOrig = targetName;
- targetName += getDefaultExtension();
+ targetName += getDefaultExtension(
false
);
this.targetDir = targetDir;
this.targetDir = targetDir;
@@
-42,7
+42,7
@@
class Text extends BasicOutput {
}
@Override
}
@Override
- public String getDefaultExtension() {
+ public String getDefaultExtension(
boolean readerTarget
) {
return ".txt";
}
return ".txt";
}
@@
-105,8
+105,16
@@
class Text extends BasicOutput {
protected void writeParagraphHeader(Paragraph para) throws IOException {
if (para.getType() == ParagraphType.IMAGE) {
File file = new File(targetDir, getCurrentImageBestName(true));
protected void writeParagraphHeader(Paragraph para) throws IOException {
if (para.getType() == ParagraphType.IMAGE) {
File file = new File(targetDir, getCurrentImageBestName(true));
- Instance.getCache().saveAsImage(new URL(para.getContent()), file);
+ try {
+ Instance.getCache().saveAsImage(para.getContentImage(), file,
+ nextParaIsCover);
+ } catch (IOException e) {
+ Instance.getTraceHandler().error(
+ new IOException("Cannot save an image", e));
+ }
}
}
+
+ nextParaIsCover = false;
}
@Override
}
@Override