flush
authorMichael Wallner <mike@php.net>
Tue, 5 Nov 2013 11:14:13 +0000 (12:14 +0100)
committerMichael Wallner <mike@php.net>
Tue, 5 Nov 2013 11:14:13 +0000 (12:14 +0100)
VERSION
index.css
index.js
index.php

diff --git a/VERSION b/VERSION
index 6e8bf73aa550d4c57f6f35830f1bcdc7a4a62f38..a1631314f082896603c2248d1af4ae00e2f7a779 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.0
+0.1.0alpha
index e91ade18eb46a84404d3fcfbeb694613ca06f0c1..afc59eccef491dc609068d04d01e0e441feebf90 100644 (file)
--- a/index.css
+++ b/index.css
@@ -2,8 +2,10 @@
        font-size: 99.9%;
 }
 
-body {
+body, code {
        font-family: Inconsolata, Monospace, 'Courier New', Courier, monospace;
+}
+body {
        font-size: 1.5em;
        margin: 0;
        padding: 0;
@@ -17,12 +19,16 @@ body>* {
 .sidebar {
        font-size: .9em;
        float: right;
-       width: 500px;
        background: #f0f0f0;
        border-bottom-left-radius: 10px;
        padding: 0;
+       width: auto;
+       padding-right: 1em;
+       /*
+       width: 520px;
        margin-bottom: .2em;
        margin-left: 2em;
+       * */
 }
 .sidebar>ul {
 }
index f02ac5acaddadcfeec4ca96016ceef0c7b010483..45b5bb87f507905a029b95416381fcac4bc3f1fd 100644 (file)
--- a/index.js
+++ b/index.js
@@ -3,7 +3,11 @@ function log() {
 }
 
 function is_constant(s) {
-       return s.length > 1 && s.toUpperCase(s) === s;
+       s = s.replace(/v\d+(_\d+)?$/, "");
+       if (s.length < 2) {
+               return false;
+       }
+       return s.toUpperCase(s) === s;
 }
 
 function is_variable(s) {
@@ -48,6 +52,7 @@ function type(s, nn) {
        case "RecursiveArrayIterator":
        case "SplObserver":
        case "SplSubject":
+       case "SplObjectStorage":
                return "<code>";
                
        // keywords
@@ -145,10 +150,10 @@ function walk(i, e) {
 function blink(c) {
        var $c = $(c);
        
-       $c.fadeOut("slow").queue(function(next) {
+       $c.fadeOut("fast").queue(function(next) {
                this.style.color = "red";
                next();
-       }).fadeIn("fast").fadeOut("fast").queue(function(next) {
+       }).fadeIn("fast").fadeOut("slow").queue(function(next) {
                this.style.color = "";
                next();
        }).fadeIn("slow");
index 93454eceddd5abfb2dd306e4bb90420805fb4cc7..1e09d32ae1a2993beaad7aec0547a3829fe1e366 100644 (file)
--- a/index.php
+++ b/index.php
@@ -62,7 +62,25 @@ function head($file, $lines = 1) {
        return $ld;
 }
 
-function ns($file) {
+function ns($path) {
+       $ns = "";
+       $parts = explode("/", $path);
+       $upper = ctype_upper($path[0]);
+       for ($i = 0; $i < count($parts); ++$i) {
+               if (!strlen($parts[$i]) || $parts[$i] === ".") {
+                       continue;
+               }
+               if (strlen($ns)) {
+                       if ($upper && !ctype_upper($parts[$i][0])) {
+                               $ns .= "::";
+                       } else {
+                               $ns .= "\\";
+                       }
+               }
+               $ns .= $parts[$i];
+               $upper = ctype_upper($parts[$i][0]);
+       }
+       return $ns;
        return str_replace("/", "\\", str_replace("//", "/", trim($file, "/.")));
 }
 
@@ -98,12 +116,13 @@ function ls($dir) {
                                if (!isset($pi["extension"]) || $pi["extension"] != "md") {
                                        continue;
                                }
-                               if (!is_dir("$dir/".$pi["filename"])) {
+                               /* ignore files where an accompanying directory exists */
+                               if (is_dir("$dir/".$pi["filename"])) {
                                        continue;
                                }
                        } else {
-                               /* ignore directories where an companying file exists */
-                               if (is_file("$path.md")) {
+                               /* ignore directories where no accompanying file exists */
+                               if (!is_file("$path.md")) {
                                        continue;
                                }
                        }
@@ -130,24 +149,43 @@ function ml($file) {
                return;
        }
        if (!ctype_upper($pi["filename"][0])) {
-               return;
-       }
-       $dir = $pi["dirname"] . "/" . $pi["filename"];
-       if (is_dir($dir)) {
-               printf("<h2>Methods:</h2>\n");
-               printf("<ul>\n");
-               foreach (scandir($dir) as $file) {
-                       if (!is_file("$dir/$file") || ctype_upper($file{0})) {
-                               continue;
+               // namespaced functions
+               $dir = $pi["dirname"] . "/" . $pi["filename"];
+               if (is_dir($dir)) {
+                       printf("<h2>Functions:</h2>\n");
+                       printf("<ul>\n");
+                       foreach (scandir($dir) as $file) {
+                               if ($file{0} === "." || !is_file("$dir/$file") || ctype_upper($file{0})) {
+                                       continue;
+                               }
+                               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("$dir/$file", 3)),
+                                       join(" ", cut(head("$dir/$file"), ["f"=>"1-"]))
+                               );
                        }
-                       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("$dir/$file", 3)),
-                               join(" ", cut(head("$dir/$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 (scandir($dir) as $file) {
+                               if ($file{0} === "." || !is_file("$dir/$file") || ctype_upper($file{0})) {
+                                       continue;
+                               }
+                               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("$dir/$file", 3)),
+                                       join(" ", cut(head("$dir/$file"), ["f"=>"1-"]))
+                               );
+                       }
+                       printf("</ul>\n");
                }
-               printf("</ul>\n");
        }
 }
 
@@ -160,7 +198,7 @@ function md($file) {
                case "md":
                        $r = fopen($file, "r");
                        $md = MarkdownDocument::createFromStream($r);
-                       $md->compile(MarkdownDocument::AUTOLINK);
+                       $md->compile(MarkdownDocument::AUTOLINK|MarkdownDocument::TOC);
                        print str_replace("<br/>","<br />",$md->getHtml());
                        fclose($r);
                        ml($file);