major overhaul of the manage app's api-documentation functions.
things can now be rendered to static html, new helma features are supported (prototype extension), everyhting is done in a nice and clean way with skins.
This commit is contained in:
parent
76bbe4053b
commit
7633e98eea
59 changed files with 1052 additions and 578 deletions
8
DocFunction/actions.js
Normal file
8
DocFunction/actions.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
function main_action () {
|
||||
this.getParentElement ().readFiles ();
|
||||
res.data.body = this.renderSkinAsString ("main");
|
||||
renderSkin ("api");
|
||||
}
|
||||
|
||||
|
||||
|
7
DocFunction/asLargeListItem.skin
Normal file
7
DocFunction/asLargeListItem.skin
Normal file
|
@ -0,0 +1,7 @@
|
|||
<tr><td>
|
||||
<a href="<% this.href action="main" %>" target="main"><% this.link %></a><br/>
|
||||
<% this.comment length="200" %>
|
||||
</td></tr>
|
||||
|
||||
|
||||
|
8
DocFunction/asLargeListItemSkin.skin
Normal file
8
DocFunction/asLargeListItemSkin.skin
Normal file
|
@ -0,0 +1,8 @@
|
|||
<tr><td>
|
||||
<a href="<% this.href action="main" %>" target="main"><% this.link %></a><br/>
|
||||
<% this.comment length="200" %>
|
||||
<% this.skinparameters separator=", "%>
|
||||
</td></tr>
|
||||
|
||||
|
||||
|
2
DocFunction/asListItem.skin
Normal file
2
DocFunction/asListItem.skin
Normal file
|
@ -0,0 +1,2 @@
|
|||
<% this.link %><br>
|
||||
|
1
DocFunction/asParentListItem.skin
Normal file
1
DocFunction/asParentListItem.skin
Normal file
|
@ -0,0 +1 @@
|
|||
<% this.link %>
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
|
||||
function getApplication() {
|
||||
return this.getParentElement().getParentElement();
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<tr>
|
||||
<td width="200" class="list_property"><b><a href="<% this.prototypehref %>#<% this.name %>"><% this.name %></a></b></td>
|
||||
<td class="list_property"><% this.typename %> in <% this.prototypename %>
|
||||
<td class="list_property"><small>(<a href="<% this.href action="main" %>"><% this.prototypename %>/<% this.location %></a>)</small></td>
|
||||
</tr>
|
|
@ -1,3 +0,0 @@
|
|||
<tr>
|
||||
<td class="list_separator" colspan="3"><b> <% param.letter %></b></td>
|
||||
</tr>
|
|
@ -1,7 +0,0 @@
|
|||
<tr>
|
||||
<td class="list_property" align="right" valign="top" width="70" height="40"><font size=-1><a name="<% this.name %>"><!----></a>
|
||||
<code> <% param.group %></code></font></td>
|
||||
<td class="list_property" valign="top"><DL><DT><CODE><B>
|
||||
<a href="<% this.href action="main" %>"><% this.name %></a></B></CODE><DT><DL><% this.comment %><br><small><% this.tags %></small></DT></DL></TD>
|
||||
</tr>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<tr>
|
||||
<td class="list_property" align="right" valign="top" width="70" height="40"><font size=-1><a name="<% this.name %>"><!----></a>
|
||||
<code> <% param.group %></code></font></td>
|
||||
<td class="list_property" valign="top"><DL><DT><CODE><B>
|
||||
<a href="<% this.href action="main" %>"><% this.name %> (<% this.args %>)</a></B></CODE><small><i> in <% docprototype.name %>/<% this.location %></i></small><DT><DL><% this.comment %><br><small><% this.tags %></small></DT></DL></TD>
|
||||
</tr>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<tr>
|
||||
<td class="list_property" align="right" valign="top" width="70" height="40"><font size=-1><a name="<% this.name %>"><!----></a>
|
||||
<code> <% param.group %></code></font></td>
|
||||
<td class="list_property" valign="top"><dl><dt><code><b>
|
||||
<a href="<% this.href action="main" %>"><% docprototype.name %>.<% this.name %></a></B></code>
|
||||
<small><i> in <% docprototype.name %>/<% this.location %></i></small>
|
||||
<dt><dl><% this.comment %><br><small><% this.tags %></small></dt></dl></td>
|
||||
</tr>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<tr>
|
||||
<td class="list_property" align="right" valign="top" width="70" height="40"><font size=-1><a name="<% this.name %>"><!----></a>
|
||||
<code> <% param.group %></code></font></td>
|
||||
<td class="list_property" valign="top"><dl><dt><code><b>
|
||||
<a href="<% this.href action="main" %>"><% docprototype.name %>.<% this.name %></a></B></CODE><DT><DL><% this.comment %><br><small><% this.tags %></small></dt></dl></td>
|
||||
</tr>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<tr>
|
||||
<td class="list_property" align="right" valign="top" width="70" height="40"><font size=-1><a name="<% this.name %>"><!----></a>
|
||||
<code> <% param.group %></code></font></td>
|
||||
<td class="list_property" valign="top"><DL><DT><CODE><B>
|
||||
<a href="<% this.href action="main" %>"><% this.name %>()</a></B></CODE><DT><DL><% this.comment %><br><small><% this.tags %></small></DT></DL></TD>
|
||||
</tr>
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/**
|
||||
* macro rendering a skin
|
||||
* @param name name of skin
|
||||
|
@ -8,120 +9,83 @@ function skin_macro(par) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro-wrapper for href-function
|
||||
* @param action name of action to call on this prototype, default main
|
||||
*/
|
||||
function href_macro(par) {
|
||||
return this.href( (par&&par.action)?par.action:"main" );
|
||||
}
|
||||
function href_macro(param) { return this.href ((param && param.action) ? param.action : "main"); }
|
||||
|
||||
function comment_macro (param) { return renderComment (this, param); }
|
||||
function content_macro (param) { return this.getContent (); }
|
||||
function tags_macro (param) { return renderTags (this, param); }
|
||||
function location_macro (param) { return renderLocation (this, param); }
|
||||
function link_macro (param) { return renderLink (this, param); }
|
||||
|
||||
//// END OF COPIED FUNCTIONS
|
||||
|
||||
|
||||
/**
|
||||
* macro rendering page head
|
||||
*/
|
||||
function head_macro(par) {
|
||||
var obj = new Object();
|
||||
obj.path = this.getPath();
|
||||
var appObj = this.getApplication();
|
||||
appObj.renderSkin("head",obj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* utility function for head_macro, rendering link to app and to prototype
|
||||
*/
|
||||
function getPath() {
|
||||
var protoObj = this.getDocPrototype();
|
||||
var str = protoObj.getPath() + "/" + this.getFullName();
|
||||
return( str );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro returning name of file this method resides in
|
||||
*/
|
||||
function location_macro(par) {
|
||||
var f = new File ( this.getLocation() );
|
||||
return f.getName();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro returning the type of this method (Action, Template, Skin, Macro, Function)
|
||||
*/
|
||||
function typename_macro(par) {
|
||||
return this.getTypeName();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro returning a link to the prototype page
|
||||
* @param action name of action to call on this prototype, default main
|
||||
*/
|
||||
function prototypehref_macro(par) {
|
||||
return this.getDocPrototype().href( (par&&par.action)?par.action:"main" )
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro returning the name of the prototype this method belongs to
|
||||
*/
|
||||
function prototypename_macro(par) {
|
||||
return this.getDocPrototype().getName();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro returning the comment text of this method
|
||||
* (excluding the tags!)
|
||||
* @param size (optional) text is cutoff after a number of chars
|
||||
*/
|
||||
function comment_macro(par) {
|
||||
var str = this.getComment();
|
||||
if ( par && par.length && str.length > par.size ) {
|
||||
return ( str.substring(0,par.size) );
|
||||
} else {
|
||||
return ( str );
|
||||
function headline_macro (param) {
|
||||
var p = this.getParentElement ();
|
||||
var handler = (p!=null) ? p.getName () : "";
|
||||
if (this.getType () == this.ACTION) {
|
||||
res.write ("/" + this.getName ());
|
||||
} else if (this.getType () == this.FUNCTION) {
|
||||
if (handler!="" && handler!="global")
|
||||
res.write (handler + ".");
|
||||
res.write (this.getName () + " (");
|
||||
var arr = this.listParameters ();
|
||||
for (var i=0; i<arr.length; i++) {
|
||||
res.write (arr[i]);
|
||||
if (i<arr.length-1) {
|
||||
res.write (", ");
|
||||
}
|
||||
}
|
||||
res.write (")");
|
||||
} else if (this.getType () == this.MACRO) {
|
||||
res.write ("<% ");
|
||||
if (handler!="" && handler!="global")
|
||||
res.write (handler + ".");
|
||||
var name = this.getName ();
|
||||
if (name.indexOf("_macro")>-1)
|
||||
name = name.substring (0, name.length-6);
|
||||
res.write (name);
|
||||
res.write (" %>");
|
||||
} else if (this.getType () == this.SKIN) {
|
||||
if (handler!="" && handler!="global")
|
||||
res.write (handler + "/");
|
||||
res.write (this.getName ());
|
||||
res.write (".skin");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro rendering the list of tags
|
||||
*/
|
||||
function tags_macro() {
|
||||
var arr = this.listTags();
|
||||
var argCt = 0;
|
||||
for ( var i in arr ) {
|
||||
if ( arr[i].getKind()==Packages.helma.doc.DocTag.ARG )
|
||||
argCt++;
|
||||
res.write( arr[i].render(argCt,this) );
|
||||
function skinparameters_macro (param) {
|
||||
if (this.getType () == this.SKIN) {
|
||||
this.parameters_macro (param);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro rendering sequence of arg1, arg2 etc
|
||||
* according to number of arguments in doctags.
|
||||
*/
|
||||
function args_macro() {
|
||||
var ct = this.countTags(Packages.helma.doc.DocTag.ARG);
|
||||
for ( var i=0; i<ct; i++) {
|
||||
res.write ( "arg" + (i+1) );
|
||||
if ( i<(ct-1) ) res.write (", ");
|
||||
else res.write ("");
|
||||
function parameters_macro (param) {
|
||||
var separator = (param.separator) ? param.separator : ", ";
|
||||
var arr = this.listParameters ();
|
||||
for (var i=0; i<arr.length ;i++) {
|
||||
res.write (arr[i]);
|
||||
if (i<arr.length-1)
|
||||
res.write (separator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* macro returning nicely formatted sourcecode of this method.
|
||||
* code is encoded, >% %<-tags are colorcoded, line numbers are added
|
||||
*/
|
||||
function source_macro(par) {
|
||||
var str = this.getSource();
|
||||
var str = this.getContent ();
|
||||
var arr = str.split("<%");
|
||||
var str2 = "";
|
||||
for ( var i=0; i<arr.length; i++ ) {
|
||||
|
@ -140,18 +104,12 @@ function source_macro(par) {
|
|||
var str4 = "";
|
||||
for ( var i=0; i<arr.length; i++ ) {
|
||||
str4 += '<font color="#aaaaaa">' + (i+1) + ':</font> '
|
||||
if ( i<100 ) str4+=' ';
|
||||
if (i<99) str4+=' ';
|
||||
if (i<9) str4+=' ';
|
||||
str4 += arr[i] + "<br>";
|
||||
}
|
||||
return ( str4 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro returning the fullname of this method
|
||||
*/
|
||||
function fullname_macro(par) {
|
||||
return this.getFullName();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
if ( checkAddress()==false ) return;
|
||||
if ( checkAuth(this)==false ) return;
|
||||
|
||||
res.data.body = this.renderSkinAsString("main");
|
||||
res.data.title = "Application " + this.name;
|
||||
renderSkin("api");
|
||||
|
||||
|
|
@ -1,9 +1,34 @@
|
|||
<% this.head %>
|
||||
<table width="90%" border="0" cellspacing="1" cellpadding="5">
|
||||
<tr>
|
||||
<td class="headline">
|
||||
<big><tt><% this.headline %></tt></big><br>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<div class="list_property">
|
||||
<small> <i>in <% docprototype.name%>/<% this.location %>:</i></small>
|
||||
</div>
|
||||
<tr>
|
||||
<td class="mainbox">
|
||||
<% this.comment suffix="<br><br>" %>
|
||||
<% this.skinparameters prefix="general parameters used in this skin:<ul><li><code>" separator="</code><li><code>" suffix="</code></ul><br>" %>
|
||||
<ul>
|
||||
<% this.tags type="param" skin="parameter" %>
|
||||
<% this.tags type="return" skin="return" %>
|
||||
<% this.tags type="author" skin="author" %>
|
||||
<% this.tags type="see" skin="see" %>
|
||||
<% this.tags type="deprecated" skin="deprecated" %>
|
||||
<% this.tags type="overrides" skin="overrides" %>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table width="90%" border="0" cellspacing="1" cellpadding="5">
|
||||
<tr>
|
||||
<td>Sourcecode in <% this.location %>:
|
||||
<pre><% this.source %></pre>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<pre><% this.source %></pre>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue