From 07e6a19dd40b986c64bc8b1f9477d79c30a0046b Mon Sep 17 00:00:00 2001 From: Samuel Gordalina Date: Fri, 13 Jul 2012 14:07:40 +0100 Subject: [PATCH] Updated code to pass the tests --- Extractor/ApiDocExtractor.php | 2 +- Formatter/MarkdownFormatter.php | 4 +++- Tests/Formatter/MarkdownFormatterTest.php | 5 +++++ Tests/Formatter/SimpleFormatterTest.php | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Extractor/ApiDocExtractor.php b/Extractor/ApiDocExtractor.php index ae5775e..be3b82b 100644 --- a/Extractor/ApiDocExtractor.php +++ b/Extractor/ApiDocExtractor.php @@ -233,7 +233,7 @@ class ApiDocExtractor $comment = preg_replace('/^\s*\* ?/m', '', $comment); // Remove everything (and including) first annotation - $comment = preg_replace('/\n?\s*@[^\s]+.+/ms', '', $comment); + $comment = preg_replace('/@[\w0-9]+\(.*/msi', '', $comment); return trim($comment); } diff --git a/Formatter/MarkdownFormatter.php b/Formatter/MarkdownFormatter.php index a51da88..5358a00 100644 --- a/Formatter/MarkdownFormatter.php +++ b/Formatter/MarkdownFormatter.php @@ -30,8 +30,10 @@ class MarkdownFormatter extends AbstractFormatter $markdown .= "#### Documentation ####\n\n"; foreach (explode("\n", $data['documentation']) as $line) { - $markdown .= "\t" . $line . "\n"; + $markdown .= " " . $line . "\n"; } + + $markdown .= "\n"; } if (isset($data['requirements']) && !empty($data['requirements'])) { diff --git a/Tests/Formatter/MarkdownFormatterTest.php b/Tests/Formatter/MarkdownFormatterTest.php index a2ae4f3..2e18a5a 100644 --- a/Tests/Formatter/MarkdownFormatterTest.php +++ b/Tests/Formatter/MarkdownFormatterTest.php @@ -126,6 +126,11 @@ _Action without HTTP verb_ _This method is useful to test if the getDocComment works. And, it supports multilines until the first '@' char._ +#### Documentation #### + + This method is useful to test if the getDocComment works. + And, it supports multilines until the first '@' char. + #### Requirements #### **id** diff --git a/Tests/Formatter/SimpleFormatterTest.php b/Tests/Formatter/SimpleFormatterTest.php index 73d4ffa..b472096 100644 --- a/Tests/Formatter/SimpleFormatterTest.php +++ b/Tests/Formatter/SimpleFormatterTest.php @@ -168,6 +168,7 @@ class SimpleFormatterTest extends WebTestCase 'page' => array('type' => 'int', 'description' => '', 'value' => ''), ), 'description' => 'This method is useful to test if the getDocComment works. And, it supports multilines until the first \'@\' char.', + 'documentation' => "This method is useful to test if the getDocComment works.\nAnd, it supports multilines until the first '@' char." ), 3 => array(