make the username in quotes link to the userprofile

This commit is contained in:
Sebastian Hugentobler 2015-05-13 11:48:17 +02:00
parent a899e9f5a9
commit 4321607b7b

View File

@ -22,7 +22,7 @@ def url_replacer(value):
return value.replace('/', '_').replace(' ', '_').replace('?', '').replace('<', '').replace('>', '')
def user_replacer(match):
return '[url=../../user/' +url_replacer(match.group(2)) + '.html]' + match.group(2) + '[/url]'
return '[url=../../user/' + url_replacer(match.group(2)) + '.html]' + match.group(2) + '[/url]'
def tohtml(value):
value = value.replace('{{baseurl}}', 'static')
@ -37,7 +37,7 @@ def tohtml(value):
value = re.sub(r'\[img\](.*?)\[/img\]', r'<img src="\1">', value)
for i in range(25): # ugly hack but works good enough
value = re.sub(r'\[quote=(.+?)\](.+)\[/quote\]', r'<fieldset><legend>\1</legend>\2</fieldset>', value, count=1)
value = re.sub(r'\[quote=(.+?)\](.+)\[/quote\]', '<fieldset><legend>' + '<a href="../../user/' + url_replacer(r'\1') + '.html">' + r'\1</a></legend>\2</fieldset>', value, count=1)
for i in range(25): # same here, shut up
value = re.sub(r'\[quote\](.*?)\[/quote\]', r'<fieldset>\1</fieldset>', value)