From 06de6c8e17b0c3760dd8fe76b7a52217bb48bbac Mon Sep 17 00:00:00 2001 From: Sommerregen Date: Sun, 8 Mar 2015 19:24:48 +0100 Subject: [PATCH 1/2] Changed Twig Link Regex which fixes #149 [Markdown Doesn't Handle [words](#)] --- system/src/Grav/Common/Markdown/ParsedownGravTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php index e972e471c..1176c432f 100644 --- a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php +++ b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php @@ -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 From ed02fed866f61abfa4ddb86fe7fc4b1a4ea5da93 Mon Sep 17 00:00:00 2001 From: Sommerregen Date: Sun, 8 Mar 2015 20:01:30 +0100 Subject: [PATCH 2/2] Corrected HTML output of links with empty HTML anchors --- system/src/Grav/Common/Markdown/ParsedownGravTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php index 1176c432f..c507606bd 100644 --- a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php +++ b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php @@ -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)); }