1 2 3 4 5 6 7 8 9 | import re
from django.utils.encoding import smart_unicode
r_lightbox = re.compile('<a (?=[^>]*\.(jpg|gif|png))(?![^>]*lightbox)')
s_lightbox = '<a rel="lightbox" '
@register.filter
def lightbox(content):
return r_lightbox.sub(s_lightbox, smart_unicode(content))
|
More like this
- slug filename by willhardy 2 years, 6 months ago
- Template tag to sort a list of links by pytechd 4 years, 5 months ago
- YUI Loader as Django middleware by akaihola 3 years, 9 months ago
- Template tags to integrate with modconcat by matthanger 2 years, 6 months ago
- Better Static Image Serving With Fallback by menendez 1 year, 10 months ago
Comments