Permalink
Browse files

Merge pull request #189 from geekman/master

Expose count in each Tag for templates
  • Loading branch information...
2 parents e2b81aa + ce81e4a commit 9562b8ff673e68ac686f5aa4e18941d9af4ac523 @posativ committed Nov 27, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 acrylamid/views/tag.py
@@ -51,7 +51,7 @@ def __init__(self, tags, steps=4, max_items=100, start=0, shuffle=False):
key=lambda x: x[0])[:max_items]
# stolen from pelican/generators.py:286
max_count = max(lst, key=lambda k: k[1])[1] if lst else None
- self.lst = [(tag,
+ self.lst = [(tag, count,
int(math.floor(steps - (steps - 1) * math.log(count)
/ (math.log(max_count) or 1)))+start-1)
for tag, count in lst]
@@ -62,8 +62,8 @@ def __init__(self, tags, steps=4, max_items=100, start=0, shuffle=False):
self.tags = tags
def __iter__(self):
- for tag, step in self.lst:
- yield type('Tag', (), {'name': tag, 'step': step})
+ for tag, count, step in self.lst:
+ yield type('Tag', (), {'name': tag, 'step': step, 'count': count})
def __hash__(self):
return hash(*self.lst)

0 comments on commit 9562b8f

Please sign in to comment.