Added tests for horizontal rules and fixed underscore rules

This commit is contained in:
hkdobrev 2013-07-22 23:29:54 +03:00
parent 8ed3b3d484
commit c65297307f
3 changed files with 29 additions and 9 deletions

View File

@ -252,15 +252,6 @@ class Parsedown
continue;
}
# Horizontal Line
if (isset($block) and preg_match('/^[ ]{0,3}([-*_])([ ]{0,2}\1){2,}$/', $block))
{
$markup .= '<hr />'."\n";
continue;
}
# ~
if (isset($quick_block))
@ -270,6 +261,18 @@ class Parsedown
unset ($quick_block);
}
# Horizontal Line
# Horizontal lines checks could be optimized with $quick_block
# But '_' > 'A' and horizontal lines could be defined by underscores
# See #13
if (isset($block) and preg_match('/^[ ]{0,3}([-*_])([ ]{0,2}\1){2,}$/', $block))
{
$markup .= '<hr />'."\n";
continue;
}
#
# Paragraph

View File

@ -0,0 +1,6 @@
<p>Horizontal line with dashes</p>
<hr />
<p>Horizontal line with asterisks</p>
<hr />
<p>Horizontal line with underscores</p>
<hr />

View File

@ -0,0 +1,11 @@
Horizontal line with dashes
---
Horizontal line with asterisks
***
Horizontal line with underscores
___