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
This commit is contained in:
2014-06-25 14:30:55 +00:00
parent 5f81675c8b
commit 01b95a2b95

View File

@@ -33,6 +33,11 @@ class markdown
$search[] = "/^(.+)\\n--+$\\n/Um"; $search[] = "/^(.+)\\n--+$\\n/Um";
$replace[] = "\n<h2>\\1</h2>\n"; $replace[] = "\n<h2>\\1</h2>\n";
// SEPARATORS : *** --- ___ * * * - - - _ _ _
// Must be placed before EMPHASIS
$search[] = "/^[*_-] ?[*_-] ?[*_-]$/Um";
$replace[] = "</p>\n<hr/>\n<p>";
$mark = preg_replace ($search, $replace, $mark); $mark = preg_replace ($search, $replace, $mark);
@@ -46,16 +51,12 @@ class markdown
return the html */ return the html */
private function paragraph ($mark) private function paragraph ($mark)
{ {
// Think thereis already htmlentities passed on $mark !!!
$timeStart = microtime (TRUE); $timeStart = microtime (TRUE);
$timeregex = 0; $timeregex = 0;
// Initialization of convertions // Initialization of convertions
$search = array (); $search = array ();
$replace = array (); $replace = array ();
// SEPARATORS : *** --- ___ * * * - - - _ _ _
// Must be placed before EMPHASIS
$search[] = "/\\n^[*_-] ?[*_-] ?[*_-]$/Um";
$replace[] = "</p>\n<hr/>\n<p>";
// Titles short // Titles short
// == TITRE1 // == TITRE1
$search[] = "/^==+ (.+)( ==+)?$/Um"; $search[] = "/^==+ (.+)( ==+)?$/Um";
@@ -82,8 +83,8 @@ class markdown
// Automatics links : // Automatics links :
// <http://dominique.fournier38.fr> // <http://dominique.fournier38.fr>
// <dominique@fournier38.fr> // <dominique@fournier38.fr>
$search[] = "(\<(https?://.+)\>)"; $replace[] = "<a href='\\1'>\\1</a>"; $search[] = "#&lt;(https?://.+)&gt;#"; $replace[] = "<a href='\\1'>\\1</a>";
$search[] = "(\<(.+@.+)\>)"; $replace[] = "<a href='mailto:\\1'>\\1</a>"; $search[] = "#&lt;(.+@.+)&gt#"; $replace[] = "<a href='mailto:\\1'>\\1</a>";
// TODO : Links by reference : // TODO : Links by reference :
// Voici un petit texte écrit par [Michel Fortin][mf]. // Voici un petit texte écrit par [Michel Fortin][mf].
// [mf]: http://michelf.ca/ "Mon site web" // [mf]: http://michelf.ca/ "Mon site web"