Skip to content

Commit ad8ec0f

Browse files
committed
fix: Hide functions section when no functions are documented
Only show Functions link and count in API index when there are functions to display. Adds pagination_prev/next: null to index.
1 parent 0efe123 commit ad8ec0f

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

scripts/generate-php-api.mjs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,22 +1390,32 @@ function codeTableType(typeString, ctx) {
13901390
}
13911391

13921392
function generateIndexMd({ productLabel, classCount, functionCount }) {
1393+
const browseItems = ['- [Classes](./classes/)'];
1394+
if (functionCount > 0) {
1395+
browseItems.push('- [Functions](./functions/)');
1396+
}
1397+
1398+
const stats = [`- **Classes:** ${classCount}`];
1399+
if (functionCount > 0) {
1400+
stats.push(`- **Functions:** ${functionCount}`);
1401+
}
1402+
13931403
return `---
13941404
sidebar_position: 4
13951405
title: ${productLabel} API Reference
1406+
pagination_prev: null
1407+
pagination_next: null
13961408
---
13971409
13981410
# ${productLabel} API Reference
13991411
14001412
Generated from PHP source and PHPDoc comments.
14011413
1402-
- **Classes:** ${classCount}
1403-
- **Functions:** ${functionCount}
1414+
${stats.join('\n')}
14041415
14051416
## Browse
14061417
1407-
- [Classes](./classes/)
1408-
- [Functions](./functions/)
1418+
${browseItems.join('\n')}
14091419
`;
14101420
}
14111421

0 commit comments

Comments
 (0)