Skip to content

Commit

Permalink
Methods.html: show all _documents_ for each method, not only classes.…
Browse files Browse the repository at this point in the history
… This catches also docs for generic methods like play and plot
  • Loading branch information
lijon committed Mar 23, 2011
1 parent 1fce91e commit 822daa2
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 19 deletions.
120 changes: 102 additions & 18 deletions HelpSource/Overviews/Methods.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@
<title>Methods</title>
<link rel='stylesheet' href='../scdoc.css' type='text/css' />
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<script src="../methods.js" type="text/javascript"></script>
<!-- <script src="../methods.js" type="text/javascript"></script>-->
<script src="../docmap.js" type="text/javascript"></script>
<style>
.method_item {
margin-top: 1em;
}
.method_classes {
/*.method_classes {
margin-left: 2em;
}*/
div.result_item {
margin-bottom: 0.2em;
margin-left: 2em;
}

.method_name {
font-family: Andale Mono, monospace;
font-size: 9.5pt;
Expand All @@ -32,8 +38,74 @@
</noscript>

<script type="text/javascript">
var classes;
function showMethod(m, node) {
var methods;
function buildMethodList() {
methods = {};
for(var i=0;i<docmap.length;i++) {
var doc = docmap[i];
var mets = doc.methods;
if(mets) {
for(var j=0;j<mets.length;j++) {
var m = mets[j];
var mname = m.slice(2);
var pfx = m[1];
var ext = m[0]=="+";
if(!methods[mname])
methods[mname] = [];
methods[mname].push({doc:doc,pfx:pfx,ext:ext});
}
}
}
}
function showMethod(mname, node) {
var div = document.createElement("div");
div.className = "method_item";
var x = document.createElement("div");
x.className = "method_name";
x.appendChild(document.createTextNode(mname));
div.appendChild(x);

var x = methods[mname].sort(function(a,b) {
if(a.pfx<b.pfx) return -1;
else
if(a.pfx>b.pfx) return +1;
else
return 0;
});

for(var i=0;i<x.length;i++) {
var m = x[i];
var v = m.doc;

var div2 = document.createElement("div");
div2.className = "result_item";
div.appendChild(div2);

var p = m.pfx;
if(p==".") p=" ";
// if(m.pfx=="*")
div2.appendChild(document.createTextNode(p+" "));
var a = document.createElement("a");
a.setAttribute("href","../"+v.path+".html#"+m.pfx+mname);
a.innerHTML = v.title;
div2.appendChild(a);
if(m.ext)
div2.appendChild(document.createTextNode("+"));
div2.appendChild(document.createTextNode(" - "+v.summary+" "));
var n = document.createElement("span");
n.className = "soft";
var res = "["+v.path.split("/")[0];
if(v.installed=="extension")
res += " +";
else if(v.installed=="missing")
res += " - missing!";
n.innerHTML = res+"]";
div2.appendChild(n);
}

node.appendChild(div);
}
/*function showMethod(m, node) {
var div = document.createElement("div");
div.className = "method_item";
var x = document.createElement("div");
Expand Down Expand Up @@ -69,21 +141,27 @@
}
node.appendChild(div);
}
}*/
function showmethods() {
var hash = unescape(window.location.hash.slice(1));
var res = document.getElementById("methods");
res.innerHTML = "";

buildMethodList();

if(hash && ! /^section_/.test(hash)) {
document.getElementById("total_count").innerHTML = "Showing single method:";
document.getElementById("method_note").innerHTML = "";
for(var i=0;i<methods.length;i++) {
if(methods[i][0]==hash) {
showMethod(methods[i],res);
// for(var i=0;i<methods.length;i++) {
// if(methods[i][0]==hash) {
// showMethod(methods[i],res);
// return;
// }
if(methods[hash]) {
showMethod(hash,res);
return;
}
}
// }
var div = document.createElement("p");
div.appendChild(document.createTextNode("Method not found: "+hash));
res.appendChild(div);
Expand All @@ -96,14 +174,14 @@
div.appendChild(document.createTextNode(" instead?"));
res.appendChild(div);
} else {
var mets = methods.sort(function(a,b) {
/* var mets = methods.sort(function(a,b) {
if(a[0]<b[0]) return -1;
else
if(a[0]>b[0]) return +1;
else
return 0;
});

*/
var section = undefined;
if(/^section_/.test(hash))
section = hash[8];
Expand All @@ -113,10 +191,16 @@
div.className = "jump";
div.innerHTML = "Show section: ";

var mets = [];
for(var k in methods) {
mets.push(k);
}
mets = mets.sort();

for(var i=0;i<mets.length;i++) {
var m = mets[i];
if(cap != m[0][0]) {
cap = m[0][0];
var k = mets[i];
if(cap != k[0]) {
cap = k[0];
if(section == undefined)
section = cap;
var a = document.createElement("a");
Expand All @@ -136,11 +220,11 @@
res.appendChild(x);

var count = 0;
for(var i=0;i<mets.length;i++) {
var m = mets[i];
for(var i = 0; i<mets.length;i++) {
var k = mets[i];

if(m[0][0]==section) {
showMethod(m, res);
if(k[0]==section) {
showMethod(k, res);
count++;
}
}
Expand Down
1 change: 1 addition & 0 deletions HelpSource/Reference/Resize.schelp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ summary:: Resize behavior for SCView and its subclasses
categories:: GUI

section:: Description
method:: resize
The SCView link::Overviews/Methods#resize#resize method:: takes nine different arguments defining the behavior when window is resized. Each view responds relatively to the stretches of its parent view.

table::
Expand Down
2 changes: 1 addition & 1 deletion HelpSource/Reference/play.schelp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ summary:: Start a process
categories:: Common methods

section:: Introduction

method:: play
The code::play:: message is of common use in sc. Different objects respond to it in various
ways, but the simple meaning is: strong::start a process::.
It is usually implemented by objects in contributed libraries as well.
Expand Down

0 comments on commit 822daa2

Please sign in to comment.