示例#1
0
 @Override
 public String renderComments(BlogEntry entry, List<Comment> comments) {
   VelocityContext commentsContext = new VelocityContext();
   commentsContext.put("entryURL", entry.getPermalink().substring(2));
   commentsContext.put("commentList", comments);
   StringWriter writer = new StringWriter();
   Template template = loadTemplate("comments.vm");
   template.merge(commentsContext, writer);
   return Util.replaceJournalLinks(writer.toString(), journal);
 }
示例#2
0
  @Override
  public String renderBlogEntry(BlogEntry entry) {
    VelocityContext entryContext = new VelocityContext();
    entryContext.put("entry", entry);
    BlogEntry prev = reader.getPreviousEntry(entry.getItemid());
    String prevURL = "";
    if (null != prev) {
      prevURL = prev.getPermalink().substring(2);
    }
    entryContext.put("prevURL", prevURL);

    BlogEntry next = reader.getNextEntry(entry.getItemid());
    String nextURL = "";
    if (null != next) {
      nextURL = next.getPermalink().substring(2);
    }
    entryContext.put("nextURL", nextURL);
    Template template = loadTemplate("blog_entry.vm");
    StringWriter writer = new StringWriter();
    template.merge(entryContext, writer);
    return Util.replaceJournalLinks(writer.toString(), journal);
  }