From cde5e524d51e5f504c65b4398d5485612df2f3a4 Mon Sep 17 00:00:00 2001
From: Dominique Fournier \\1
\n";
+ // Titre2
+ // ------
+ $search[] = "/^(.+)\\n--+$\\n/Um";
+ $replace[] = "\n\\1
\n";
+
+ $mark = preg_replace ($search, $replace, $mark);
+
+
+ $res = $this->paragraph ($mark);
+
+ return $res;
+ }
+
+ /** Translate the Markdown paragraph in HTML
+ return the html */
+ private function paragraph ($mark)
+ {
+$timeStart = microtime (TRUE);
+ // Initialization of convertions
+ $search = array ();
+ $replace = array ();
// SEPARATORS : *** --- ___ * * * - - - _ _ _
// Must be placed before EMPHASIS
$search[] = "/\\n^[*_-] ?[*_-] ?[*_-]$/Um";
@@ -75,31 +101,13 @@ class markdown
// # Title1
$search[] = "/\\n^# ([^#]+)(#*)$\\n/Um";
$replace[] = "
"; - // Titles with underline (SeText) - // Titre1 - // ====== - $search[] = "/\\n^(.+)\\n==+$\\n/Um"; - $replace[] = "
\n"; - // Titre2 - // ------ - $search[] = "/^(.+)\\n--+$\\n/Um"; - $replace[] = "\n
");
- $res .= "\n".str_repeat (" ", $indent)."<$type>";
+ debugMKD (str_repeat (" ", $indent)."<$typetmp>");
+ $res .= "\n".str_repeat (" ", $indent)."<$typetmp>";
if ($type === "ol" || $type === "ul")
{
debugMKD ("DEB2 : Adding li");
@@ -284,6 +294,14 @@ class markdown
array_pop ($htmlStack);
}
+ // If code, there is no emphasis, email, and other convertions
+ if ($type !== "code")
+ {
+ $timetmp = microtime (TRUE);
+ $lineTxt = preg_replace ($search, $replace, $lineTxt);
+ $timeregex += (microtime (TRUE) - $timetmp);
+ }
+
debugMKD ("$lineTxt");
$res .= "$lineTxt\n";
}
@@ -296,6 +314,9 @@ class markdown
$res .= "$type>\n";
}
+ debugMKD ("TimeInit=".($timeInit*1000)."ms");
+ debugMKD ("TimeRegex=".($timeregex*1000)."ms");
+ debugMKD ("TimeAll=".((microtime (TRUE) - $timeStart)*1000)."ms");
debugMKD ("-----------\n");
return $res;
}