diff --git a/brutaldon/templatetags/taglinks.py b/brutaldon/templatetags/taglinks.py index b495868..8b95256 100644 --- a/brutaldon/templatetags/taglinks.py +++ b/brutaldon/templatetags/taglinks.py @@ -2,9 +2,15 @@ from django import template from bs4 import BeautifulSoup from urllib import parse from django.urls import reverse +from pdb import set_trace register = template.Library() +@register.filter +def pdb(element): + set_trace() + return element + @register.filter def relink_tags(value): '''Treat the text as html, and replace tag links with app-internal tag links @@ -18,7 +24,7 @@ def relink_tags(value): soup = BeautifulSoup(value, 'html.parser') for link in soup.find_all('a', class_='hashtag'): link['href'] = reverse('tag', args=[link.span.string]) - return soup.decode(formatter=None) + return soup.decode(formatter='html') @register.filter def relink_mentions(value): @@ -39,7 +45,7 @@ def relink_mentions(value): link['href'] = reverse('user', args=[user+'@'+instance]) except: continue - return soup.decode(formatter=None) + return soup.decode(formatter='html') @register.filter def relink_toot(value):