markdown : Correct the <hr> stack (too much <p></p>)
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1486 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -36,7 +36,7 @@ class markdown
|
||||
// SEPARATORS : *** --- ___ * * * - - - _ _ _
|
||||
// Must be placed before EMPHASIS
|
||||
$search[] = "/^[*_-] ?[*_-] ?[*_-]$/Um";
|
||||
$replace[] = "</p>\n<hr/>\n<p>";
|
||||
$replace[] = "\n<hr/>\n";
|
||||
|
||||
$mark = preg_replace ($search, $replace, $mark);
|
||||
|
||||
@@ -44,6 +44,7 @@ class markdown
|
||||
$res = $this->paragraph ($mark);
|
||||
|
||||
$res = str_replace ("<p></p>", "", $res);
|
||||
$res = str_replace ("<p>\n</p>", "", $res);
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -187,14 +188,14 @@ class markdown
|
||||
if ($oldType === "code")
|
||||
{
|
||||
$this->debugMKD ("</code></pre>");
|
||||
$res .= "</code></pre>\n";
|
||||
$res .= "</code></pre>";
|
||||
array_pop ($htmlStack);
|
||||
array_pop ($indentStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->debugMKD (str_repeat (" ", end ($indentStack))."</$oldType>");
|
||||
$res .= str_repeat (" ", end ($indentStack))."</$oldType>\n";
|
||||
$res .= str_repeat (" ", end ($indentStack))."</$oldType>";
|
||||
}
|
||||
array_pop ($indentStack);
|
||||
array_pop ($htmlStack);
|
||||
@@ -232,7 +233,7 @@ class markdown
|
||||
if (end ($typeStack) !== FALSE)
|
||||
{
|
||||
// Remove last \n to put closing tag at the end of line
|
||||
$res = substr ($res, 0, -1);
|
||||
//$res = substr ($res, 0, -1);
|
||||
$oldType = array_pop ($typeStack);
|
||||
$this->debugMKD (str_repeat (" ", end ($indentStack))."</$oldType>");
|
||||
$res .= str_repeat (" ", end ($indentStack))."</$oldType>";
|
||||
|
||||
Reference in New Issue
Block a user