lots of formatting fixes,
added functionindex to docapplication
This commit is contained in:
parent
7633e98eea
commit
604ab4f8ba
18 changed files with 219 additions and 116 deletions
|
@ -15,81 +15,30 @@ function summary_action () {
|
|||
}
|
||||
|
||||
|
||||
function functionindex_action () {
|
||||
res.data.body = this.renderSkinAsString ("functionindex");
|
||||
renderSkin ("api");
|
||||
}
|
||||
|
||||
|
||||
function render_action () {
|
||||
res.write ("<html><head><title>render</title></head><body>rendering ... " + new Date () );
|
||||
res.writeln("<html><head><title>render</title></head><body>rendering API ... ");
|
||||
var prefix = this.href ("");
|
||||
this.storePage (this, "main");
|
||||
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", "../");
|
||||
res.writeln (arr[i]);
|
||||
ct += 2;
|
||||
var subarr = arr[i].listChildren ();
|
||||
for (var j=0; j<subarr.length; j++) {
|
||||
this.storePage (subarr[j], "main", "../../");
|
||||
res.writeln (subarr[j]);
|
||||
ct += 1;
|
||||
}
|
||||
}
|
||||
res.writeln (" ... wrote " + ct + " files");
|
||||
}
|
||||
|
||||
|
||||
function getDocPrototype (obj) {
|
||||
var tmp = obj;
|
||||
while (tmp!=null && tmp.getType () != this.PROTOTYPE) {
|
||||
tmp = tmp.getParentElement ();
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
function getDir (dir, obj) {
|
||||
dir.mkdir ();
|
||||
if (obj.getType () == this.APPLICATION) {
|
||||
return dir;
|
||||
} else if (obj.getType () == this.PROTOTYPE) {
|
||||
var protoObj = this.getDocPrototype (obj);
|
||||
var dir = new File (dir, protoObj.getElementName ());
|
||||
dir.mkdir ();
|
||||
return dir;
|
||||
} else {
|
||||
var protoObj = this.getDocPrototype (obj);
|
||||
var dir = this.getDir (dir, protoObj);
|
||||
res.writeln("dir="+dir);
|
||||
dir = new File (dir, obj.getElementName ());
|
||||
res.writeln("dir="+dir);
|
||||
dir.mkdir ();
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function storePage (obj, action, backPath) {
|
||||
var str = this.getPage (obj, action, backPath);
|
||||
var appObj = this.getParentElement ();
|
||||
var dir = new File (appObj.getAppDir ().getAbsolutePath (), ".docs");
|
||||
dir = this.getDir (dir, obj);
|
||||
var f = new File (dir, action + ".html");
|
||||
f.remove ();
|
||||
f.open ();
|
||||
f.write (str);
|
||||
f.close ();
|
||||
}
|
||||
|
||||
|
||||
function getPage (obj, action, backPath) {
|
||||
backPath = (backPath==null) ? "" : backPath;
|
||||
res.pushStringBuffer ();
|
||||
eval ("obj." + action + "_action ();");
|
||||
var str = res.popStringBuffer ();
|
||||
var reg = new RegExp ("href=\"" + this.href ("") + "([^\"]+)\"");
|
||||
reg.global = true;
|
||||
str = str.replace (reg, "href=\"" + backPath + "$1.html\"");
|
||||
var reg = new RegExp ("src=\"" + this.href ("") + "([^\"]+)\"");
|
||||
reg.global = true;
|
||||
str = str.replace (reg, "src=\"" + backPath + "$1.html\"");
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
|
|
24
DocApplication/functionindex.skin
Normal file
24
DocApplication/functionindex.skin
Normal file
|
@ -0,0 +1,24 @@
|
|||
|
||||
|
||||
<table width="90%" border="0" cellspacing="1" cellpadding="5">
|
||||
<tr>
|
||||
<td class="headline">
|
||||
<big class="top">Application <% this.headline %></tt></b></big><br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<a class="navig" href="<% this.href action="summary"%>">SUMMARY</a> |
|
||||
<a class="navig" href="<% this.href action="functionindex" %>">INDEX</a> |
|
||||
<a class="navig" href="#A">A</a>|<a class="navig" href="#B">B</a>|<a class="navig" href="#C">C</a>|<a class="navig" href="#D">D</a>|<a class="navig" href="#E">E</a>|<a class="navig" href="#F">F</a>|<a class="navig" href="#G">G</a>|<a class="navig" href="#H">H</a>|<a class="navig" href="#I">I</a>|<a class="navig" href="#J">J</a>|<a class="navig" href="#K">K</a>|<a class="navig" href="#L">L</a>|<a class="navig" href="#M">M</a>|<a class="navig" href="#N">N</a>|<a class="navig" href="#O">O</a>|<a class="navig" href="#P">P</a>|<a class="navig" href="#Q">Q</a>|<a class="navig" href="#R">R</a>|<a class="navig" href="#S">S</a>|<a class="navig" href="#T">T</a>|<a class="navig" href="#U">U</a>|<a class="navig" href="#V">V</a>|<a class="navig" href="#W">W</a>|<a class="navig" href="#X">X</a>|<a class="navig" href="#Y">Y</a>|<a class="navig" href="#Z">Z</a>|
|
||||
|
||||
<table width="90%" border="0" cellspacing="1" cellpadding="5">
|
||||
<% this.functions skin="asIndexItem"
|
||||
separator="<tr><td class='mainbox'><img src='' width=0 height=0></td></tr>"
|
||||
%>
|
||||
</table>
|
||||
|
||||
<a class="navig" href="<% this.href action="summary"%>">SUMMARY</a> |
|
||||
<a class="navig" href="<% this.href action="functionindex" %>">INDEX</a> |
|
||||
<a class="navig" href="#A">A</a>|<a class="navig" href="#B">B</a>|<a class="navig" href="#C">C</a>|<a class="navig" href="#D">D</a>|<a class="navig" href="#E">E</a>|<a class="navig" href="#F">F</a>|<a class="navig" href="#G">G</a>|<a class="navig" href="#H">H</a>|<a class="navig" href="#I">I</a>|<a class="navig" href="#J">J</a>|<a class="navig" href="#K">K</a>|<a class="navig" href="#L">L</a>|<a class="navig" href="#M">M</a>|<a class="navig" href="#N">N</a>|<a class="navig" href="#O">O</a>|<a class="navig" href="#P">P</a>|<a class="navig" href="#Q">Q</a>|<a class="navig" href="#R">R</a>|<a class="navig" href="#S">S</a>|<a class="navig" href="#T">T</a>|<a class="navig" href="#U">U</a>|<a class="navig" href="#V">V</a>|<a class="navig" href="#W">W</a>|<a class="navig" href="#X">X</a>|<a class="navig" href="#Y">Y</a>|<a class="navig" href="#Z">Z</a>|
|
||||
|
58
DocApplication/functions.js
Normal file
58
DocApplication/functions.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
|
||||
|
||||
function getDocPrototype (obj) {
|
||||
var tmp = obj;
|
||||
while (tmp!=null && tmp.getType () != this.PROTOTYPE) {
|
||||
tmp = tmp.getParentElement ();
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
function getDir (dir, obj) {
|
||||
dir.mkdir ();
|
||||
if (obj.getType () == this.APPLICATION) {
|
||||
return dir;
|
||||
} else if (obj.getType () == this.PROTOTYPE) {
|
||||
var protoObj = this.getDocPrototype (obj);
|
||||
var dir = new File (dir, protoObj.getElementName ());
|
||||
dir.mkdir ();
|
||||
return dir;
|
||||
} else {
|
||||
var protoObj = this.getDocPrototype (obj);
|
||||
var dir = this.getDir (dir, protoObj);
|
||||
dir = new File (dir, obj.getElementName ());
|
||||
dir.mkdir ();
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function storePage (obj, action, backPath) {
|
||||
var str = this.getPage (obj, action, backPath);
|
||||
var appObj = this.getParentElement ();
|
||||
var dir = new File (appObj.getAppDir ().getAbsolutePath (), ".docs");
|
||||
dir = this.getDir (dir, obj);
|
||||
var f = new File (dir, action + ".html");
|
||||
f.remove ();
|
||||
f.open ();
|
||||
f.write (str);
|
||||
f.close ();
|
||||
app.log ("wrote file " + f.toString ());
|
||||
}
|
||||
|
||||
|
||||
function getPage (obj, action, backPath) {
|
||||
backPath = (backPath==null) ? "" : backPath;
|
||||
res.pushStringBuffer ();
|
||||
eval ("obj." + action + "_action ();");
|
||||
var str = res.popStringBuffer ();
|
||||
var reg = new RegExp ("href=\"" + this.href ("") + "([^\"]+)\"");
|
||||
reg.global = true;
|
||||
str = str.replace (reg, "href=\"" + backPath + "$1.html\"");
|
||||
var reg = new RegExp ("src=\"" + this.href ("") + "([^\"]+)\"");
|
||||
reg.global = true;
|
||||
str = str.replace (reg, "src=\"" + backPath + "$1.html\"");
|
||||
return str;
|
||||
}
|
||||
|
||||
|
3
DocApplication/indexSeparator.skin
Normal file
3
DocApplication/indexSeparator.skin
Normal file
|
@ -0,0 +1,3 @@
|
|||
<tr><td class='headline'><a name="<% param.letter %>"><!-- --></a>
|
||||
<big><% param.letter %></big>
|
||||
</td></tr>
|
|
@ -42,35 +42,42 @@ function hrefRoot_macro (param) {
|
|||
/**
|
||||
* list all prototypes of this application
|
||||
* @param skin name of skin to render on prototype
|
||||
* @param separator
|
||||
*/
|
||||
function prototypes_macro(par) {
|
||||
var skin = (par && par.skin&&par.skin!="") ? par.skin : "asPrototypeList";
|
||||
function prototypes_macro(param) {
|
||||
var skin = (param.skin) ? param.skin : "asPrototypeList";
|
||||
var separator = (param.separator) ? param.separator : "";
|
||||
var arr = this.listChildren ();
|
||||
for ( var i=0; i<arr.length; i++ ) {
|
||||
arr[i].renderSkin(skin);
|
||||
if (i < arr.length-1)
|
||||
res.write (separator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///**
|
||||
// * list all methods of all prototypes, sort and separate them alphabetically
|
||||
// * @param skin name of skin to render on method
|
||||
// * @param skinSeparator name of skin to render separator between start-letters
|
||||
// */
|
||||
//function index_macro(par) {
|
||||
// var skin = (par && par.skin && par.skin!="") ? par.skin : "indexList";
|
||||
// var skinSeparator = (par && par.skinSeparator && par.skinSeparator!="") ? par.skinSeparator : "indexListSeparator";
|
||||
// var arr = this.listFunctions();
|
||||
// var lastLetter = '';
|
||||
// for ( var i=0; i<arr.length; i++ ) {
|
||||
// if ( arr[i].name.substring(0,1)!=lastLetter ) {
|
||||
// lastLetter = arr[i].name.substring(0,1);
|
||||
// var obj = new Object();
|
||||
// obj.letter = lastLetter.toUpperCase();
|
||||
// arr[i].renderSkin(skinSeparator,obj);
|
||||
// }
|
||||
// arr[i].renderSkin(skin);
|
||||
// }
|
||||
//}
|
||||
/**
|
||||
* list all methods of all prototypes, sort them alphabetically
|
||||
* @param skin name of skin to render on each method
|
||||
* @param skinSeparator name of skin to render as separator between each letters
|
||||
*/
|
||||
function functions_macro(param) {
|
||||
var skinname = (param.skin) ? param.skin : "asListItem";
|
||||
var skinIndexSeparator = (param.indexSeparator) ? param.indexSeparator : "indexSeparator";
|
||||
var separator = (param.separator) ? param.separator : "";
|
||||
var arr = this.listFunctions ();
|
||||
var lastLetter = "";
|
||||
for (var i=0; i<arr.length; i++) {
|
||||
if (arr[i].getName ().substring (0,1)!=lastLetter) {
|
||||
lastLetter = arr[i].getName ().substring (0,1);
|
||||
var tmp = new Object ();
|
||||
tmp.letter = lastLetter.toUpperCase ();
|
||||
this.renderSkin (skinIndexSeparator, tmp);
|
||||
}
|
||||
arr[i].renderSkin (skinname);
|
||||
if (i < arr.length-1)
|
||||
res.write (separator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,29 @@
|
|||
<h2>Application <% this.headline %></h2>
|
||||
|
||||
|
||||
<table width="90%" border="0" cellspacing="1" cellpadding="5">
|
||||
<tr>
|
||||
<td class="headline">
|
||||
<big class="top">Application <% this.headline %></tt></b></big><br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<a class="navig" href="<% this.href action="summary"%>">SUMMARY</a> |
|
||||
<a class="navig" href="<% this.href action="functionindex" %>">INDEX</a> |
|
||||
|
||||
|
||||
|
||||
<% this.comment encoding="html" %>
|
||||
|
||||
<hr>
|
||||
|
||||
<table width="90%" border="0" cellspacing="1" cellpadding="5">
|
||||
<% this.prototypes skin="asSummary"
|
||||
separator="<tr><td class='mainbox'><img src='' width=0 height=0></td></tr>"
|
||||
%>
|
||||
</table>
|
||||
|
||||
|
||||
<a class="navig" href="<% this.href action="summary"%>">SUMMARY</a> |
|
||||
<a class="navig" href="<% this.href action="functionindex" %>">INDEX</a> |
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue