Markdown : Add space between the lines when a paragraph continues

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1795 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-09-03 13:34:28 +00:00
parent 54d2616b1c
commit 20d4c4ec57
2 changed files with 15 additions and 7 deletions

View File

@@ -39,9 +39,11 @@ class markdown
$search[] = "/^[*_-] ?[*_-] ?[*_-]$/Um";
$replace[] = "\n<hr/>\n";
// End of line with continuous on second line, without double spaces : add
// space
$search[] = "/^(\w+)\\n(\w+)/m"; $replace[] = "\\1 \\2";
$mark = preg_replace ($search, $replace, $mark);
$res = $this->paragraph ($mark);
$res = str_replace ("\n<p></p>", "", $res);
@@ -60,6 +62,8 @@ class markdown
// Initialization of convertions
$search = array ();
$replace = array ();
// Titles short
// == TITRE1
$search[] = "/^==+ (.+)( ==+)?$/Um";
@@ -120,9 +124,6 @@ class markdown
// End of line with double space : <br/>
$search[] = "/( )$/Um"; $replace[] = "<br/>";
// End of line with continuous on second line : add blank
// $search[] = "/(.)\\n([A-Za-z0-9])/Um"; $replace[] = "\\1 \\2";
// Cleanning the markdown text
$mark = str_replace ("\t", " ", $mark);
if (trim ($mark) === "")
@@ -278,7 +279,7 @@ class markdown
if ($type !== "")
{
$this->debugMKD (str_repeat (" ", end ($indentStack))."<$type>");
$res .= "".str_repeat (" ", end ($indentStack))."<$type>";
$res .= str_repeat (" ", end ($indentStack))."<$type>";
$htmlStack[] = $type;
array_push ($indentStack, $indent);
array_push ($typeStack, $type);
@@ -340,7 +341,7 @@ class markdown
}
array_push ($indentStack, $indent);
$this->debugMKD (str_repeat (" ", $indent)."<$typetmp>");
$res .= "".str_repeat (" ", $indent)."<$typetmp>";
$res .= str_repeat (" ", $indent)."<$typetmp>";
if ($type === "ol" || $type === "ul")
{
$this->debugMKD ("DEB2 : Adding li");
@@ -369,7 +370,7 @@ class markdown
$timeregex += (microtime (TRUE) - $timetmp);
}
$this->debugMKD ("$lineTxt");
$this->debugMKD (substr ($lineTxt, end ($indentStack))."");
$res .= substr ($lineTxt, end ($indentStack))."";
if ($type === "code")
$res .= "\n";