Mercurial > hg > chronicle
changeset 132:7a05117f1bc3
Show plural comments correctly.
author | Steve Kemp <steve@steve.org.uk> |
---|---|
date | Thu, 20 Dec 2007 12:55:09 +0000 |
parents | b8ee2fcc22b6 |
children | b5fc6377b32e |
files | bin/chronicle themes/blog.steve.org.uk/bubbles.css themes/blog.steve.org.uk/index.template themes/blog.steve.org.uk/month.template themes/blog.steve.org.uk/tags.template |
diffstat | 5 files changed, 16 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/chronicle Thu Dec 20 12:15:42 2007 +0000 +++ b/bin/chronicle Thu Dec 20 12:55:09 2007 +0000 @@ -1289,10 +1289,13 @@ if ( defined($comments) ) { - my $count = scalar( @$comments ); - - $template->param( comments => $comments, - comment_count => $count ); + my $count = scalar( @$comments ); + my $plural = 1; + $plural = 0 if ( $count == 1 ); + + $template->param( comments => $comments, + comment_count => $count, + comment_plural => $plural ); $CONFIG{'verbose'} && print "$file [$filename] has $count comments\n"; } @@ -1552,7 +1555,11 @@ # Count comments. # $entry{'comment_count' } = countComments( $CONFIG{'comments'}, $entry{'link'} ); - + if ( defined $entry{'comment_count'} && + $entry{'comment_count'} != 1 ) + { + $entry{'comment_plural'} = 1; + } # # Store the read file in the cache if we're using it.
--- a/themes/blog.steve.org.uk/bubbles.css Thu Dec 20 12:15:42 2007 +0000 +++ b/themes/blog.steve.org.uk/bubbles.css Thu Dec 20 12:55:09 2007 +0000 @@ -10,7 +10,7 @@ margin: 0px; padding: 0px; border: 1px solid #c9c2c1; - background-color: #fff; + background-color: #eee; } div.bubble blockquote p {
--- a/themes/blog.steve.org.uk/index.template Thu Dec 20 12:15:42 2007 +0000 +++ b/themes/blog.steve.org.uk/index.template Thu Dec 20 12:55:09 2007 +0000 @@ -59,7 +59,7 @@ <div class="tags"> <!-- tmpl_if name='comment_count' --> <span class="comments"> - <a href="<!-- tmpl_var name='top' --><!-- tmpl_var name='link' escape='html' -->#comments"><!-- tmpl_var name='comment_count' --> comment(s)</a> + <a href="<!-- tmpl_var name='top' --><!-- tmpl_var name='link' escape='html' -->#comments"><!-- tmpl_var name='comment_count' --> comment<!-- tmpl_if name='comment_plural' -->s<!-- /tmpl_if --></a> </span> <!-- /tmpl_if -->
--- a/themes/blog.steve.org.uk/month.template Thu Dec 20 12:15:42 2007 +0000 +++ b/themes/blog.steve.org.uk/month.template Thu Dec 20 12:55:09 2007 +0000 @@ -67,7 +67,7 @@ <div class="tags"> <!-- tmpl_if name='comment_count' --> <span class="comments"> - <a href="<!-- tmpl_var name='top' --><!-- tmpl_var name='link' escape='html' -->#comments"><!-- tmpl_var name='comment_count' --> comment(s)</a> + <a href="<!-- tmpl_var name='top' --><!-- tmpl_var name='link' escape='html' -->#comments"><!-- tmpl_var name='comment_count' --> comment<!-- tmpl_if name='comment_plural' -->s<!-- /tmpl_if --></a> </span> <!-- /tmpl_if -->
--- a/themes/blog.steve.org.uk/tags.template Thu Dec 20 12:15:42 2007 +0000 +++ b/themes/blog.steve.org.uk/tags.template Thu Dec 20 12:55:09 2007 +0000 @@ -72,7 +72,7 @@ <div class="tags"> <!-- tmpl_if name='comment_count' --> <span class="comments"> - <a href="<!-- tmpl_var name='top' --><!-- tmpl_var name='link' escape='html' -->#comments"><!-- tmpl_var name='comment_count' --> comment(s)</a> + <a href="<!-- tmpl_var name='top' --><!-- tmpl_var name='link' escape='html' -->#comments"><!-- tmpl_var name='comment_count' --> comment<!-- tmpl_if name='comment_plural' -->s<!-- /tmpl_if --></a> </span> <!-- /tmpl_if -->