git://git.nikiroo.be
/
gofetch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Version 1.0.0: add Le Monde support
[gofetch.git]
/
src
/
be
/
nikiroo
/
gofetch
/
output
/
Html.java
diff --git
a/src/be/nikiroo/gofetch/output/Html.java
b/src/be/nikiroo/gofetch/output/Html.java
index 5b022d1f8789224a1ea11514bc55ac42da01b47f..0f4c5a436b602ce6cf8ef744fea8c9ce52c67350 100644
(file)
--- a/
src/be/nikiroo/gofetch/output/Html.java
+++ b/
src/be/nikiroo/gofetch/output/Html.java
@@
-18,13
+18,20
@@
public class Html extends Output {
String gopherUrl = "gopher://" + hostname + sel + ":" + port;
String gopherUrl = "gopher://" + hostname + sel + ":" + port;
- return "<h1>News</h1>\n"//
+ StringBuilder builder = new StringBuilder();
+ appendPre(builder);
+
+ builder.append("<h1>News</h1>\n"//
+ "<p>You will find here a few pages full of news, mirroring <a href='"
+ gopherUrl + "'>"
+ gopherUrl
+ "</a>.</p>\n"//
+ "<p>They are simply scrapped from their associated webpage and updated a few times a day.</p>\n"//
+ "<p>You will find here a few pages full of news, mirroring <a href='"
+ gopherUrl + "'>"
+ gopherUrl
+ "</a>.</p>\n"//
+ "<p>They are simply scrapped from their associated webpage and updated a few times a day.</p>\n"//
- ;
+ );
+
+ appendPost(builder);
+
+ return builder.toString();
}
@Override
}
@Override
@@
-76,6
+83,9
@@
public class Html extends Output {
builder.append("<head>\n");
builder.append(" <meta http-equiv='content-type' content='text/html; charset=utf-8'>\n");
builder.append(" <meta name='viewport' content='width=device-width, initial-scale=1.0'>\n");
builder.append("<head>\n");
builder.append(" <meta http-equiv='content-type' content='text/html; charset=utf-8'>\n");
builder.append(" <meta name='viewport' content='width=device-width, initial-scale=1.0'>\n");
+ builder.append(" <style type='text/css'>\n");
+ builder.append(" body { margin: 1em 15%; }\n");
+ builder.append(" </style>\n");
builder.append("</head>\n");
builder.append("<body>\n");
}
builder.append("</head>\n");
builder.append("<body>\n");
}
@@
-91,8
+101,11
@@
public class Html extends Output {
.append("</h2>\n");
builder.append(space).append(" <div class='by'>")
.append(comment.getAuthor()).append("</div>\n");
.append("</h2>\n");
builder.append(space).append(" <div class='by'>")
.append(comment.getAuthor()).append("</div>\n");
- builder.append(space).append(" <div class='comment_content'>")
- .append(comment.getContent()).append("</div>\n");
+ builder.append(space).append(" <div class='comment_content'>");
+ for (String line : comment.getContentLines()) {
+ builder.append("<p>" + line + "</p>");
+ }
+ builder.append("</div>\n");
for (Comment subComment : comment) {
appendHtml(builder, subComment, space + " ");
}
for (Comment subComment : comment) {
appendHtml(builder, subComment, space + " ");
}
@@
-107,8
+120,12
@@
public class Html extends Output {
} else {
builder.append(" <h1>" + story.getTitle() + "</h1>\n");
}
} else {
builder.append(" <h1>" + story.getTitle() + "</h1>\n");
}
- builder.append(" <div class='details'>(" + story.getDetails()
- + ")</div>\n");
+
+ builder.append(" <div class='details'>");
+ if (story.getDetails() != null && !story.getDetails().isEmpty()) {
+ builder.append("(").append(story.getDetails()).append(")");
+ }
+ builder.append("</div>\n");
builder.append(" <br/>\n");
if (!resume) {
builder.append(" <br/>\n");
if (!resume) {
@@
-123,11
+140,14
@@
public class Html extends Output {
builder.append(" <br/>\n");
}
builder.append(" <br/>\n");
}
- builder.append(" <div class='content'>\n");
+ builder.append(" <div class='content'
style='text-align: justify'
>\n");
if (resume) {
builder.append(" " + story.getContent() + "\n");
} else {
if (resume) {
builder.append(" " + story.getContent() + "\n");
} else {
- builder.append(" " + story.getFullContent() + "\n");
+ builder.append(" "
+ + story.getFullContent().replace("\n", "<br/>")
+ .replace("[ ", "<h2>").replace(" ]", "</h2>")
+ + "\n");
}
builder.append(" </div>\n");
}
builder.append(" </div>\n");