diff --git a/src/Generators/Text.php b/src/Generators/Text.php index 419bcc3d56..e57556d08f 100644 --- a/src/Generators/Text.php +++ b/src/Generators/Text.php @@ -133,7 +133,7 @@ protected function printCodeComparisonBlock(DOMNode $node) { $codeBlocks = $node->getElementsByTagName('code'); $first = trim($codeBlocks->item(0)->nodeValue); - $firstTitle = $codeBlocks->item(0)->getAttribute('title'); + $firstTitle = trim($codeBlocks->item(0)->getAttribute('title')); $firstTitleLines = []; $tempTitle = ''; @@ -168,7 +168,7 @@ protected function printCodeComparisonBlock(DOMNode $node) $firstLines = explode("\n", $first); $second = trim($codeBlocks->item(1)->nodeValue); - $secondTitle = $codeBlocks->item(1)->getAttribute('title'); + $secondTitle = trim($codeBlocks->item(1)->getAttribute('title')); $secondTitleLines = []; $tempTitle = ''; diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeTitleWhitespace.txt b/tests/Core/Generators/Expectations/ExpectedOutputCodeTitleWhitespace.txt index 80a6cc690b..0db5a7dfae 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputCodeTitleWhitespace.txt +++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeTitleWhitespace.txt @@ -6,15 +6,13 @@ This is a standard block. ----------------------------------------- CODE COMPARISON ------------------------------------------ -| Valid: spaces at start of description. | Invalid: spaces at end making line > 46 chars. | -| | | +| Valid: spaces at start of description. | Invalid: spaces at end making line > 46 chars. | ---------------------------------------------------------------------------------------------------- | // Dummy. | // Dummy. | ---------------------------------------------------------------------------------------------------- ----------------------------------------- CODE COMPARISON ------------------------------------------ -| Valid: spaces at start + end of description. | Invalid: spaces ' ' in description. | -| | | +| Valid: spaces at start + end of description. | Invalid: spaces ' ' in description. | ---------------------------------------------------------------------------------------------------- | // Note: description above without the | // Dummy. | | // trailing whitespace fits in 46 chars. | |