From 9e18724e6eb413f4f163f8b2660a30afeaf40719 Mon Sep 17 00:00:00 2001 From: JDGrimes Date: Sat, 23 Aug 2014 09:39:21 -0400 Subject: [PATCH 1/3] Remove line breaks from docblocks See #114 --- lib/runner.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/runner.php b/lib/runner.php index 4b06819..bdc727c 100644 --- a/lib/runner.php +++ b/lib/runner.php @@ -120,15 +120,15 @@ function export_docblock( $element ) { } $output = array( - 'description' => $docblock->getShortDescription(), - 'long_description' => $docblock->getLongDescription()->getFormattedContents(), + 'description' => str_replace( "\n", ' ', $docblock->getShortDescription() ), + 'long_description' => str_replace( "\n", ' ', $docblock->getLongDescription()->getFormattedContents() ), 'tags' => array(), ); foreach ( $docblock->getTags() as $tag ) { $t = array( 'name' => $tag->getName(), - 'content' => $tag->getDescription(), + 'content' => str_replace( "\n", ' ', $tag->getDescription() ), ); if ( method_exists( $tag, 'getTypes' ) ) { $t['types'] = $tag->getTypes(); From 9ffdb5825eef9482c326d8e24152f483c4d9a9eb Mon Sep 17 00:00:00 2001 From: JDGrimes Date: Sat, 23 Aug 2014 09:39:43 -0400 Subject: [PATCH 2/3] Unit tests for #114 --- tests/phpunit/tests/export/docblocks.inc | 64 ++++++++++++++++++++++++ tests/phpunit/tests/export/docblocks.php | 24 +++++++++ 2 files changed, 88 insertions(+) create mode 100644 tests/phpunit/tests/export/docblocks.inc create mode 100644 tests/phpunit/tests/export/docblocks.php diff --git a/tests/phpunit/tests/export/docblocks.inc b/tests/phpunit/tests/export/docblocks.inc new file mode 100644 index 0000000..3e0e8b5 --- /dev/null +++ b/tests/phpunit/tests/export/docblocks.inc @@ -0,0 +1,64 @@ +assertStringMatchesFormat( + '%s' + , $this->export_data['classes'][0]['doc']['long_description'] + ); + } +} From d5805847867fc929296e3b17df24212af2b9798f Mon Sep 17 00:00:00 2001 From: JDGrimes Date: Mon, 25 Aug 2014 17:08:39 -0400 Subject: [PATCH 3/3] Cross-platform line-break removal See #114 --- lib/runner.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/runner.php b/lib/runner.php index bdc727c..bb6f8f1 100644 --- a/lib/runner.php +++ b/lib/runner.php @@ -120,15 +120,15 @@ function export_docblock( $element ) { } $output = array( - 'description' => str_replace( "\n", ' ', $docblock->getShortDescription() ), - 'long_description' => str_replace( "\n", ' ', $docblock->getLongDescription()->getFormattedContents() ), + 'description' => preg_replace( '/[\n\r]+/', ' ', $docblock->getShortDescription() ), + 'long_description' => preg_replace( '/[\n\r]+/', ' ', $docblock->getLongDescription()->getFormattedContents() ), 'tags' => array(), ); foreach ( $docblock->getTags() as $tag ) { $t = array( 'name' => $tag->getName(), - 'content' => str_replace( "\n", ' ', $tag->getDescription() ), + 'content' => preg_replace( '/[\n\r]+/', ' ', $tag->getDescription() ), ); if ( method_exists( $tag, 'getTypes' ) ) { $t['types'] = $tag->getTypes();