widget/reply: paragraph breaks on input lines unless trailing spaces
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 14 May 2021 14:18:09 +0000 (16:18 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 17 May 2021 18:53:38 +0000 (20:53 +0200)
Expect stories not poems, so hard line breaks should rarely be intended.
Exceptions are possible using Markdown syntax of trailing whitespace.

upload.inc.php

index e70f5738a3bfacafa1a4013b42f5905010c7d676..7810ff6e613da2e065264ae954c291a08b72f383 100644 (file)
@@ -52,8 +52,8 @@ function messagehtml($input)
                return $input;  # allow html input as is if privileged
        }
        $html = preg_replace(
-               ["/\r?\n/", "'(?:<br />\n?){2}'"],
-               ["<br />\n", "</p>\n\n<p>"],
+               ["/\r\n?/", "/  +\n/", "/\n/"],
+               ["\n",      "<br />",  "</p>\n<p>"],
                htmlspecialchars($input)
        );
        return "<p>$html</p>";