Skip to content

Commit 489e29d

Browse files
committed
Make the manual work on index pages
1 parent cc7895e commit 489e29d

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/Controllers/Manual/ManualController.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
use phpweb\Themes\ContentSection;
1111
use phpweb\Themes\PageTheme;
1212
use phpweb\Util\FS;
13+
use function str_ends_with;
14+
use function str_replace;
1315

1416
/**
1517
* Here be dragons! This is a major hack to test wider functionality
@@ -39,8 +41,13 @@ public function __invoke(Request $request): Response
3941
}
4042
};
4143

44+
if (str_ends_with($path, '/')) {
45+
$path.= 'index.php';
46+
}
47+
4248
$content = $fetchUrl('/manual/' . $path);
4349

50+
4451
$extractedTocPath = '';
4552
$extractedSetup = '';
4653
$extractedHtml = '';
@@ -57,6 +64,9 @@ public function __invoke(Request $request): Response
5764
$extractedHtml = trim($matches[1]);
5865
}
5966

67+
/* replace certain class names */
68+
$extractedHtml = str_replace('annotation-interactive phpcode', 'annotation-interactive gst-code-php', $extractedHtml);
69+
6070
$tableOfContentsArray = [];
6171
if ($extractedTocPath) {
6272
$tableOfContents = $fetchUrl('/manual/' . dirname($path) . $extractedTocPath);

0 commit comments

Comments
 (0)