UNPKG

apinode

Version:

An API server that can greatly reduce the work needed to implment API services. It can also cooperate with other API node to make it a mesh of services.

51 lines (48 loc) 1.12 kB
<% var word = _params.word, tableStyle = _params.tableStyle, rows = _params.rows; %> <%if( Object.prototype.toString.call(rows) === '[object Array]' ) {%> <table class="table <%=tableStyle.join(' ')%>"> <thead> <tr> <th style="width:150px"><%=word.property || "Property"%></th> <th style=""><%=word.description || "Description"%></th> </tr> </thead> <tbody> <% if(rows.length > 0){ rows.forEach(function(ele){ tr(0, ele); }); } else { %> <tr> <td style="text-align: center;">-</td> <td style="text-align: center;">-</td> </tr> <% }%> </tbody> </table> <%} else {%> Is not array. <%}%> <%function tr(deep, params){%> <tr> <td><%=getBlockquote(deep) + params.key + getTypeMark(params.type)%></td> <td><span class='markdown'><%=params.descTx%></span></td> </tr> <%if(params.more){ params.more.forEach(function(ele){ tr(deep+1, ele); }); }}%> <% function getBlockquote(deep) { return new Array(deep*6).fill("&nbsp;").join("") + (deep > 0 ? "." : ""); } function getTypeMark(type) { return type == 'array' ? '&nbsp;&nbsp;&nbsp;[&nbsp;&nbsp;]' : ''; } %>