items.ejs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <% _.sortBy( items, function( value ){ return value.uses ? value.uses.length : 0; } ).forEach(function( item ) { %>
  2. <% if( item.hasOwnProperty('constructor') ) { return; } %>
  3. <article class="clearfix <%= item.itemtype %>">
  4. <h3 id="<%- gennerateID( item[ 'class' ] ? (item.module + ':' + item[ 'class' ] + ':' + item.name) : (item.module + ':' + item.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 || '' ) %>
  28. <% _.forEach( item.examples || [], function( example ) { %>
  29. <%- formatExample( example ) %>
  30. <% }) %>
  31. </article>
  32. <% }) %>