fix linkage of NS constants
[mdref/mdref] / public / index.js
index 3eef5660642b549f4d74eb58a03248c33b6cf205..4878936a383649981948a0b3645b81534c10b3f3 100644 (file)
@@ -55,9 +55,11 @@ $(function() {
                        case "ArrayObject":
                        case "ArrayIterator":
                        case "RecursiveArrayIterator":
+                       case "SeekableIterator":
                        case "SplObserver":
                        case "SplSubject":
                        case "SplObjectStorage":
+                       case "JsonSerializable":
                                return "<code>";
 
                        // keywords
@@ -95,8 +97,12 @@ $(function() {
                                        return "<a href=\"" + s.replace(/::|\\/g, "/") + "\">";
                                }
                        }
-                       if (-1 !== (j = s.indexOf("\\")) && s.substr(j+1,1) !== "n") {
-                               return "<a href=\"" + s.replace(/\\/g, "/").replace(/::|$/, "#") + "\">";
+                       if (-1 !== (j = s.lastIndexOf("\\")) && s.substr(j+1,1) !== "n") {
+                               t = s.substring(j+1);
+                               if (!mdref.is_constant(t) || s.match(/\\/g).length <= 1) {
+                                       return "<a href=\"" + s.replace(/\\/g, "/").replace(/::/, "#") + "\">";
+                               }
+                               return "<a href=\"" + s.substring(0,j).replace(/\\/g, "/") + "#" + t + "\">";
                        }
 
                        switch (s.toLowerCase()) {
@@ -124,7 +130,7 @@ $(function() {
                        $n.text().split(/([^a-zA-Z0-9_\\\$:]+)/).forEach(function(v) {
                                var t;
                                
-                               if ((t = mdref.type(v, nn))) {
+                               if ((t = mdref.type(v.replace(/:$/, ""), nn))) {
                                        a.push($(t).text(v));
                                } else if (a.length && a[a.length-1].nodeName === "#text") {
                                        /* if we already have a text node and the next is also gonna be a text