]> git.mxchange.org Git - friendica.git/commitdiff
Changed markdown to enable diaspora postings with images that contain links
authorMichael Vogel <icarus@dabo.de>
Wed, 1 Aug 2012 23:46:28 +0000 (01:46 +0200)
committerMichael Vogel <icarus@dabo.de>
Wed, 1 Aug 2012 23:46:28 +0000 (01:46 +0200)
include/bb2diaspora.php
include/markdownify/markdownify.php

index b95dee8f3b4b67541c9052b1cdba9cbcea83ec05..9ede42f6c7a66fab7597566296584d4e3968c3fc 100644 (file)
@@ -202,9 +202,9 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
        // the following was added on 10-January-2012 due to an inability of Diaspora's
        // new javascript markdown processor to handle links with images as the link "text"
        // It is not optimal and may be removed if this ability is restored in the future
-       if ($fordiaspora)
-               $Text = preg_replace("/\[url\=([^\[\]]*)\]\s*\[img\](.*?)\[\/img\]\s*\[\/url\]/ism",
-                                       "[url]$1[/url]\n[img]$2[/img]", $Text);
+       //if ($fordiaspora)
+       //      $Text = preg_replace("/\[url\=([^\[\]]*)\]\s*\[img\](.*?)\[\/img\]\s*\[\/url\]/ism",
+       //                              "[url]$1[/url]\n[img]$2[/img]", $Text);
 
        // Convert it to HTML - don't try oembed
        $Text = bbcode($Text, $preserve_nl, false);
index 7bbf1cbbed60c9047ff793bac8c104c4cdb97f27..0d4429a01336e10d9ce17ab43170201ae874bef1 100644 (file)
@@ -686,6 +686,10 @@ class Markdownify {
         #  [1]: mailto:mail@example.com Title
         $tag['href'] = 'mailto:'.$bufferDecoded;
       }
+
+      $this->out('['.$buffer.']('.$tag['href'].' "'.$tag['title'].'")', true);
+
+/*
       # [This link][id]
       foreach ($this->stack['a'] as $tag2) {
         if ($tag2['href'] == $tag['href'] && $tag2['title'] === $tag['title']) {
@@ -699,6 +703,7 @@ class Markdownify {
       }
 
       $this->out('['.$buffer.']['.$tag['linkID'].']', true);
+*/
     }
   }
   /**
@@ -737,7 +742,7 @@ class Markdownify {
 
 // ![Alt text](/path/to/img.jpg "Optional title")
     if ($this->parser->tagAttributes['title'] != "")
-      $this->out('!['.$this->parser->tagAttributes['alt'].']('.$this->parser->tagAttributes['src'].'"'.$this->parser->tagAttributes['title'].'")', true);
+      $this->out('!['.$this->parser->tagAttributes['alt'].']('.$this->parser->tagAttributes['src'].' "'.$this->parser->tagAttributes['title'].'")', true);
     else
       $this->out('!['.$this->parser->tagAttributes['alt'].']('.$this->parser->tagAttributes['src'].')', true);