class.ejs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <div class="clearfix category">
  2. <% var item; if( (item = items[ 0 ]) && item.hasOwnProperty('constructor') ) { %>
  3. <article class="clearfix <%= item.itemtype %>">
  4. <h3 id="<%- gennerateID( module + ':' + name ) %>" <% if ( item.hasOwnProperty( 'deprecated' ) ) { %>class="deprecated"<% } %> ><%= item.name %>
  5. <% if ( item.since ) { %><span
  6. class="version"><%- item.since %></span><% } %>
  7. </h3>
  8. <% if ( item[ 'deprecated' ] ) { %><div class="warning"><%- markdown( item[ 'deprecated' ] ) %></div><% } %>
  9. <% if( item.uses ) { %><%- renderUses( item.uses ) %><% }%>
  10. <% if ( item.grammars ) { %>
  11. <ul class="signature">
  12. <% _.forEach( item.grammars, function( grammar ) { %>
  13. <li><%= grammar.signature %>
  14. <% if ( grammar.return ) { %><span class="return">⇒ <%= grammar.return %></span><% } %>
  15. <% if ( grammar.since ) { %><span class="version"><%= grammar.since %></span><% } %>
  16. </li><% });%>
  17. </ul>
  18. <% } %>
  19. <% if ( item.params ) { %>
  20. <p>参数: </p>
  21. <%- renderParams( item.params ) %>
  22. <% } %>
  23. <% if ( item.returns ) { %>
  24. <p>返回值: </p>
  25. <%- renderParams( item.returns ) %>
  26. <% } %>
  27. <%- markdown( item.description || description || '' ) %>
  28. <% _.forEach( item.examples || [], function( example ) { %>
  29. <%- formatExample( example ) %>
  30. <% }) %>
  31. </article>
  32. <% } else { %>
  33. <h2 id="<%- gennerateID( module + ':' + name ) %>"><%= title || name %></h2>
  34. <% if ( description ) { %><%- markdown( description ) %><% } %>
  35. <% } %>
  36. <% if ( options.length ) { %> <%- renderTpl( 'options' ) %> <% } %>
  37. <% if ( events.length ) { %> <%- renderTpl( 'events' ) %> <% } %>
  38. <% if ( items.length ) { %> <%- renderTpl( 'items' ) %> <% } %>
  39. <% if ( plugins.length ) { %> <%- renderTpl( 'plugins' ) %> <% } %>
  40. </div>
  41. <hr />