Junkfood

Food and Junk.

All | Food | Junk | Work

20050118 Tuesday January 18, 2005

Roller: Customizing Comment Details

Through experimentation, I've found that you can write macros that override the default implementation by Roller. On comments pages, email addresses (or IP addresses, if no email is provided) and websites are displayed by default. I don't like this behavior, so I wrote a macro that overrides it. The macro gets added to the top of the Weblog file, just after the DOCTYPE line.

#macro( showCommentDetails $comment $showPermalink )
    $dateFormatter.applyPattern($text.get( "macro.weblog.datepattern" ))
    #set($email = $utilities.hexEncode($comment.email))
    <p class="comment-details">
    $text.get("macro.weblog.postedby")
    #if (!$stringUtils.isEmpty($comment.name))
        <b>$comment.name</b>
    #else
        <b>Anonymous</b>
    #end
    $text.get("macro.weblog.on") $dateFormatter.format($comment.postTime)
    #if( $showPermalink )
    <a href=
"${ctxPath}/comments/${userName}/${page.link}/${entry.anchor}#comment${velocityCount}"
       class="entrypermalink"
       title="$text.get( "macro.weblog.commentpermalink.title" )">#</a>
    #end
    </p>
#end

The macro is intended for use with Roller 1.0. I'm not sure whether it works with other versions.

(2005-01-18 08:00:00.0) Permalink | Comments [2]

Calendar

« January 2005 »
SunMonTueWedThuFriSat
      
1
2
3
4
5
6
7
8
9
10
13
15
16
17
22
23
26
28
29
30
31
     
Today

Recent Entries

Search

Navigation



XML