Skip to content

Commit

Permalink
New SCDoc parser and renderer. Faster, more stable, less buggy.
Browse files Browse the repository at this point in the history
The parser is written as a C++ primitive, using flex/bison generated code.
  • Loading branch information
lijon committed Mar 28, 2012
1 parent 0e75780 commit 75bcf94
Show file tree
Hide file tree
Showing 26 changed files with 9,489 additions and 2,347 deletions.
10 changes: 8 additions & 2 deletions HelpSource/Overviews/Classes.html
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
8 changes: 4 additions & 4 deletions HelpSource/Overviews/Methods.html
Original file line number Diff line number Diff line change
Expand Up @@ -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});
}
}
}
Expand Down Expand Up @@ -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";
Expand Down
25 changes: 19 additions & 6 deletions HelpSource/Search.html
Original file line number Diff line number Diff line change
Expand Up @@ -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});
}
}
}
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -373,7 +378,9 @@
var v = m.doc;

var div2 = document.createElement("div");

div2.className = "met_docs";

div.appendChild(div2);

var p = m.pfx;
Expand All @@ -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];
Expand Down
5 changes: 5 additions & 0 deletions HelpSource/scdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
}
Expand Down
2 changes: 1 addition & 1 deletion HelpSource/scdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]=="*") {
Expand Down
8 changes: 4 additions & 4 deletions SCClassLibrary/Common/GUI/HelpBrowser.sc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -240,6 +237,9 @@ HelpBrowser {
};
if(webView.respondsTo(\onReload_)) {
webView.onReload = {|wv, url|
if(WebView.implClass.respondsTo(\clearCache)) {
WebView.clearCache;
};
this.goTo(url);
};
};
Expand Down
Loading

0 comments on commit 75bcf94

Please sign in to comment.