From 01b95a2b952761f4183c8bc48e3319e9b72e95d6 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Wed, 25 Jun 2014 14:30:55 +0000 Subject: [PATCH] BUG : * * * - - - shoud be SEPARATORS BUG : the mails/url are not working caused by htmlentities git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1485 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- markdown.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/markdown.php b/markdown.php index 3b25bb4..ea9abda 100644 --- a/markdown.php +++ b/markdown.php @@ -33,6 +33,11 @@ class markdown $search[] = "/^(.+)\\n--+$\\n/Um"; $replace[] = "\n

\\1

\n"; + // SEPARATORS : *** --- ___ * * * - - - _ _ _ + // Must be placed before EMPHASIS + $search[] = "/^[*_-] ?[*_-] ?[*_-]$/Um"; + $replace[] = "

\n
\n

"; + $mark = preg_replace ($search, $replace, $mark); @@ -46,16 +51,12 @@ class markdown return the html */ private function paragraph ($mark) { + // Think thereis already htmlentities passed on $mark !!! $timeStart = microtime (TRUE); $timeregex = 0; // Initialization of convertions $search = array (); $replace = array (); - // SEPARATORS : *** --- ___ * * * - - - _ _ _ - // Must be placed before EMPHASIS - $search[] = "/\\n^[*_-] ?[*_-] ?[*_-]$/Um"; - $replace[] = "

\n
\n

"; - // Titles short // == TITRE1 $search[] = "/^==+ (.+)( ==+)?$/Um"; @@ -82,8 +83,8 @@ class markdown // Automatics links : // // - $search[] = "(\<(https?://.+)\>)"; $replace[] = "\\1"; - $search[] = "(\<(.+@.+)\>)"; $replace[] = "\\1"; + $search[] = "#<(https?://.+)>#"; $replace[] = "\\1"; + $search[] = "#<(.+@.+)>#"; $replace[] = "\\1"; // TODO : Links by reference : // Voici un petit texte écrit par [Michel Fortin][mf]. // [mf]: http://michelf.ca/ "Mon site web"