diff options
Diffstat (limited to 'aggregator')
-rw-r--r-- | aggregator/templates/aggregator/posts.html | 2 | ||||
-rw-r--r-- | aggregator/templatetags/posts_extras.py | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/aggregator/templates/aggregator/posts.html b/aggregator/templates/aggregator/posts.html index 094ad25..14b3eda 100644 --- a/aggregator/templates/aggregator/posts.html +++ b/aggregator/templates/aggregator/posts.html @@ -11,7 +11,7 @@ <article class="post"> (<span class="keyword">defpost</span> <a href="{{ post.link }}" - class="variable-name">{{ post.title|slugify|nameless }}</a> + class="variable-name">{{ post.title|slugify|nameless|truncate:48 }}</a> (<img src="/static/images/logos/{{ post.icon }}" width="16" height="16"/>) <div class="doc"> diff --git a/aggregator/templatetags/posts_extras.py b/aggregator/templatetags/posts_extras.py index ca241b1..64718a2 100644 --- a/aggregator/templatetags/posts_extras.py +++ b/aggregator/templatetags/posts_extras.py @@ -7,6 +7,14 @@ register = template.Library() @stringfilter def nameless(value): - return re.sub(r'^(ryuslash|tom)[- ]?', '', value) + return re.sub(r'(^|by[- ])(ryuslash|tom)[- ]?', '', value) + +@stringfilter +def truncate(value, length): + if len(value) > length: + value = value[:length-3] + '...' + + return value register.filter('nameless', nameless) +register.filter('truncate', truncate) |