Permalink
Browse files

New SCDoc parser and renderer. Faster, more stable, less buggy.

The parser is written as a C++ primitive, using flex/bison generated code.
  • Loading branch information...
lijon committed Mar 19, 2012
1 parent 0e75780 commit 75bcf94474e85a29b35b5f26d07635959662af5f
@@ -109,10 +109,16 @@
n.setAttribute("href","../"+v.path+".html");
n.innerHTML = v.title;
div.appendChild(n);
- div.appendChild(document.createTextNode(" - "+v.summary+" "));
+ var undoc = /Undocumented classes/.test(v.categories);
+ if(undoc) {
+ n.className = "undoc";
+ div.appendChild(document.createTextNode(" - "));
+ } else {
+ div.appendChild(document.createTextNode(" - "+v.summary+" "));
+ }
var res = "";
- if(/Undocumented classes/.test(v.categories))
+ if(undoc)
res += " undocumented";
if(v.installed=="extension")
res += " extension";
@@ -69,10 +69,10 @@
var m = mets[j];
var mname = m.slice(2);
var pfx = m[1];
- var ext = m[0]=="+";
+ var undoc = m[0]=="?";
if(!methods.hasOwnProperty(mname))
methods[mname] = [];
- methods[mname].push({doc:doc,pfx:pfx,ext:ext});
+ methods[mname].push({doc:doc,pfx:pfx,undoc:undoc});
}
}
}
@@ -123,9 +123,9 @@
var a = document.createElement("a");
a.setAttribute("href",helpRoot+"/"+v.path+".html#"+m.pfx+mname);
a.innerHTML = v.title;
+ if(m.undoc)
+ a.className = "undoc";
div2.appendChild(a);
- if(m.ext)
- div2.appendChild(document.createTextNode("+"));
div2.appendChild(document.createTextNode(" - "+v.summary+" "));
var n = document.createElement("span");
n.className = "soft";
View
@@ -130,14 +130,14 @@
var m = mets[j];
var mname = m.slice(2);
var pfx = m[1];
- var ext = m[0]=="+";
+ var undoc = m[0]=="?";
if(!methods.hasOwnProperty(mname))
methods[mname] = [];
if(!methods[mname].push) {
debug("Problem with method '"+mname+"' in "+doc.path);
debug(methods[mname].toString());
} else {
- methods[mname].push({doc:doc,pfx:pfx,ext:ext});
+ methods[mname].push({doc:doc,pfx:pfx,undoc:undoc});
}
}
}
@@ -315,7 +315,12 @@
}
n.innerHTML = v.title;
div.appendChild(n);
- div.appendChild(document.createTextNode(" - "+v.summary+" "));
+ if(/Undocumented classes/.test(v.categories)) {
+ n.className = "undoc";
+ div.appendChild(document.createTextNode(" - "));
+ } else {
+ div.appendChild(document.createTextNode(" - "+v.summary+" "));
+ }
if(v.installed!="standard") {
var n = document.createElement("span");
@@ -373,7 +378,9 @@
var v = m.doc;
var div2 = document.createElement("div");
+
div2.className = "met_docs";
+
div.appendChild(div2);
var p = m.pfx;
@@ -382,10 +389,16 @@
var a = document.createElement("a");
a.setAttribute("href",helpRoot+"/"+v.path+".html#"+m.pfx+mname);
a.innerHTML = v.title;
+ if(m.undoc)
+ a.className = "undoc";
div2.appendChild(a);
- if(m.ext)
- div2.appendChild(document.createTextNode("+"));
- div2.appendChild(document.createTextNode(" - "+v.summary+" "));
+
+ if(/Undocumented classes/.test(v.categories)) {
+ div2.appendChild(document.createTextNode(" - "));
+ } else {
+ div2.appendChild(document.createTextNode(" - "+v.summary+" "));
+ }
+
var n = document.createElement("span");
n.className = "soft";
var res = "["+v.path.split("/")[0];
View
@@ -536,6 +536,11 @@ ul.tree li:last-child {
margin-top:-20px;
}
+a.undoc {
+ color: #88b;
+ text-decoration: line-through;
+}
+
/* auto class links. note that color can be overridden by prettify rules below */
a.clslnk {
}
View
@@ -103,7 +103,7 @@ function addInheritedMethods() {
var mets = s.methods.sort();
for(var j=0;j<mets.length;j++) {
var m = mets[j];
- if(doc.methods.indexOf(m)<0) { // ignore methods already documented in this helpfile
+ if(doc.methods.indexOf("_"+m.slice(1))<0) { // ignore methods already documented in this helpfile
var li = document.createElement("li");
li.innerHTML = "<a href='"+helpRoot+"/"+s.path+".html#"+m.slice(1)+"'>"+m.slice(2)+"</a>";
if(m[1]=="*") {
@@ -13,7 +13,7 @@ HelpBrowser {
*initClass {
StartUp.add {
- NotificationCenter.register(SCDoc, \docMapDidUpdate, this) {
+ NotificationCenter.register(SCDoc, \didIndexAllDocs, this) {
if(WebView.implClass.respondsTo(\clearCache)) {
WebView.clearCache;
}
@@ -77,9 +77,6 @@ HelpBrowser {
goTo {|url, brokenAction|
var newPath, oldPath, plainTextExts = #[".sc",".scd",".txt",".schelp"];
- //FIXME: since multiple scdoc queries can be running at the same time,
- //it would be best to create a queue and run them in order, but only use the url from the last.
-
plainTextExts.do {|x|
if(url.endsWith(x)) {
^this.openTextFile(url);
@@ -240,6 +237,9 @@ HelpBrowser {
};
if(webView.respondsTo(\onReload_)) {
webView.onReload = {|wv, url|
+ if(WebView.implClass.respondsTo(\clearCache)) {
+ WebView.clearCache;
+ };
this.goTo(url);
};
};
Oops, something went wrong.

0 comments on commit 75bcf94

Please sign in to comment.