X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fgofetch%2Foutput%2FGopher.java;h=12a420cd84482b988cde4775c6b29f3962fe574b;hb=3e62b034c1981ae6329f06b3f8c0ee25c3683789;hp=7120dfac47f361011b9fbcf887af0003642765d3;hpb=accfac8e88fcffde66cb5665353bc5cc69e288fa;p=gofetch.git diff --git a/src/be/nikiroo/gofetch/output/Gopher.java b/src/be/nikiroo/gofetch/output/Gopher.java index 7120dfa..12a420c 100644 --- a/src/be/nikiroo/gofetch/output/Gopher.java +++ b/src/be/nikiroo/gofetch/output/Gopher.java @@ -2,7 +2,7 @@ package be.nikiroo.gofetch.output; import be.nikiroo.gofetch.data.Comment; import be.nikiroo.gofetch.data.Story; -import be.nikiroo.gofetch.support.BasicSupport.Type; +import be.nikiroo.gofetch.support.Type; import be.nikiroo.utils.StringUtils; import be.nikiroo.utils.StringUtils.Alignment; @@ -68,10 +68,13 @@ public class Gopher extends Output { } appendLeft(builder, menu, comment.getTitle(), "** ", " ", space); - appendLeft(builder, menu, "(" + comment.getAuthor() + ")", " ", - " ", space); - builder.append((menu ? "i" : "") + "\r\n"); + if (comment.getAuthor() != null + && !comment.getAuthor().trim().isEmpty()) { + appendLeft(builder, menu, "(" + comment.getAuthor() + ")", " ", + " ", space); + builder.append((menu ? "i" : "") + "\r\n"); + } for (String line : comment.getContentLines()) { int depth = 0; @@ -118,6 +121,7 @@ public class Gopher extends Output { builder.append("\r\n"); appendJustified(builder, false, story.getFullContent(), " "); + builder.append("\r\n"); } else { builder.append('0').append(story.getTitle()) // .append('\t').append(story.getSelector()) // @@ -127,11 +131,13 @@ public class Gopher extends Output { appendJustified(builder, true, story.getDetails(), " "); builder.append("i\r\n"); - appendJustified(builder, true, story.getContent(), " "); + String content = story.getContent(); + if (!content.isEmpty()) { + appendJustified(builder, true, content, " "); + builder.append("i\r\n"); + } } - builder.append(resume ? "i" : "").append("\r\n"); - return builder; }