From 506de88c26947005d21ec855184d9fd76bc4b79a Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Thu, 5 Dec 2013 09:16:55 +0100 Subject: [PATCH] Add support for Parsedown as a markdown parser --- composer.json | 3 +- composer.lock | 242 ++++++++---------- .../Reflection/DocBlock/Description.php | 19 +- 3 files changed, 116 insertions(+), 148 deletions(-) diff --git a/composer.json b/composer.json index 9d90238..dd03710 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ "phpunit/phpunit": "3.7.*@stable" }, "suggest": { - "dflydev/markdown": "1.0.*" + "dflydev/markdown": "1.0.*", + "erusev/parsedown": "~0.7" }, "extra": { "branch-alias": { diff --git a/composer.lock b/composer.lock index b70f57f..36ed7e7 100644 --- a/composer.lock +++ b/composer.lock @@ -1,90 +1,46 @@ { - "hash": "c6115c20a4a284f6ca14e676e788b4d3", + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" + ], + "hash": "f55ecb41312789bb8b3fa8b4f659952f", "packages": [ - { - "name": "dflydev/markdown", - "version": "v1.0.2", - "source": { - "type": "git", - "url": "https://github.com/dflydev/dflydev-markdown.git", - "reference": "v1.0.2" - }, - "dist": { - "type": "zip", - "url": "https://github.com/dflydev/dflydev-markdown/zipball/v1.0.2", - "reference": "v1.0.2", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "time": "2012-01-15 19:36:37", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "dflydev\\markdown": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "New BSD License" - ], - "authors": [ - { - "name": "Dragonfly Development Inc.", - "email": "info@dflydev.com", - "homepage": "http://dflydev.com" - }, - { - "name": "Beau Simensen", - "email": "beau@dflydev.com", - "homepage": "http://beausimensen.com" - }, - { - "name": "Michel Fortin", - "homepage": "http://michelf.com" - }, - { - "name": "John Gruber", - "homepage": "http://daringfireball.net" - } - ], - "description": "PHP Markdown & Extra", - "homepage": "http://github.com/dflydev/dflydev-markdown", - "keywords": [ - "markdown" - ] - } + ], "packages-dev": [ { "name": "phpunit/php-code-coverage", - "version": "1.2.7", + "version": "1.2.13", "source": { "type": "git", - "url": "git://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "1.2.7" + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94" }, "dist": { "type": "zip", - "url": "https://github.com/sebastianbergmann/php-code-coverage/archive/1.2.7.zip", - "reference": "1.2.7", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/466e7cd2554b4e264c9e3f31216d25ac0e5f3d94", + "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94", "shasum": "" }, "require": { "php": ">=5.3.3", "phpunit/php-file-iterator": ">=1.3.0@stable", - "phpunit/php-token-stream": ">=1.1.3@stable", - "phpunit/php-text-template": ">=1.1.1@stable" + "phpunit/php-text-template": ">=1.1.1@stable", + "phpunit/php-token-stream": ">=1.1.3@stable" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*@dev" }, "suggest": { "ext-dom": "*", "ext-xdebug": ">=2.0.5" }, - "time": "2012-12-02 14:54:55", "type": "library", - "installation-source": "dist", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, "autoload": { "classmap": [ "PHP/" @@ -107,31 +63,30 @@ "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", "homepage": "https://github.com/sebastianbergmann/php-code-coverage", "keywords": [ - "testing", "coverage", + "testing", "xunit" - ] + ], + "time": "2013-09-10 08:14:32" }, { "name": "phpunit/php-file-iterator", - "version": "1.3.3", + "version": "1.3.4", "source": { "type": "git", - "url": "git://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "1.3.3" + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" }, "dist": { "type": "zip", - "url": "https://github.com/sebastianbergmann/php-file-iterator/zipball/1.3.3", - "reference": "1.3.3", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2012-10-11 04:44:38", "type": "library", - "installation-source": "dist", "autoload": { "classmap": [ "File/" @@ -152,32 +107,31 @@ } ], "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "http://www.phpunit.de/", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", "keywords": [ "filesystem", "iterator" - ] + ], + "time": "2013-10-10 15:34:57" }, { "name": "phpunit/php-text-template", "version": "1.1.4", "source": { "type": "git", - "url": "git://github.com/sebastianbergmann/php-text-template.git", - "reference": "1.1.4" + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23" }, "dist": { "type": "zip", - "url": "https://github.com/sebastianbergmann/php-text-template/zipball/1.1.4", - "reference": "1.1.4", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5180896f51c5b3648ac946b05f9ec02be78a0b23", + "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2012-10-31 11:15:28", "type": "library", - "installation-source": "dist", "autoload": { "classmap": [ "Text/" @@ -201,28 +155,27 @@ "homepage": "https://github.com/sebastianbergmann/php-text-template/", "keywords": [ "template" - ] + ], + "time": "2012-10-31 18:15:28" }, { "name": "phpunit/php-timer", - "version": "1.0.4", + "version": "1.0.5", "source": { "type": "git", - "url": "git://github.com/sebastianbergmann/php-timer.git", - "reference": "1.0.4" + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" }, "dist": { "type": "zip", - "url": "https://github.com/sebastianbergmann/php-timer/zipball/1.0.4", - "reference": "1.0.4", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2012-10-11 04:45:58", "type": "library", - "installation-source": "dist", "autoload": { "classmap": [ "PHP/" @@ -243,32 +196,36 @@ } ], "description": "Utility class for timing", - "homepage": "http://www.phpunit.de/", + "homepage": "https://github.com/sebastianbergmann/php-timer/", "keywords": [ "timer" - ] + ], + "time": "2013-08-02 07:42:54" }, { "name": "phpunit/php-token-stream", - "version": "1.1.5", + "version": "1.2.1", "source": { "type": "git", - "url": "git://github.com/sebastianbergmann/php-token-stream.git", - "reference": "1.1.5" + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e" }, "dist": { "type": "zip", - "url": "https://github.com/sebastianbergmann/php-token-stream/zipball/1.1.5", - "reference": "1.1.5", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/5220af2a7929aa35cf663d97c89ad3d50cf5fa3e", + "reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e", "shasum": "" }, "require": { "ext-tokenizer": "*", "php": ">=5.3.3" }, - "time": "2012-10-11 04:47:14", "type": "library", - "installation-source": "dist", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, "autoload": { "classmap": [ "PHP/" @@ -289,45 +246,48 @@ } ], "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "http://www.phpunit.de/", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", "keywords": [ "tokenizer" - ] + ], + "time": "2013-09-13 04:58:23" }, { "name": "phpunit/phpunit", - "version": "3.7.10", + "version": "3.7.28", "source": { "type": "git", - "url": "git://github.com/sebastianbergmann/phpunit.git", - "reference": "3.7.10" + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d" }, "dist": { "type": "zip", - "url": "https://github.com/sebastianbergmann/phpunit/archive/3.7.10.zip", - "reference": "3.7.10", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d", + "reference": "3b97c8492bcafbabe6b6fbd2ab35f2f04d932a8d", "shasum": "" }, "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": ">=1.3.1", - "phpunit/php-text-template": ">=1.1.1", - "phpunit/php-code-coverage": ">=1.2.1", - "phpunit/php-timer": ">=1.0.2", - "phpunit/phpunit-mock-objects": ">=1.2.0,<1.3.0", - "symfony/yaml": ">=2.1.0", "ext-dom": "*", "ext-pcre": "*", "ext-reflection": "*", - "ext-spl": "*" + "ext-spl": "*", + "php": ">=5.3.3", + "phpunit/php-code-coverage": "~1.2.1", + "phpunit/php-file-iterator": ">=1.3.1", + "phpunit/php-text-template": ">=1.1.1", + "phpunit/php-timer": ">=1.0.4", + "phpunit/phpunit-mock-objects": "~1.2.0", + "symfony/yaml": "~2.0" + }, + "require-dev": { + "pear-pear/pear": "1.9.4" }, "suggest": { - "phpunit/php-invoker": ">=1.1.0", "ext-json": "*", "ext-simplexml": "*", - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "phpunit/php-invoker": ">=1.1.0,<1.2.0" }, - "time": "2012-12-02 14:56:55", "bin": [ "composer/bin/phpunit" ], @@ -337,7 +297,6 @@ "dev-master": "3.7.x-dev" } }, - "installation-source": "dist", "autoload": { "classmap": [ "PHPUnit/" @@ -361,23 +320,24 @@ "description": "The PHP Unit Testing framework.", "homepage": "http://www.phpunit.de/", "keywords": [ - "testing", "phpunit", + "testing", "xunit" - ] + ], + "time": "2013-10-17 07:27:40" }, { "name": "phpunit/phpunit-mock-objects", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", - "url": "git://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "1.2.2" + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875" }, "dist": { "type": "zip", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects/archive/1.2.2.zip", - "reference": "1.2.2", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875", + "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875", "shasum": "" }, "require": { @@ -387,9 +347,7 @@ "suggest": { "ext-soap": "*" }, - "time": "2012-11-05 10:39:13", "type": "library", - "installation-source": "dist", "autoload": { "classmap": [ "PHPUnit/" @@ -414,37 +372,36 @@ "keywords": [ "mock", "xunit" - ] + ], + "time": "2013-01-13 10:24:48" }, { "name": "symfony/yaml", - "version": "v2.1.4", + "version": "v2.4.0", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", - "url": "https://github.com/symfony/Yaml", - "reference": "v2.1.4" + "url": "https://github.com/symfony/Yaml.git", + "reference": "1ae235a1b9d3ad3d9f3860ff20acc072df95b7f5" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/Yaml/archive/v2.1.4.zip", - "reference": "v2.1.4", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/1ae235a1b9d3ad3d9f3860ff20acc072df95b7f5", + "reference": "1ae235a1b9d3ad3d9f3860ff20acc072df95b7f5", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2012-11-08 09:51:48", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.4-dev" } }, - "installation-source": "dist", "autoload": { "psr-0": { - "Symfony\\Component\\Yaml": "" + "Symfony\\Component\\Yaml\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -462,7 +419,8 @@ } ], "description": "Symfony Yaml Component", - "homepage": "http://symfony.com" + "homepage": "http://symfony.com", + "time": "2013-11-26 16:40:27" } ], "aliases": [ @@ -471,5 +429,11 @@ "minimum-stability": "stable", "stability-flags": { "phpunit/phpunit": 0 - } + }, + "platform": { + "php": ">=5.3.3" + }, + "platform-dev": [ + + ] } diff --git a/src/phpDocumentor/Reflection/DocBlock/Description.php b/src/phpDocumentor/Reflection/DocBlock/Description.php index 0d6def2..d41142e 100644 --- a/src/phpDocumentor/Reflection/DocBlock/Description.php +++ b/src/phpDocumentor/Reflection/DocBlock/Description.php @@ -55,15 +55,15 @@ class Description implements \Reflector /** * Sets the text of this description. - * + * * @param string $content The new text of this description. - * + * * @return $this */ public function setContent($content) { $this->contents = trim($content); - + $this->parsedContents = null; return $this; } @@ -140,7 +140,7 @@ class Description implements \Reflector * * @todo this should become a more intelligent piece of code where the * configuration contains a setting what format long descriptions are. - * + * * @codeCoverageIgnore Will be removed soon, in favor of adapters at * PhpDocumentor itself that will process text in various formats. * @@ -161,7 +161,10 @@ class Description implements \Reflector ); } - if (class_exists('dflydev\markdown\MarkdownExtraParser')) { + if (class_exists('Parsedown')) { + $markdown = \Parsedown::instance(); + $result = $markdown->parse($result); + } elseif (class_exists('dflydev\markdown\MarkdownExtraParser')) { $markdown = new \dflydev\markdown\MarkdownExtraParser(); $result = $markdown->transformMarkdown($result); } @@ -171,7 +174,7 @@ class Description implements \Reflector /** * Gets the docblock this tag belongs to. - * + * * @return DocBlock The docblock this description belongs to. */ public function getDocBlock() @@ -181,10 +184,10 @@ class Description implements \Reflector /** * Sets the docblock this tag belongs to. - * + * * @param DocBlock $docblock The new docblock this description belongs to. * Setting NULL removes any association. - * + * * @return $this */ public function setDocBlock(DocBlock $docblock = null)