Browse Source

Better link handling

markseu 11 years ago
parent
commit
a48d2a9a37
3 changed files with 6 additions and 4 deletions
  1. 1 1
      README.md
  2. 3 1
      system/core/core-markdownextra.php
  3. 2 2
      system/core/core.php

+ 1 - 1
README.md

@@ -1,4 +1,4 @@
-Yellow 0.3.2
+Yellow 0.3.3
 ============
 Yellow is for people who make websites.
 

+ 3 - 1
system/core/core-markdownextra.php

@@ -5,7 +5,7 @@
 // Markdown extra core plugin
 class YellowMarkdownExtra
 {
-	const Version = "0.3.1";
+	const Version = "0.3.2";
 	var $yellow;		//access to API
 	
 	// Handle plugin initialisation
@@ -68,6 +68,8 @@ class YellowMarkdownExtraParser extends MarkdownExtraParser
 		$text = preg_replace_callback("/<(\w+:[^\'\">\s]+)>/", array(&$this, "_doAutoLinks_url_callback"), $text);
 		$text = preg_replace_callback("/<(\w+@[\w\-\.]+)>/", array(&$this, "_doAutoLinks_email_callback"), $text);
 		$text = preg_replace_callback("/\[(\w+)\s+(.*?)\]/", array(&$this, "_doAutoLinks_shortcut_callback"), $text);
+		$text = preg_replace_callback("/((http|https|ftp):\/\/\S+[^\'\"\,\.\;\:\s]+)/", array(&$this, "_doAutoLinks_url_callback"), $text);
+		$text = preg_replace_callback("/(\w+@[\w\-\.]+\.[\w]{2,4})/", array(&$this, "_doAutoLinks_email_callback"), $text);
 		return $text;
 	}
 	

+ 2 - 2
system/core/core.php

@@ -5,7 +5,7 @@
 // Yellow main class
 class Yellow
 {
-	const Version = "0.3.2";
+	const Version = "0.3.3";
 	var $page;				//current page
 	var $pages;				//pages from file system
 	var $config;			//configuration
@@ -1560,7 +1560,7 @@ class YellowToolbox
 	// Normalise location, make absolute location
 	function normaliseLocation($location, $pageBase, $pageLocation)
 	{
-		if(!preg_match("/^\w+:/", $location))
+		if(!preg_match("/^\w+:/", html_entity_decode($location, ENT_QUOTES, "UTF-8")))
 		{
 			if(preg_match("/^[^\/]+$/", $location))
 			{