summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2017-04-24 17:39:40 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2017-04-24 21:10:02 +0200
commit362ee754e7d28c36f74b7feee03e529a380dd379 (patch)
treec17b49ce15a117956a61a8d7c763211af6396349
parent136171e509b78d89b095bc5599bc158acd1250e7 (diff)
downloadaur-362ee754e7d28c36f74b7feee03e529a380dd379.tar.gz
aur-362ee754e7d28c36f74b7feee03e529a380dd379.tar.xz
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>
-rwxr-xr-xaurweb/scripts/rendercomment.py4
-rwxr-xr-xtest/t2600-rendercomment.sh2
2 files changed, 3 insertions, 3 deletions
diff --git a/aurweb/scripts/rendercomment.py b/aurweb/scripts/rendercomment.py
index 659e18ad..c23ef8de 100755
--- a/aurweb/scripts/rendercomment.py
+++ b/aurweb/scripts/rendercomment.py
@@ -86,9 +86,9 @@ def main():
conn = aurweb.db.Connection()
text, pkgbase = get_comment(conn, commentid)
- html = markdown.markdown(text, extensions=['nl2br', LinkifyExtension(),
+ html = markdown.markdown(text, extensions=[LinkifyExtension(),
GitCommitsExtension(pkgbase)])
- allowed_tags = bleach.sanitizer.ALLOWED_TAGS + ['p', 'br']
+ allowed_tags = bleach.sanitizer.ALLOWED_TAGS + ['p']
html = bleach.clean(html, tags=allowed_tags)
save_rendered_comment(conn, commentid, html)
diff --git a/test/t2600-rendercomment.sh b/test/t2600-rendercomment.sh
index 8da15291..edf290cd 100755
--- a/test/t2600-rendercomment.sh
+++ b/test/t2600-rendercomment.sh
@@ -12,7 +12,7 @@ test_expect_success 'Test comment rendering.' '
EOD
"$RENDERCOMMENT" 1 &&
cat <<-EOD >expected &&
- <p>Hello world!<br>
+ <p>Hello world!
This is a comment.</p>
EOD
cat <<-EOD | sqlite3 aur.db >actual &&