diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index d86ba4543..d7324a4ad 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -66,6 +66,20 @@ function stripdcode_br_cb($s) {
}
+function diaspora_ul($s) {
+ return str_replace('[\\*]', "* ", $s[1]);
+}
+
+
+function diaspora_ol($s) {
+ // A hack: Diaspora will create a properly-numbered ordered list even
+ // if you use '1.' for each element of the list, like:
+ // 1. First element
+ // 1. Second element
+ // 1. Third element
+ return str_replace('[\\*]', "1. ", $s[1]);
+}
+
function bb2diaspora($Text,$preserve_nl = false) {
@@ -124,38 +138,45 @@ function bb2diaspora($Text,$preserve_nl = false) {
// Check for bold text
$Text = preg_replace("(\[b\](.*?)\[\/b\])is",'**$1**',$Text);
- // Check for Italics text
+ // Check for italics text
$Text = preg_replace("(\[i\](.*?)\[\/i\])is",'_$1_',$Text);
- // Check for Underline text
-// $Text = preg_replace("(\[u\](.*?)\[\/u\])is",'$1',$Text);
+ // Check for underline text
+ // Replace with italics since Diaspora doesn't have underline
+ $Text = preg_replace("(\[u\](.*?)\[\/u\])is",'_$1_',$Text);
// Check for strike-through text
-// $Text = preg_replace("(\[s\](.*?)\[\/s\])is",'$1',$Text);
+ $Text = preg_replace("(\[s\](.*?)\[\/s\])is",'**[strike]**$1**[/strike]**',$Text);
// Check for over-line text
// $Text = preg_replace("(\[o\](.*?)\[\/o\])is",'$1',$Text);
// Check for colored text
-// $Text = preg_replace("(\[color=(.*?)\](.*?)\[\/color\])is","$2",$Text);
+ // Remove color since Diaspora doesn't support it
+ $Text = preg_replace("(\[color=(.*?)\](.*?)\[\/color\])is","$2",$Text);
// Check for sized text
-// $Text = preg_replace("(\[size=(.*?)\](.*?)\[\/size\])is","$2",$Text);
+ // Remove it since Diaspora doesn't support sizes very well
+ $Text = preg_replace("(\[size=(.*?)\](.*?)\[\/size\])is","$2",$Text);
// Check for list text
-// $Text = preg_replace("/\[list\](.*?)\[\/list\]/is", '
$1'; // Check for [quote] text $Text = preg_replace("/\[quote\](.*?)\[\/quote\]/is",">$1\n\n", $Text); + $Text = preg_replace("/\[quote=(.*?)\](.*?)\[\/quote\]/is",">$2\n\n", $Text); // Images @@ -191,9 +213,9 @@ function bb2diaspora($Text,$preserve_nl = false) { // [img=widthxheight]image source[/img] // $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/", '', $Text); - $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/youtube\]/ism",'http://www.youtube.com/watch?v=$1',$Text); - $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/embed\/(.*?)\[\/youtube\]/ism",'http://www.youtube.com/watch?v=$1',$Text); - $Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/ism",'http://www.youtube.com/watch?v=$1',$Text); + $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/youtube\]/ism",'http://www.youtube.com/watch?v=$1',$Text); + $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/embed\/(.*?)\[\/youtube\]/ism",'http://www.youtube.com/watch?v=$1',$Text); + $Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/ism",'http://www.youtube.com/watch?v=$1',$Text); $Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", 'http://www.youtube.com/watch?v=$1', $Text); $Text = preg_replace("/\[vimeo\]https?:\/\/player.vimeo.com\/video\/([0-9]+)(.*?)\[\/vimeo\]/ism",'http://vimeo.com/$1',$Text);