import be.nikiroo.gofetch.data.Comment;
import be.nikiroo.gofetch.data.Story;
-import be.nikiroo.gofetch.support.BasicSupport.Type;
+import be.nikiroo.gofetch.support.BasicSupport;
+import be.nikiroo.gofetch.support.Type;
+import be.nikiroo.utils.StringUtils;
public class Html extends Output {
public Html(Type type, String hostname, String preselector, int port) {
}
@Override
- public String getIndexHeader() {
+ public String getMainIndexHeader() {
String sel = preselector;
if (!sel.isEmpty()) {
sel = "/1" + sel;
StringBuilder builder = new StringBuilder();
appendPre(builder);
- builder.append("<h1>News</h1>\n"//
+ builder.append("<h2>News</h2>\n"//
+ "<p>You will find here a few pages full of news, mirroring <a href='"
+ gopherUrl + "'>"
+ gopherUrl
}
@Override
- public String getIndexFooter() {
+ public String getMainIndexFooter() {
+ return "";
+ }
+
+ @Override
+ public String getIndexHeader(BasicSupport support) {
+ return "<h1>" + support.getDescription() + "</h1>\n<br/><br/>";
+ }
+
+ @Override
+ public String getIndexFooter(BasicSupport support) {
return "";
}
private void appendHtml(StringBuilder builder, Comment comment, String space) {
builder.append(space)
.append("<div class='comment' style='display: block; margin-left: 80px'>\n");
- builder.append(space).append(" <h2>").append(comment.getTitle())
- .append("</h2>\n");
- builder.append(space).append(" <div class='by'>")
+ builder.append(space).append(" <h3>").append(comment.getTitle())
+ .append("</h3>\n");
+ builder.append(space)
+ .append(" <div class='by' style='font-style: italic;'>")
.append(comment.getAuthor()).append("</div>\n");
builder.append(space).append(" <div class='comment_content'>");
for (String line : comment.getContentLines()) {
private StringBuilder appendHtml(StringBuilder builder, Story story,
boolean resume) {
if (resume) {
- builder.append(" <h1><a href='" + story.getId() + ".html'>"
- + story.getTitle() + "</a></h1>\n");
+ builder.append(" <h2><a href='" + story.getId() + ".html'>"
+ + story.getTitle() + "</a></h2>\n");
} else {
- builder.append(" <h1>" + story.getTitle() + "</h1>\n");
+ builder.append(" <h2>" + story.getTitle() + "</h2>\n");
}
builder.append(" <div class='details'>");
if (story.getDetails() != null && !story.getDetails().isEmpty()) {
- builder.append("(").append(story.getDetails()).append(")");
+ builder.append("(")
+ .append(StringUtils.xmlEscape(story.getDetails()))
+ .append(")");
}
builder.append("</div>\n");
builder.append(" <br/>\n");
if (!resume) {
builder.append(" <ul>\n");
+ builder.append(" <li>Reference: <a href=''>" + story.getId()
+ + "</a></li>\n");
builder.append(" <li>News link: <a href='"
+ story.getUrlInternal() + "'>" + story.getUrlInternal()
+ "</a></li>\n");
builder.append(" <div class='content' style='text-align: justify'>\n");
if (resume) {
- builder.append(" " + story.getContent() + "\n");
+ builder.append(" "
+ + StringUtils.xmlEscape(story.getContent()).replace("\n",
+ "<br/>") + "\n");
} else {
builder.append(" "
- + story.getFullContent().replace("\n", "<br/>")
- .replace("[ ", "<h2>").replace(" ]", "</h2>")
- + "\n");
+ + StringUtils.xmlEscape(story.getFullContent())
+ .replace("\n", "<br/>").replace("[ ", "<h3>")
+ .replace(" ]", "</h3>") + "\n");
}
builder.append(" </div>\n");