Version 0.2.0: supports LWN, quotes, <br>s
[gofetch.git] / src / be / nikiroo / gofetch / output / Gopher.java
index 3fa6035c328d3f0731f5bc3a81ce7e38f3220abb..6dcb4aa8b284777bff8338c530e83d225e8b0ba5 100644 (file)
@@ -65,13 +65,30 @@ public class Gopher extends Output {
                        space = space.substring(0, LINE_SIZE - 20);
                }
 
-               appendLeft(builder, comment.getTitle(), ">> ", "   ", space);
+               appendLeft(builder, comment.getTitle(), "** ", "   ", space);
                appendLeft(builder, "(" + comment.getAuthor() + ")", "   ", "   ",
                                space);
 
                builder.append("i\r\n");
 
-               appendLeft(builder, comment.getContent(), "   ", "   ", space);
+               for (String line : comment.getContentLines()) {
+                       int depth = 0;
+                       while (line.length() > depth && line.charAt(depth) == '>') {
+                               depth++;
+                       }
+                       line = line.substring(depth).trim();
+
+                       String prep = "   ";
+                       for (int i = 0; i < depth; i++) {
+                               prep += ">";
+                       }
+
+                       if (depth > 0) {
+                               prep += " ";
+                       }
+
+                       appendLeft(builder, line, prep, prep, space);
+               }
 
                builder.append("i\r\n");
                for (Comment subComment : comment) {