Work around bug(?) in BeautifulSoup entity handling

This commit is contained in:
Jason McBrayer 2018-06-06 17:13:26 -04:00
parent dc5d5f4176
commit 3390266b29
1 changed files with 2 additions and 0 deletions

View File

@ -21,6 +21,7 @@ def relink_tags(value):
FIXME: handle arbitrary tag links
'''
value = value.replace(''', "'")
soup = BeautifulSoup(value, 'html.parser')
for link in soup.find_all('a', class_='hashtag'):
link['href'] = reverse('tag', args=[link.span.string])
@ -36,6 +37,7 @@ def relink_mentions(value):
FIXME: handle arbitrary mention links
'''
value = value.replace(''', "'")
soup = BeautifulSoup(value, 'html.parser')
for link in soup.find_all('a', class_='mention'):
parsed = parse.urlparse(link['href'])