markdown : BUG : Correct the "code" section : don't allow ul/li in codes, print */- normally
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1508 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
43
markdown.php
43
markdown.php
@@ -149,27 +149,36 @@ class markdown
|
||||
$type = $this->paragraphType ($line);
|
||||
$this->debugMKD ("DEBUT: Type='$type'");
|
||||
$matches = array ();
|
||||
switch ($type)
|
||||
$indent = strspn ($line, " ");
|
||||
if (end ($typeStack) === "code" && $indent >= end ($indentStack))
|
||||
{
|
||||
case "ol" :
|
||||
preg_match ("/^( *)[0-9]+\. +(.*)/", $line, $matches);
|
||||
if (!isset ($matches[2]))
|
||||
$lineTxt = $line;
|
||||
else
|
||||
$lineTxt = $matches[2];
|
||||
break ;
|
||||
case "ul" :
|
||||
preg_match ("/^( *)[-+*] +(.*)/", $line, $matches);
|
||||
if (!isset ($matches[2]))
|
||||
$lineTxt = $line;
|
||||
else
|
||||
$lineTxt = $matches[2];
|
||||
break ;
|
||||
default:
|
||||
$this->debugMKD ("DEBUT: Force type=CODE");
|
||||
$type = "code";
|
||||
$lineTxt = $line;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ($type)
|
||||
{
|
||||
case "ol" :
|
||||
preg_match ("/^( *)[0-9]+\. +(.*)/", $line, $matches);
|
||||
if (!isset ($matches[2]))
|
||||
$lineTxt = $line;
|
||||
else
|
||||
$lineTxt = $matches[2];
|
||||
break ;
|
||||
case "ul" :
|
||||
preg_match ("/^( *)[-+*] +(.*)/", $line, $matches);
|
||||
if (!isset ($matches[2]))
|
||||
$lineTxt = $line;
|
||||
else
|
||||
$lineTxt = $matches[2];
|
||||
break ;
|
||||
default:
|
||||
$lineTxt = $line;
|
||||
}
|
||||
}
|
||||
|
||||
$indent = strspn ($line, " ");
|
||||
$this->debugMKD ("DEBUT: Indent='$indent'");
|
||||
$this->debugMKD ("DEBUT: indentStack=".print_r ($indentStack, TRUE));
|
||||
$this->debugMKD ("DEBUT: typeStack=".print_r ($typeStack, TRUE));
|
||||
|
||||
Reference in New Issue
Block a user