aboutsummaryrefslogtreecommitdiffstats
path: root/include/bb2diaspora.php
diff options
context:
space:
mode:
authorroot <root@zebra411.server4you.de>2012-02-19 22:47:32 +0100
committerroot <root@zebra411.server4you.de>2012-02-19 22:47:32 +0100
commitb6d7777226517dc22745bc3d78b827b0175bcb16 (patch)
tree2c9bee55b9d0364f0f1dd3c2095a806d67119dae /include/bb2diaspora.php
parent064c843119576c1345a61a531dfaa1076a54f3f0 (diff)
downloadvolse-hubzilla-b6d7777226517dc22745bc3d78b827b0175bcb16.tar.gz
volse-hubzilla-b6d7777226517dc22745bc3d78b827b0175bcb16.tar.bz2
volse-hubzilla-b6d7777226517dc22745bc3d78b827b0175bcb16.zip
New version of markdown. Playing with stylesheet. Testing line breaks.
Diffstat (limited to 'include/bb2diaspora.php')
-rwxr-xr-xinclude/bb2diaspora.php13
1 files changed, 6 insertions, 7 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index 9acd1e066..6f0ab3d28 100755
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -8,7 +8,7 @@ require_once('include/html2bbcode.php');
// we don't want to support a bbcode specific markdown interpreter
// and the markdown library we have is pretty good, but provides HTML output.
-// So we'll use that to convert to HTML, then convert the HTML back to bbcode,
+// So we'll use that to convert to HTML, then convert the HTML back to bbcode,
// and then clean up a few Diaspora specific constructs.
function diaspora2bb($s) {
@@ -35,17 +35,16 @@ function diaspora2bb($s) {
$s = str_replace('&#35;','#',$s);
- // Again: too many new lines
- //$s = str_replace("\n",'<br />',$s);
+ $s = str_replace("\n",'<br />',$s);
$s = html2bbcode($s);
// $s = str_replace('&#42;','*',$s);
- $s = preg_replace("/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism",'[youtube]$2[/youtube]',$s);
- $s = preg_replace("/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism",'[youtube]$1[/youtube]',$s);
- $s = preg_replace("/\[url\=?(.*?)\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism",'[vimeo]$2[/vimeo]',$s);
- $s = preg_replace("/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism",'[vimeo]$1[/vimeo]',$s);
+ $s = preg_replace("/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism",'[youtube]$2[/youtube]',$s);
+ $s = preg_replace("/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism",'[youtube]$1[/youtube]',$s);
+ $s = preg_replace("/\[url\=?(.*?)\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism",'[vimeo]$2[/vimeo]',$s);
+ $s = preg_replace("/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism",'[vimeo]$1[/vimeo]',$s);
$s = preg_replace("/([^\]\=]|^)(https?\:\/\/)(vimeo|youtu|www\.youtube|soundcloud)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url]$2$3$4[/url]',$s);
// remove duplicate adjacent code tags
$s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s);