mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
simplify
This commit is contained in:
parent
e46be110fb
commit
28a202ee9e
@ -10,23 +10,17 @@
|
|||||||
*/
|
*/
|
||||||
class CommonMarkTest extends PHPUnit_Framework_TestCase
|
class CommonMarkTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
const SPEC_FILEPATH = 'spec.txt';
|
|
||||||
|
|
||||||
const SPEC_URL = 'https://raw.githubusercontent.com/jgm/stmd/master/spec.txt';
|
const SPEC_URL = 'https://raw.githubusercontent.com/jgm/stmd/master/spec.txt';
|
||||||
|
|
||||||
public function getCommonMarkRules()
|
public function getCommonMarkRules()
|
||||||
{
|
{
|
||||||
if (is_file(self::SPEC_FILEPATH) and is_readable(self::SPEC_FILEPATH)) {
|
|
||||||
$spec = file_get_contents(self::SPEC_FILEPATH);
|
|
||||||
} else {
|
|
||||||
$spec = file_get_contents(self::SPEC_URL);
|
$spec = file_get_contents(self::SPEC_URL);
|
||||||
}
|
|
||||||
|
|
||||||
$tests = array();
|
$tests = array();
|
||||||
$testsCount = 0;
|
$testsCount = 0;
|
||||||
$currentSection = '';
|
$currentSection = '';
|
||||||
|
|
||||||
$spec = preg_replace('/^<!-- END TESTS -->(.|[\n])*/m', '', $spec);
|
$spec = strstr($spec, '<!-- END TESTS -->', true);
|
||||||
|
|
||||||
preg_replace_callback(
|
preg_replace_callback(
|
||||||
'/^\.\n([\s\S]*?)^\.\n([\s\S]*?)^\.$|^#{1,6} *(.*)$/m',
|
'/^\.\n([\s\S]*?)^\.\n([\s\S]*?)^\.$|^#{1,6} *(.*)$/m',
|
||||||
|
Loading…
Reference in New Issue
Block a user