@register.assignment_tag
def get_first_paragraph(body):
    if body is None:
        return ""

    cleaned_text = strip_tags(body)
    cleaned_text = re.sub("\s+", " ", cleaned_text)
    splitted = [t for t in cleaned_text.split(".") if len(t) > 80]
    return splitted and splitted[0] or cleaned_text[:80]
dataset/ETHPy150Open matagus/django-planet/planet/templatetags/planet_tags.py/get_first_paragraph/original