X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=funcsummary.php;h=f4830e022223a79d2211c7b9f62fadc247b3e2ad;hb=b5ea2548f9717e8d0f26de29bdce6881623b67a3;hp=0a4e858c1bc7031d03a1940cc46b0bc0c99334a3;hpb=f2d1bcbb220370bc25bcd3a7272dd20da57b3058;p=m6w6%2Fext-http
diff --git a/funcsummary.php b/funcsummary.php
index 0a4e858..f4830e0 100644
--- a/funcsummary.php
+++ b/funcsummary.php
@@ -14,9 +14,10 @@ function ff($t)
{
$t = preg_replace('/^ \* /m', '', trim($t, "*/ \n"));
$t = preg_replace_callback('/(\<\?php.*?\?\>)/s', 'hl', $t);
- $t = nl2br(preg_replace('/\n *\* */', "\n", $t));
+ $t = str_replace("
\n
\n", "
", nl2br(preg_replace('/\n *\* */', "\n", $t)));
$t = preg_replace('/(\
\n)+\
(\
\n)+/', '', $t); $t = preg_replace('/(\
\n)+\<\/pre\>(\
\n)+/', '', $t); + $t = str_replace("
\n", "", $t); return sprintf('%s
', ltrim($t, ' *')); } function e($s) @@ -72,6 +73,26 @@ $preface = <<<_PREFACE p br, pre code br { display: block; } + .toc { + position: absolute; + top: 10px; + right: 10px; + width: 300px; + height: 95%%; + overflow: scroll; + font-size: .9em; + } + body>div.toc { + position: fixed; + } + .toc ul { + padding-left: 15px; + margin-left: 0; + } + .toc li { + padding: 0; + margin: 0; + } @@ -88,6 +109,8 @@ if ($_SERVER['argc'] < 2) { die("Usage: {$_SERVER['argv'][0]}[ ...]\n"); } +$TOC = array(); + printf($preface, basename(getcwd())); foreach (array_slice($_SERVER['argv'], 1) as $fp) { @@ -95,21 +118,41 @@ foreach (array_slice($_SERVER['argv'], 1) as $fp) { if (mf($f, $m)) { e("\nAnalyzing %s\n", basename($f)); - printf(" %s
\n", basename($f)); + printf("%s
\n", basename($f), basename($f)); foreach ($m[1] as $i => $p) { e("Documenting $p\n"); if ($o = preg_match('/^(.*), (.*)$/', $m[4][$i], $n)) { if ($n[2] == '__construct') { printf("%s
\n", $n[1], $n[1]); } - } - printf("%s \n%s\n", - $o?3:2, $o?$n[1].'_'.$n[2]:$m[4][$i], $p, $o?3:2, ff($m[3][$i])); + $TOC[basename($f)][$n[1]][$n[2]] = $n[1].'::'.$n[2].'()'; + printf("%s \n", 3, $n[1].'_'.$n[2], $p, 3); + } else { + $TOC[basename($f)][$m[4][$i]] = $m[4][$i].'()'; + printf("%s \n", 2, $m[4][$i], $p, 2); + } + print ff($m[3][$i]) ."\n"; } print "
\n"; } } } +printf("Table of Contents\n\n"); printf($footer, date('r')); e("\nDone\n");\n"); +foreach ($TOC as $file => $f) { + printf("
\n- %s\n\n
\n"); +} +printf("