Jeff Williams f27aba37b7 first pass at template overhaul and template API changes
API changes:
+ No more `jsdoc/template` module. Each JSDoc template uses whatever templating system it wants.
+ No more TaffyDB. Each template finds doclets however it wants. (TODO: Update `jsdoc/util/templateHelper` so none of its methods expect a TaffyDB object.)
+ Templates are now loaded with `require('my-template-name-here')`. The resulting object must include a `publish` method.
+ The `publish` method now takes two parameters: a `data` object with `doclets` and `tutorials` properties, and an `options` object. `data.doclets` is just an array.

Other notable changes:
+ No more `haruki` template.
+ Moved the `default` and `silent` templates to new packages.
+ The `.tmpl` files for the `default` template (now called `@jsdoc/template-original`) no longer use custom delimiters.
2019-01-21 14:13:43 -08:00

132 lines
3.4 KiB
Cheetah

<%
var data = obj;
var self = this;
%>
<% if (data.kind !== 'module' && !data.hideconstructor) { %>
<% if (data.kind === 'class' && data.classdesc) { %>
<h2>Constructor</h2>
<% } %>
<% if (data.kind !== 'namespace') { %>
<h4 class="name" id="<%= id %>"><%= data.attribs + (kind === 'class' ? 'new ' : '') +
name + (data.signature || '') %></h4>
<% } %>
<% if (data.summary) { %>
<p class="summary"><%= summary %></p>
<% } %>
<% } %>
<% if (data.kind !== 'module' && data.description && !data.hideconstructor) { %>
<div class="description">
<%= data.description %>
</div>
<% } %>
<% if (data.augments && data.alias && data.alias.indexOf('module:') === 0) { %>
<h5>Extends:</h5>
<%= self.partial('augments.tmpl', data) %>
<% } %>
<% if (kind === 'event' && data.type && data.type.names) {%>
<h5>Type:</h5>
<ul>
<li>
<%= self.partial('type.tmpl', data.type.names) %>
</li>
</ul>
<% } %>
<% if (data['this']) { %>
<h5>This:</h5>
<ul><li><%= this.linkto(data['this'], data['this']) %></li></ul>
<% } %>
<% if (data.params && params.length && !data.hideconstructor) { %>
<h5>Parameters:</h5>
<%= this.partial('params.tmpl', params) %>
<% } %>
<%= this.partial('details.tmpl', data) %>
<% if (data.kind !== 'module' && data.requires && data.requires.length) { %>
<h5>Requires:</h5>
<ul><% data.requires.forEach(function(r) { %>
<li><%= self.linkto(r) %></li>
<% }); %></ul>
<% } %>
<% if (data.fires && fires.length) { %>
<h5>Fires:</h5>
<ul><% fires.forEach(function(f) { %>
<li><%= self.linkto(f) %></li>
<% }); %></ul>
<% } %>
<% if (data.listens && listens.length) { %>
<h5>Listens to Events:</h5>
<ul><% listens.forEach(function(f) { %>
<li><%= self.linkto(f) %></li>
<% }); %></ul>
<% } %>
<% if (data.listeners && listeners.length) { %>
<h5>Listeners of This Event:</h5>
<ul><% listeners.forEach(function(f) { %>
<li><%= self.linkto(f) %></li>
<% }); %></ul>
<% } %>
<% if (data.modifies && modifies.length) {%>
<h5>Modifies:</h5>
<% if (modifies.length > 1) { %><ul><%
modifies.forEach(function(m) { %>
<li><%= self.partial('modifies.tmpl', m) %></li>
<% });
%></ul><% } else {
modifies.forEach(function(m) { %>
<%= self.partial('modifies.tmpl', m) %>
<% });
} } %>
<% if (data.exceptions && exceptions.length) { %>
<h5>Throws:</h5>
<% if (exceptions.length > 1) { %><ul><%
exceptions.forEach(function(r) { %>
<li><%= self.partial('exceptions.tmpl', r) %></li>
<% });
%></ul><% } else {
exceptions.forEach(function(r) { %>
<%= self.partial('exceptions.tmpl', r) %>
<% });
} } %>
<% if (data.returns && returns.length) { %>
<h5>Returns:</h5>
<% if (returns.length > 1) { %><ul><%
returns.forEach(function(r) { %>
<li><%= self.partial('returns.tmpl', r) %></li>
<% });
%></ul><% } else {
returns.forEach(function(r) { %>
<%= self.partial('returns.tmpl', r) %>
<% });
} } %>
<% if (data.yields && yields.length) { %>
<h5>Yields:</h5>
<% if (yields.length > 1) { %><ul><%
yields.forEach(function(r) { %>
<li><%= self.partial('returns.tmpl', r) %></li>
<% });
%></ul><% } else {
yields.forEach(function(r) { %>
<%= self.partial('returns.tmpl', r) %>
<% });
} } %>
<% if (data.examples && examples.length) { %>
<h5>Example<%= examples.length > 1? 's':'' %></h5>
<%= this.partial('examples.tmpl', examples) %>
<% } %>