Skip to content

Commit

Permalink
Generators/HTML: only display a TOC when there is more than one doc
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed Nov 15, 2024
1 parent f9c5f18 commit d7d52d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/Generators/HTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ protected function printHeader()
*/
protected function printToc()
{
// Only show a TOC when there are two or more docs to display.
if (count($this->docFiles) < 2) {
return;
}

echo ' <h2>Table of Contents</h2>'.PHP_EOL;
echo ' <ul class="toc">'.PHP_EOL;

Expand Down
4 changes: 0 additions & 4 deletions tests/Core/Generators/Expectations/ExpectedOutputOneDoc.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@
</head>
<body>
<h1>GeneratorTest Coding Standards</h1>
<h2>Table of Contents</h2>
<ul class="toc">
<li><a href="#One-Standard-Block,-No-Code">One Standard Block, No Code</a></li>
</ul>
<a name="One-Standard-Block,-No-Code" />
<h2>One Standard Block, No Code</h2>
<p class="text">Documentation contains one standard block and no code comparison.</p>
Expand Down

0 comments on commit d7d52d7

Please sign in to comment.