added function renderApi() which renders the whole application docs into
files. used via webinterface or commandline. changed RegExp: rhino needs global setting as second param in constructor
This commit is contained in:
parent
08d3a94429
commit
98ad7be09b
1 changed files with 26 additions and 8 deletions
|
@ -31,6 +31,27 @@ function getDir (dir, obj) {
|
|||
}
|
||||
}
|
||||
|
||||
function renderApi() {
|
||||
var prefix = this.href ("");
|
||||
this.storePage (this, "main", "", "index.html");
|
||||
this.storePage (this, "prototypes");
|
||||
this.storePage (this, "summary");
|
||||
this.storePage (this, "functionindex");
|
||||
var ct = 4;
|
||||
var arr = this.listChildren ();
|
||||
for (var i=0; i<arr.length; i++) {
|
||||
this.storePage (arr[i], "list", "../");
|
||||
this.storePage (arr[i], "main", "../");
|
||||
ct += 2;
|
||||
var subarr = arr[i].listChildren ();
|
||||
for (var j=0; j<subarr.length; j++) {
|
||||
this.storePage (subarr[j], "main", "../", subarr[j].getElementName () + ".html");
|
||||
ct += 1;
|
||||
}
|
||||
}
|
||||
return ct;
|
||||
}
|
||||
|
||||
|
||||
function storePage (obj, action, backPath, filename) {
|
||||
if (filename==null)
|
||||
|
@ -44,7 +65,7 @@ function storePage (obj, action, backPath, filename) {
|
|||
f.open ();
|
||||
f.write (str);
|
||||
f.close ();
|
||||
app.log ("wrote file " + f.toString ());
|
||||
app.log ("wrote file " + f.getAbsolutePath());
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,16 +77,13 @@ function getPage (obj, action, backPath) {
|
|||
// get the baseURI out of the url and replace
|
||||
// it with the given relative prefix
|
||||
// (keep anchors in regex!)
|
||||
var reg = new RegExp ("href=\"" + this.href ("") + "([^\"#]+)([^\"]*)\"");
|
||||
reg.global = true;
|
||||
var reg = new RegExp ("href=\"" + this.href ("") + "([^\"#]+)([^\"]*)\"", "gim");
|
||||
str = str.replace (reg, "href=\"" + backPath + "$1.html$2\"");
|
||||
var reg = new RegExp ("src=\"" + this.href ("") + "([^\"#]+)([^\"]*)\"");
|
||||
reg.global = true;
|
||||
var reg = new RegExp ("src=\"" + this.href ("") + "([^\"#]+)([^\"]*)\"", "gim");
|
||||
str = str.replace (reg, "src=\"" + backPath + "$1.html$2\"");
|
||||
// shorten links, so that function files can move up one directory
|
||||
// in the hierarchy
|
||||
var reg = new RegExp ("(prototype_[^/]+/[^/]+)/main.html");
|
||||
reg.global = true;
|
||||
var reg = new RegExp ("(prototype_[^/]+/[^/]+)/main.html", "gim");
|
||||
str = str.replace (reg, "$1.html");
|
||||
return str;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue