Created
January 5, 2012 18:50
-
-
Save simensen/1566621 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* This file is a part of the PHP Markdown library. | |
* | |
* (c) Dragonfly Development Inc. | |
* | |
* For the full copyright and license information, please view the LICENSE | |
* file that was distributed with this source code. | |
*/ | |
namespace dflydev\markdown; | |
class SundownParser implements IMarkdownParser { | |
protected $cfg = array(); | |
/** | |
* (non-PHPdoc) | |
* @see dflydev\markdown.IMarkdownParser::transformMarkdown() | |
*/ | |
public function transformMarkdown($text) | |
{ | |
$sundown = new \Sundown($text, $this->cfg); | |
return $sundown->to_html(); | |
} | |
public function configureMarkdownParser($key, $value) | |
{ | |
$this->cfg[$key] = $value; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* This file is a part of the PHP Markdown library. | |
* | |
* (c) Dragonfly Development Inc. | |
* | |
* For the full copyright and license information, please view the LICENSE | |
* file that was distributed with this source code. | |
*/ | |
namespace dflydev\tests\markdown; | |
class SundownParserTest extends AbstractParserTest | |
{ | |
protected function assertSundownExtensionLoaded() | |
{ | |
if (!extension_loaded('sundown')) { | |
$this->markTestSkipped('The Sundown extension is not available'); | |
} | |
} | |
/** | |
* (non-PHPdoc) | |
* @see dflydev\tests\markdown.AbstractParserTest::createParser() | |
*/ | |
public function createParser() | |
{ | |
$this->assertSundownExtensionLoaded(); | |
$markdownParser = new \dflydev\markdown\SundownParser(); | |
print_r($markdownParser); | |
return $markdownParser; | |
} | |
/** | |
* (non-PHPdoc) | |
* @see dflydev\tests\markdown.AbstractParserTest::configureTabWidth() | |
*/ | |
public function configureTabWidth(\dflydev\markdown\IMarkdownParser $markdownParser, $width) | |
{ | |
$this->markTestSkipped('Sundown cannot configure tab width'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment