Merge pull request #150 from Sommerregen/bugfix/parsedown-handle-empty-html-anchors

Changed Twig Link Regex which fixes #149 [Markdown Doesn't Handle [words](#)
This commit is contained in:
Andy Miller
2015-03-08 19:17:16 -06:00

View File

@@ -19,7 +19,7 @@ trait ParsedownGravTrait
protected $pages_dir;
protected $special_chars;
protected $twig_link_regex = '/\!*\[(?:.*)\]\(([{{|{%|{#].*[#}|%}|}}])\)/';
protected $twig_link_regex = '/\!*\[(?:.*)\]\((\{([\{%#])\s*(.*?)\s*(?:\2|\})\})\)/';
/**
* Initialiazation function to setup key variables needed by the MarkdownGravLinkTrait
@@ -227,7 +227,7 @@ trait ParsedownGravTrait
$url = parse_url(htmlspecialchars_decode($excerpt['element']['attributes']['href']));
// if there is no scheme, the file is local
if (!isset($url['scheme'])) {
if (!isset($url['scheme']) and (count($url) > 0)) {
// convert the URl is required
$excerpt['element']['attributes']['href'] = $this->convertUrl(Uri::buildUrl($url));
}