1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

Compare commits

..

3 Commits
0.5.0 ... 0.6.0

3 changed files with 27 additions and 34 deletions

View File

@ -4,8 +4,4 @@ php:
- 5.5
- 5.4
- 5.3
- 5.2
matrix:
allow_failures:
- php: 5.2
- 5.2

View File

@ -238,20 +238,11 @@ class Parsedown
break;
}
# ~
if ($line[0] >= 'a' and $line[0] !== '~' or $line[0] >= 'A' and $line[0] <= 'Z')
{
goto paragraph;
}
# ~
$deindented_line = $line;
#
# indentation sensitive types
$deindented_line = $line;
switch ($line[0])
{
case ' ':
@ -500,9 +491,7 @@ class Parsedown
continue;
}
# ~
paragraph:
# paragraph
if ($element['type'] === 'p')
{

View File

@ -5,7 +5,7 @@ include 'Parsedown.php';
class Test extends PHPUnit_Framework_TestCase
{
const provider_dir = 'data/';
/**
* @dataProvider provider
*/
@ -15,33 +15,41 @@ class Test extends PHPUnit_Framework_TestCase
$this->assertEquals($expected_markup, $actual_markup);
}
function provider()
{
$provider = array();
$DirectoryIterator = new DirectoryIterator(__DIR__ . '/' . self::provider_dir);
$path = dirname(__FILE__).'/';
$DirectoryIterator = new DirectoryIterator($path . '/' . self::provider_dir);
foreach ($DirectoryIterator as $Item)
{
if ($Item->isFile() and $Item->getExtension() === 'md')
if ($Item->isFile())
{
$filename = $Item->getFilename();
$extension = pathinfo($filename, PATHINFO_EXTENSION);
if ($extension !== 'md')
continue;
$basename = $Item->getBasename('.md');
$markdown = file_get_contents(__DIR__ . '/' . self::provider_dir . $basename . '.md');
$markdown = file_get_contents($path . '/' . self::provider_dir . $basename . '.md');
if (!$markdown)
continue;
$expected_markup = file_get_contents(__DIR__ . '/' . self::provider_dir . $basename . '.html');
$expected_markup = file_get_contents($path . '/' . self::provider_dir . $basename . '.html');
$expected_markup = str_replace("\r\n", "\n", $expected_markup);
$expected_markup = str_replace("\r", "\n", $expected_markup);
$provider [] = array($markdown, $expected_markup);
}
}
return $provider;
}
}
}