Do not keep line breaks in comments

With the new Markdown support, text paragraphs are now properly
converted to HTML paragraphs, so we no longer need to keep line breaks.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2017-04-24 17:39:40 +02:00
parent 136171e509
commit 362ee754e7
2 changed files with 3 additions and 3 deletions

View file

@ -86,9 +86,9 @@ def main():
conn = aurweb.db.Connection() conn = aurweb.db.Connection()
text, pkgbase = get_comment(conn, commentid) text, pkgbase = get_comment(conn, commentid)
html = markdown.markdown(text, extensions=['nl2br', LinkifyExtension(), html = markdown.markdown(text, extensions=[LinkifyExtension(),
GitCommitsExtension(pkgbase)]) GitCommitsExtension(pkgbase)])
allowed_tags = bleach.sanitizer.ALLOWED_TAGS + ['p', 'br'] allowed_tags = bleach.sanitizer.ALLOWED_TAGS + ['p']
html = bleach.clean(html, tags=allowed_tags) html = bleach.clean(html, tags=allowed_tags)
save_rendered_comment(conn, commentid, html) save_rendered_comment(conn, commentid, html)

View file

@ -12,7 +12,7 @@ test_expect_success 'Test comment rendering.' '
EOD EOD
"$RENDERCOMMENT" 1 && "$RENDERCOMMENT" 1 &&
cat <<-EOD >expected && cat <<-EOD >expected &&
<p>Hello world!<br> <p>Hello world!
This is a comment.</p> This is a comment.</p>
EOD EOD
cat <<-EOD | sqlite3 aur.db >actual && cat <<-EOD | sqlite3 aur.db >actual &&