- if (!ctype_upper($pi["filename"][0])) {
- // namespaced functions
- $dir = $pi["dirname"] . "/" . $pi["filename"];
- if (is_dir($dir)) {
- printf("<h2>Functions:</h2>\n");
- printf("<ul>\n");
- foreach (glob("$dir/[_a-z]*.md") as $file) {
- printf("<li><h3><a href=\"%s\">%s</a></h3><p>%s</p><p>%s</p></li>\n",
- urlpath($dir, $file),
- basename($file, ".md"),
- @end(head($file, 3)),
- join(" ", cut(head($file), ["f"=>"1-"]))
- );
- }
- printf("</ul>\n");
- }
- } else {
- // methods
- $dir = $pi["dirname"] . "/" . $pi["filename"];
- if (is_dir($dir)) {
- printf("<h2>Methods:</h2>\n");
- printf("<ul>\n");
- foreach (glob("$dir/[_a-z]*.md") as $file) {
- printf("<li><h3><a href=\"%s\">%s</a></h3><p>%s</p><p>%s</p></li>\n",
- urlpath($dir, $file),
- basename($file, ".md"),
- @end(head($file, 3)),
- join(" ", cut(head($file), ["f"=>"1-"]))
- );
- }
- printf("</ul>\n");
+ $dir = $pi["dirname"] . "/" . $pi["filename"];
+ if (($glob = glob("$dir/[_a-z]*.md"))) {
+ printf("<h2>%s:</h2>\n", !ctype_upper($pi["filename"][0]) ?
+ "Functions" : "Methods");
+ printf("<ul>\n");
+ foreach ($glob as $file) {
+ printf("<li><h3><a href=\"%s\">%s</a></h3><p>%s</p><p>%s</p></li>\n",
+ urlpath($dir, $file),
+ basename($file, ".md"),
+ @end(head($file, 3)),
+ join(" ", cut(head($file), ["f"=>"1-"]))
+ );