git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
FanfictionApi: fix NPE
[nikiroo-utils.git]
/
src
/
be
/
nikiroo
/
fanfix
/
reader
/
ui
/
GuiReaderViewerTextOutput.java
diff --git
a/src/be/nikiroo/fanfix/reader/ui/GuiReaderViewerTextOutput.java
b/src/be/nikiroo/fanfix/reader/ui/GuiReaderViewerTextOutput.java
index c5f7943c17ed9eab4a03eb0d0a22f4c3b3eeb26e..47d9664d384fd28ad9057590e1e08aec62467837 100644
(file)
--- a/
src/be/nikiroo/fanfix/reader/ui/GuiReaderViewerTextOutput.java
+++ b/
src/be/nikiroo/fanfix/reader/ui/GuiReaderViewerTextOutput.java
@@
-6,6
+6,7
@@
import java.util.Arrays;
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.data.Chapter;
import be.nikiroo.fanfix.data.Paragraph;
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.data.Chapter;
import be.nikiroo.fanfix.data.Paragraph;
+import be.nikiroo.fanfix.data.Paragraph.ParagraphType;
import be.nikiroo.fanfix.data.Story;
import be.nikiroo.fanfix.output.BasicOutput;
import be.nikiroo.fanfix.data.Story;
import be.nikiroo.fanfix.output.BasicOutput;
@@
-41,10
+42,7
@@
public class GuiReaderViewerTextOutput {
builder.append(chap.getName());
builder.append("</H1>");
builder.append(chap.getName());
builder.append("</H1>");
- builder.append("<JUSTIFY>");
- for (Paragraph para : chap) {
- writeParagraph(para);
- }
+ builder.append("<DIV align='justify'>");
}
@Override
}
@Override
@@
-54,33
+52,41
@@
public class GuiReaderViewerTextOutput {
}
paraInQuote = false;
}
paraInQuote = false;
- builder.append("</
JUSTIFY
>");
+ builder.append("</
DIV
>");
builder.append("</HTML>");
}
@Override
protected void writeParagraph(Paragraph para) throws IOException {
builder.append("</HTML>");
}
@Override
protected void writeParagraph(Paragraph para) throws IOException {
+ if ((para.getType() == ParagraphType.QUOTE) == !paraInQuote) {
+ paraInQuote = !paraInQuote;
+ if (paraInQuote) {
+ builder.append("<BR>");
+ builder.append("<DIV>");
+ } else {
+ builder.append("</DIV>");
+ builder.append("<BR>");
+ }
+ }
+
switch (para.getType()) {
case NORMAL:
switch (para.getType()) {
case NORMAL:
+ builder.append(" ");
builder.append(decorateText(para.getContent()));
builder.append("<BR>");
break;
case BLANK:
builder.append(decorateText(para.getContent()));
builder.append("<BR>");
break;
case BLANK:
- builder.append("<BR>");
+ builder.append("<BR>
<BR>
");
break;
case BREAK:
break;
case BREAK:
- builder.append("<BR>* * *<BR><BR>");
+ builder.append("<BR><P COLOR='#7777DD' ALIGN='CENTER'><B>");
+ builder.append("* * *");
+ builder.append("</B></P><BR><BR>");
break;
case QUOTE:
break;
case QUOTE:
- if (!paraInQuote) {
- builder.append("<DIV>");
- } else {
- builder.append("</DIV>");
- }
- paraInQuote = !paraInQuote;
-
builder.append("<DIV>");
builder.append("<DIV>");
- builder.append("– ");
+ builder.append(" ");
+ builder.append("— ");
builder.append(decorateText(para.getContent()));
builder.append("</DIV>");
builder.append(decorateText(para.getContent()));
builder.append("</DIV>");
@@
-91,7
+97,7
@@
public class GuiReaderViewerTextOutput {
@Override
protected String enbold(String word) {
@Override
protected String enbold(String word) {
- return "<B COLOR='
BLUE
'>" + word + "</B>";
+ return "<B COLOR='
#7777DD
'>" + word + "</B>";
}
@Override
}
@Override