aboutsummaryrefslogtreecommitdiffstats
path: root/aggregator/templatetags/posts_extras.py
diff options
context:
space:
mode:
Diffstat (limited to 'aggregator/templatetags/posts_extras.py')
-rw-r--r--aggregator/templatetags/posts_extras.py10
1 files changed, 9 insertions, 1 deletions
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)