// The bbcode parser now handles youtube-links (and the other stuff) correctly.
// Additionally the html code is now fixed so that lists are now working.
+ // Converting images with size parameters to simple images. Markdown doesn't know it.
+ $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $Text);
+
+ // 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
+ $Text = preg_replace("/\[url\=([^\[\]]*)\]\[img\](.*?)\[\/img\]\[\/url\]/ism",
+ "[img]$2[/img]\n[url]$1[/url]", $Text);
+
// Convert it to HTML - don't try oembed
$Text = bbcode($Text, $preserve_nl, false);
$a = get_app();
+ // Move all spaces out of the tags
+ $Text = preg_replace("/\[(\w*)\](\s*)/ism", '$2[$1]', $Text);
+ $Text = preg_replace("/(\s*)\[\/(\w*)\]/ism", '[/$2]$1', $Text);
+
// Hide all [noparse] contained bbtags by spacefying them
// POSSIBLE BUG --> Will the 'preg' functions crash if there's an embedded image?
$this->parser->tagAttributes['src'] = $this->decode($this->parser->tagAttributes['src']);
}
+// ![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);
+ else
+ $this->out('!['.$this->parser->tagAttributes['alt'].']('.$this->parser->tagAttributes['src'].')', true);
+
+/*
# [This link][id]
$link_id = false;
if (!empty($this->stack['a'])) {
}
$this->out('!['.$this->parser->tagAttributes['alt'].']['.$link_id.']', true);
+*/
}
/**
* handle <code> tags
function parent() {
return end($this->parser->openTags);
}
-}
\ No newline at end of file
+}