@register.filter(name='highlightpattern') def highlightpattern(string, pattern, points=None, opentag='', closetag='', autoescape=None): """ Highlights the pattern in the text. """ def findall(s, x): start, end = 0, len(s) while start