Hack to fix [link](<s p a c e s>).

Fixes #80.
This commit is contained in:
Michel Fortin 2014-05-04 21:30:14 -04:00
parent c0a3a825d4
commit b39fb9b4bc

View file

@ -617,6 +617,12 @@ class Markdown implements MarkdownInterface {
$url = $matches[3] == '' ? $matches[4] : $matches[3];
$title =& $matches[7];
// if the URL was of the form <s p a c e s> it got caught by the HTML
// tag parser and hashed. Need to reverse the process before using the URL.
$unhashed = $this->unhash($url);
if ($unhashed != $url)
$url = preg_replace('/^<(.*)>$/', '\1', $unhashed);
$url = $this->encodeAttribute($url);
$result = "<a href=\"$url\"";
@ -2317,6 +2323,11 @@ abstract class _MarkdownExtra_TmpImpl extends \Michelf\Markdown {
$title =& $matches[7];
$attr = $this->doExtraAttributes("a", $dummy =& $matches[8]);
// if the URL was of the form <s p a c e s> it got caught by the HTML
// tag parser and hashed. Need to reverse the process before using the URL.
$unhashed = $this->unhash($url);
if ($unhashed != $url)
$url = preg_replace('/^<(.*)>$/', '\1', $unhashed);
$url = $this->encodeAttribute($url);