git » blitiri » commit 2d92063

Make the comment author a link only if the comment has a link attribute

author Leandro Lucarella
2008-08-10 04:52:13 UTC
committer Leandro Lucarella
2008-08-10 05:32:57 UTC
parent 7d653403b505dc4de30d1e7026922e9e144c77d6

Make the comment author a link only if the comment has a link attribute

blitiri.cgi +8 -2

diff --git a/blitiri.cgi b/blitiri.cgi
index 79e4171..d48b8eb 100755
--- a/blitiri.cgi
+++ b/blitiri.cgi
@@ -140,7 +140,7 @@ default_comment_header = """
 <div class="comment">
 <a name="comment-%(number)d" />
 <h3><a href="#comment-%(number)d">Comment #%(number)d</a></h3>
-<span class="cominfo">by <a href="%(link)s">%(author)s</a>
+<span class="cominfo">by %(linked_author)s
   on %(year)04d-%(month)02d-%(day)02d %(hour)02d:%(minute)02d</span>
 <p/>
 <div class="combody">
@@ -444,8 +444,14 @@ class Templates (object):
 			'art_footer', default_article_footer, article.to_vars())
 
 	def get_comment_header(self, comment):
+		vars = comment.to_vars()
+		if comment.link:
+			vars['linked_author'] = '<a href="%s">%s</a>' \
+					% (comment.link, comment.author)
+		else:
+			vars['linked_author'] = comment.author
 		return self.get_template(
-			'com_header', default_comment_header, comment.to_vars())
+			'com_header', default_comment_header, vars)
 
 	def get_comment_footer(self, comment):
 		return self.get_template(