From 9780e28bee398fabc13c2f05819626c91802a0d8 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 5 Nov 2024 02:07:08 +0100 Subject: [PATCH] Generators/Markdown: add blank line after title As per the guidelines for cross-flavour markdown, it is best to always have a blank line below a header. Ref: * https://www.markdownguide.org/basic-syntax/#heading-best-practices --- src/Generators/Markdown.php | 2 +- .../ExpectedOutputCodeComparisonBlankLines.md | 1 + .../ExpectedOutputCodeComparisonBlockLength.md | 1 + .../Expectations/ExpectedOutputCodeComparisonEncoding.md | 1 + .../ExpectedOutputCodeComparisonLineLength.md | 1 + .../Expectations/ExpectedOutputCodeTitleLineWrapping.md | 1 + .../Expectations/ExpectedOutputCodeTitleWhitespace.md | 1 + .../Expectations/ExpectedOutputDocumentationTitleCase.md | 1 + .../ExpectedOutputDocumentationTitleLength.md | 1 + .../Core/Generators/Expectations/ExpectedOutputOneDoc.md | 1 + .../Expectations/ExpectedOutputStandardBlankLines.md | 1 + .../Expectations/ExpectedOutputStandardEncoding.md | 1 + .../Expectations/ExpectedOutputStandardIndent.md | 1 + .../Expectations/ExpectedOutputStandardLineWrapping.md | 1 + .../Expectations/ExpectedOutputStructureDocs.md | 8 ++++++++ .../ExpectedOutputUnsupportedElementAtWrongLevel.md | 1 + .../ExpectedOutputUnsupportedOneElmAtWrongLevel.md | 1 + .../ExpectedOutputUnsupportedSuperfluousCodeElement.md | 1 + .../ExpectedOutputUnsupportedUnknownElement.md | 1 + 19 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/Generators/Markdown.php b/src/Generators/Markdown.php index 6df243a459..76dbb0605f 100644 --- a/src/Generators/Markdown.php +++ b/src/Generators/Markdown.php @@ -93,7 +93,7 @@ protected function printFooter() protected function processSniff(DOMNode $doc) { $title = $this->getTitle($doc); - echo PHP_EOL."## $title".PHP_EOL; + echo PHP_EOL."## $title".PHP_EOL.PHP_EOL; foreach ($doc->childNodes as $node) { if ($node->nodeName === 'standard') { diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlankLines.md b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlankLines.md index 79efd01775..ef25f893c4 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlankLines.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlankLines.md @@ -1,6 +1,7 @@ # GeneratorTest Coding Standard ## Code Comparison, blank lines + This is a standard block. diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlockLength.md b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlockLength.md index b9b64b31c6..526f110b34 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlockLength.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonBlockLength.md @@ -1,6 +1,7 @@ # GeneratorTest Coding Standard ## Code Comparison, block length + This is a standard block.
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonEncoding.md b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonEncoding.md index 4c3832fa3f..052d3cb3e0 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonEncoding.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonEncoding.md @@ -1,6 +1,7 @@ # GeneratorTest Coding Standard ## Code Comparison, char encoding + This is a standard block.
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonLineLength.md b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonLineLength.md index f695814ba8..89ae055bfb 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonLineLength.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeComparisonLineLength.md @@ -1,6 +1,7 @@ # GeneratorTest Coding Standard ## Code Comparison, line length + Ensure there is no PHP "Warning: str_repeat(): Second argument has to be greater than or equal to 0". Ref: squizlabs/PHP_CodeSniffer#2522
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeTitleLineWrapping.md b/tests/Core/Generators/Expectations/ExpectedOutputCodeTitleLineWrapping.md index e5b7251aa2..a0d6a8e6a2 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputCodeTitleLineWrapping.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeTitleLineWrapping.md @@ -1,6 +1,7 @@ # GeneratorTest Coding Standard ## Code Title, line wrapping + This is a standard block.
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputCodeTitleWhitespace.md b/tests/Core/Generators/Expectations/ExpectedOutputCodeTitleWhitespace.md index 509abf6720..2d04562c7e 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputCodeTitleWhitespace.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputCodeTitleWhitespace.md @@ -1,6 +1,7 @@ # GeneratorTest Coding Standard ## Code Title, whitespace handling + This is a standard block.
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputDocumentationTitleCase.md b/tests/Core/Generators/Expectations/ExpectedOutputDocumentationTitleCase.md index d0464a4efa..0d63b04a95 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputDocumentationTitleCase.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputDocumentationTitleCase.md @@ -1,6 +1,7 @@ # GeneratorTest Coding Standard ## lowercase title + This is a standard block. Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer) diff --git a/tests/Core/Generators/Expectations/ExpectedOutputDocumentationTitleLength.md b/tests/Core/Generators/Expectations/ExpectedOutputDocumentationTitleLength.md index 29f5972a7c..252f5fca69 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputDocumentationTitleLength.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputDocumentationTitleLength.md @@ -1,6 +1,7 @@ # GeneratorTest Coding Standard ## This is a very very very very very very very very very very very long title + This is a standard block. Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer) diff --git a/tests/Core/Generators/Expectations/ExpectedOutputOneDoc.md b/tests/Core/Generators/Expectations/ExpectedOutputOneDoc.md index 0cc0ecceae..f6130736ff 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputOneDoc.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputOneDoc.md @@ -1,6 +1,7 @@ # GeneratorTest Coding Standard ## One Standard Block, No Code + Documentation contains one standard block and no code comparison. Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer) diff --git a/tests/Core/Generators/Expectations/ExpectedOutputStandardBlankLines.md b/tests/Core/Generators/Expectations/ExpectedOutputStandardBlankLines.md index 43ba99d2db..6b3d6ed107 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputStandardBlankLines.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputStandardBlankLines.md @@ -1,6 +1,7 @@ # GeneratorTest Coding Standard ## Standard Element, blank line handling + There is a blank line at the start of this standard. And the above blank line is also deliberate to test part of the logic. diff --git a/tests/Core/Generators/Expectations/ExpectedOutputStandardEncoding.md b/tests/Core/Generators/Expectations/ExpectedOutputStandardEncoding.md index f04de7f096..f682daf611 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputStandardEncoding.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputStandardEncoding.md @@ -1,6 +1,7 @@ # GeneratorTest Coding Standard ## Standard Element, handling of HTML tags + The use of *tags* in standard descriptions is allowed and their handling should be *safeguarded*. Other tags, like <a href="example.com">link</a>, <b>bold</bold>, <script></script> are not allowed and will be encoded for display when the HTML or Markdown report is used. diff --git a/tests/Core/Generators/Expectations/ExpectedOutputStandardIndent.md b/tests/Core/Generators/Expectations/ExpectedOutputStandardIndent.md index 77c7244a12..1f3916153e 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputStandardIndent.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputStandardIndent.md @@ -1,6 +1,7 @@ # GeneratorTest Coding Standard ## Standard Element, indentation should be ignored + This line has no indentation. This line has 4 spaces indentation. This line has 8 spaces indentation. diff --git a/tests/Core/Generators/Expectations/ExpectedOutputStandardLineWrapping.md b/tests/Core/Generators/Expectations/ExpectedOutputStandardLineWrapping.md index 68703400cc..1a2cd9f19c 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputStandardLineWrapping.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputStandardLineWrapping.md @@ -1,6 +1,7 @@ # GeneratorTest Coding Standard ## Standard Element, line wrapping handling + This line has to be exactly 99 chars to test part of the logic.------------------------------------ And this line has to be exactly 100 chars.---------------------------------------------------------- And here we have a line which should start wrapping as it is longer than 100 chars. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean pellentesque iaculis enim quis hendrerit. Morbi ultrices in odio pharetra commodo. diff --git a/tests/Core/Generators/Expectations/ExpectedOutputStructureDocs.md b/tests/Core/Generators/Expectations/ExpectedOutputStructureDocs.md index 116af5df1e..fec8989451 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputStructureDocs.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputStructureDocs.md @@ -2,7 +2,9 @@ ## No Content + ## Code Comparison Only, Missing Standard Block +
@@ -23,6 +25,7 @@
Valid: Lorem ipsum dolor sit amet.
## One Standard Block, Code Comparison + Documentation contains one standard block and one code comparison. @@ -44,9 +47,11 @@ Documentation contains one standard block and one code comparison.
## One Standard Block, No Code + Documentation contains one standard block and no code comparison. ## One Standard Block, Two Code Comparisons + Documentation contains one standard block and two code comparisons. @@ -86,10 +91,12 @@ Documentation contains one standard block and two code comparisons.
## Two Standard Blocks, No Code + This is standard block one. This is standard block two. ## Two Standard Blocks, One Code Comparison + This is standard block one. @@ -112,6 +119,7 @@ This is standard block one. This is standard block two. ## Two Standard Blocks, Three Code Comparisons + This is standard block one.
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputUnsupportedElementAtWrongLevel.md b/tests/Core/Generators/Expectations/ExpectedOutputUnsupportedElementAtWrongLevel.md index 669ea0f4c6..048f028d57 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputUnsupportedElementAtWrongLevel.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputUnsupportedElementAtWrongLevel.md @@ -2,4 +2,5 @@ ## Code element at wrong level + Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer) diff --git a/tests/Core/Generators/Expectations/ExpectedOutputUnsupportedOneElmAtWrongLevel.md b/tests/Core/Generators/Expectations/ExpectedOutputUnsupportedOneElmAtWrongLevel.md index f6eda21036..aa9cc47279 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputUnsupportedOneElmAtWrongLevel.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputUnsupportedOneElmAtWrongLevel.md @@ -1,6 +1,7 @@ # GeneratorTest Coding Standard ## One element correct, one element wrong level + This is a standard block at the correct level. Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer) diff --git a/tests/Core/Generators/Expectations/ExpectedOutputUnsupportedSuperfluousCodeElement.md b/tests/Core/Generators/Expectations/ExpectedOutputUnsupportedSuperfluousCodeElement.md index 131c6cc45a..f6cdad9467 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputUnsupportedSuperfluousCodeElement.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputUnsupportedSuperfluousCodeElement.md @@ -1,6 +1,7 @@ # GeneratorTest Coding Standard ## Superfluous code element + This is a standard block.
diff --git a/tests/Core/Generators/Expectations/ExpectedOutputUnsupportedUnknownElement.md b/tests/Core/Generators/Expectations/ExpectedOutputUnsupportedUnknownElement.md index a8be8f9928..211415225f 100644 --- a/tests/Core/Generators/Expectations/ExpectedOutputUnsupportedUnknownElement.md +++ b/tests/Core/Generators/Expectations/ExpectedOutputUnsupportedUnknownElement.md @@ -2,4 +2,5 @@ ## Unknown element + Documentation generated on *REDACTED* by [PHP_CodeSniffer *VERSION*](https://github.com/PHPCSStandards/PHP_CodeSniffer)