Changed markdown to enable diaspora postings with images that contain links
This commit is contained in:
parent
04c31d194f
commit
2aa67d67f5
2 changed files with 9 additions and 4 deletions
|
@ -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
|
// 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"
|
// 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
|
// It is not optimal and may be removed if this ability is restored in the future
|
||||||
if ($fordiaspora)
|
//if ($fordiaspora)
|
||||||
$Text = preg_replace("/\[url\=([^\[\]]*)\]\s*\[img\](.*?)\[\/img\]\s*\[\/url\]/ism",
|
// $Text = preg_replace("/\[url\=([^\[\]]*)\]\s*\[img\](.*?)\[\/img\]\s*\[\/url\]/ism",
|
||||||
"[url]$1[/url]\n[img]$2[/img]", $Text);
|
// "[url]$1[/url]\n[img]$2[/img]", $Text);
|
||||||
|
|
||||||
// Convert it to HTML - don't try oembed
|
// Convert it to HTML - don't try oembed
|
||||||
$Text = bbcode($Text, $preserve_nl, false);
|
$Text = bbcode($Text, $preserve_nl, false);
|
||||||
|
|
|
@ -686,6 +686,10 @@ class Markdownify {
|
||||||
# [1]: mailto:mail@example.com Title
|
# [1]: mailto:mail@example.com Title
|
||||||
$tag['href'] = 'mailto:'.$bufferDecoded;
|
$tag['href'] = 'mailto:'.$bufferDecoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->out('['.$buffer.']('.$tag['href'].' "'.$tag['title'].'")', true);
|
||||||
|
|
||||||
|
/*
|
||||||
# [This link][id]
|
# [This link][id]
|
||||||
foreach ($this->stack['a'] as $tag2) {
|
foreach ($this->stack['a'] as $tag2) {
|
||||||
if ($tag2['href'] == $tag['href'] && $tag2['title'] === $tag['title']) {
|
if ($tag2['href'] == $tag['href'] && $tag2['title'] === $tag['title']) {
|
||||||
|
@ -699,6 +703,7 @@ class Markdownify {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->out('['.$buffer.']['.$tag['linkID'].']', true);
|
$this->out('['.$buffer.']['.$tag['linkID'].']', true);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -737,7 +742,7 @@ class Markdownify {
|
||||||
|
|
||||||
// ![Alt text](/path/to/img.jpg "Optional title")
|
// ![Alt text](/path/to/img.jpg "Optional title")
|
||||||
if ($this->parser->tagAttributes['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
|
else
|
||||||
$this->out('!['.$this->parser->tagAttributes['alt'].']('.$this->parser->tagAttributes['src'].')', true);
|
$this->out('!['.$this->parser->tagAttributes['alt'].']('.$this->parser->tagAttributes['src'].')', true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue