markdown : BUG in Sharp Titles (if not ending by #, the title is not discovered)
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1507 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
14
markdown.php
14
markdown.php
@@ -97,22 +97,22 @@ class markdown
|
||||
// TITLES
|
||||
// Titles ATX (Optionnal sharp at the end)
|
||||
// ###### Title6
|
||||
$search[] = "/^###### (.+)( +#*)$/Um";
|
||||
$search[] = "/^###### (.+)( +#+)?$/Um";
|
||||
$replace[] = "</p><h6>\\1</h6><p>";
|
||||
// ##### Title5
|
||||
$search[] = "/^##### (.+)( +#*)$/Um";
|
||||
$search[] = "/^##### (.+)( +#+)?$/Um";
|
||||
$replace[] = "</p><h5>\\1</h5><p>";
|
||||
// #### Title4
|
||||
$search[] = "/^#### (.+)( +#*)$/Um";
|
||||
$search[] = "/^#### (.+)( +#+)?$/Um";
|
||||
$replace[] = "</p><h4>\\1</h4><p>";
|
||||
// ### Title3
|
||||
$search[] = "/^### (.+)( +#*)$/Um";
|
||||
$search[] = "/^### (.+)( +#+)?$/Um";
|
||||
$replace[] = "</p><h3>\\1</h3><p>";
|
||||
// ## Title2
|
||||
$search[] = "/^## (.+)( +#*)$/Um";
|
||||
$search[] = "/^## (.+)( +#+)?$/Um";
|
||||
$replace[] = "</p><h2>\\1</h2><p>";
|
||||
// # Title1
|
||||
$search[] = "/^# (.+)( +#*)$/Um";
|
||||
$search[] = "/^# (.+)( +#+)?$/Um";
|
||||
$replace[] = "</p><h1>\\1</h1><p>";
|
||||
// End of line with double space : <br/>
|
||||
$search[] = "/( )$/Um"; $replace[] = "<br/>";
|
||||
@@ -294,8 +294,6 @@ class markdown
|
||||
if (end ($typeStack))
|
||||
{
|
||||
$this->debugMKD ("DEB2 : CODE : Close older HTML");
|
||||
// Remove last \n to put closing tag at the end of line
|
||||
$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