From d0cb8cdccfc0260ec00468079769e3615df06774 Mon Sep 17 00:00:00 2001
From: Hypolite Petovan
Date: Mon, 5 Dec 2016 22:47:52 -0500
Subject: [PATCH] Fixs edge case where single stars on succeeding lines are
wrongly turned into multi-line
---
include/bb2diaspora.php | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index d6bff9ab5..933055b1b 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -22,6 +22,9 @@ function diaspora2bb($s) {
$s = str_replace("\n", " \n", $s);
+ // Replace lonely stars in lines not starting with it with literal stars
+ $s = preg_replace('/^([^\*]+)\*([^\*]*)$/im', '$1\*$2', $s);
+
// The parser cannot handle paragraphs correctly
$s = str_replace(array('
', '', '
'), array('
', '
', '
'), $s);