container.tmpl 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <?js
  2. var self = this;
  3. var isGlobalPage;
  4. docs.forEach(function(doc, i) {
  5. ?>
  6. <?js
  7. // we only need to check this once
  8. if (typeof isGlobalPage === 'undefined') {
  9. isGlobalPage = (doc.kind === 'globalobj');
  10. }
  11. ?>
  12. <?js if (doc.kind === 'mainpage' || (doc.kind === 'package')) { ?>
  13. <?js= self.partial('mainpage.tmpl', doc) ?>
  14. <?js } else if (doc.kind === 'source') { ?>
  15. <?js= self.partial('source.tmpl', doc) ?>
  16. <?js } else { ?>
  17. <section>
  18. <header>
  19. <?js if (!doc.longname || doc.kind !== 'module') { ?>
  20. <h2><?js if (doc.ancestors && doc.ancestors.length) { ?>
  21. <span class="ancestors"><?js= doc.ancestors.join('') ?></span>
  22. <?js } ?>
  23. <?js if (doc.kind === 'namespace') { ?>
  24. Namespace
  25. <?js } else { ?>
  26. <?js= doc.name ?>
  27. <?js } ?>
  28. <?js if (doc.variation) { ?>
  29. <sup class="variation"><?js= doc.variation ?></sup>
  30. <?js } ?></h2>
  31. <?js if (doc.classdesc) { ?>
  32. <div class="class-description usertext"><?js= doc.classdesc ?></div>
  33. <?js } ?>
  34. <?js } else if (doc.kind === 'module' && doc.modules) { ?>
  35. <?js doc.modules.forEach(function(module) { ?>
  36. <?js if (module.classdesc) { ?>
  37. <div class="class-description"><?js= module.classdesc ?></div>
  38. <?js } ?>
  39. <?js }) ?>
  40. <?js } ?>
  41. </header>
  42. <article>
  43. <?js if (!doc.hideconstructor) { ?>
  44. <div class="container-overview">
  45. <?js if (doc.kind === 'module' && doc.modules) { ?>
  46. <?js if (doc.description) { ?>
  47. <div class="description usertext"><?js= doc.description ?></div>
  48. <?js } ?>
  49. <?js doc.modules.forEach(function(module) { ?>
  50. <?js= self.partial('method.tmpl', module) ?>
  51. <?js }) ?>
  52. <?js } else if (doc.kind === 'class') { ?>
  53. <?js= self.partial('method.tmpl', doc) ?>
  54. <?js } else if (doc.kind === 'namespace') { ?>
  55. <?js= self.partial('namespace.tmpl', doc) ?>
  56. <?js } else { ?>
  57. <?js= self.partial('details.tmpl', doc) ?>
  58. <?js if (doc.description) { ?>
  59. <div class="description usertext"><?js= doc.description ?></div>
  60. <?js } ?>
  61. <?js if (doc.examples && doc.examples.length) { ?>
  62. <h3>Example<?js= doc.examples.length > 1? 's':'' ?></h3>
  63. <?js= self.partial('examples.tmpl', doc.examples) ?>
  64. <?js } ?>
  65. <?js } ?>
  66. </div>
  67. <?js } ?>
  68. <?js if (doc.augments && doc.augments.length) { ?>
  69. <h3 class="subsection-title">Extends</h3>
  70. <?js= self.partial('augments.tmpl', doc) ?>
  71. <?js } ?>
  72. <?js if (doc.requires && doc.requires.length) { ?>
  73. <h3 class="subsection-title">Requires</h3>
  74. <ul><?js doc.requires.forEach(function(r) { ?>
  75. <li><?js= self.linkto(r, r) ?></li>
  76. <?js }); ?></ul>
  77. <?js } ?>
  78. <?js
  79. var classes = self.find({kind: 'class', memberof: doc.longname});
  80. if (!isGlobalPage && classes && classes.length) {
  81. ?>
  82. <h3 class="subsection-title">Classes</h3>
  83. <dl><?js classes.forEach(function(c) { ?>
  84. <dt><?js= self.linkto(c.longname, c.name) ?></dt>
  85. <dd><?js if (c.summary) { ?><?js= c.summary ?><?js } ?></dd>
  86. <?js }); ?></dl>
  87. <?js } ?>
  88. <?js
  89. var interfaces = self.find({kind: 'interface', memberof: doc.longname});
  90. if (!isGlobalPage && interfaces && interfaces.length) {
  91. ?>
  92. <h3 class="subsection-title">Interfaces</h3>
  93. <dl><?js interfaces.forEach(function(i) { ?>
  94. <dt><?js= self.linkto(i.longname, i.name) ?></dt>
  95. <dd><?js if (i.summary) { ?><?js= i.summary ?><?js } ?></dd>
  96. <?js }); ?></dl>
  97. <?js } ?>
  98. <?js
  99. var mixins = self.find({kind: 'mixin', memberof: doc.longname});
  100. if (!isGlobalPage && mixins && mixins.length) {
  101. ?>
  102. <h3 class="subsection-title">Mixins</h3>
  103. <dl><?js mixins.forEach(function(m) { ?>
  104. <dt><?js= self.linkto(m.longname, m.name) ?></dt>
  105. <dd><?js if (m.summary) { ?><?js= m.summary ?><?js } ?></dd>
  106. <?js }); ?></dl>
  107. <?js } ?>
  108. <?js
  109. var namespaces = self.find({kind: 'namespace', memberof: doc.longname});
  110. if (!isGlobalPage && namespaces && namespaces.length) {
  111. ?>
  112. <h3 class="subsection-title">Namespaces</h3>
  113. <dl><?js namespaces.forEach(function(n) { ?>
  114. <dt><?js= self.linkto(n.longname, n.name) ?></dt>
  115. <dd><?js if (n.summary) { ?><?js= n.summary ?><?js } ?></dd>
  116. <?js }); ?></dl>
  117. <?js } ?>
  118. <?js
  119. var members = self.find({kind: 'member', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
  120. // symbols that are assigned to module.exports are not globals, even though they're not a memberof anything
  121. if (isGlobalPage && members && members.length && members.forEach) {
  122. members = members.filter(function(m) {
  123. return m.longname && m.longname.indexOf('module:') !== 0;
  124. });
  125. }
  126. if (members && members.length && members.forEach) {
  127. ?>
  128. <h3 class="subsection-title">Members</h3>
  129. <?js members.forEach(function(p) { ?>
  130. <?js= self.partial('members.tmpl', p) ?>
  131. <?js }); ?>
  132. <?js } ?>
  133. <?js
  134. var methods = self.find({kind: 'function', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
  135. if (methods && methods.length && methods.forEach) {
  136. ?>
  137. <h3 class="subsection-title">Methods</h3>
  138. <?js methods.forEach(function(m) { ?>
  139. <?js= self.partial('method.tmpl', m) ?>
  140. <?js }); ?>
  141. <?js } ?>
  142. <?js
  143. var typedefs = self.find({kind: 'typedef', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
  144. if (typedefs && typedefs.length && typedefs.forEach) {
  145. ?>
  146. <h3 class="subsection-title">Type Definitions</h3>
  147. <?js typedefs.forEach(function(e) {
  148. if (e.signature) {
  149. ?>
  150. <?js= self.partial('method.tmpl', e) ?>
  151. <?js
  152. }
  153. else {
  154. ?>
  155. <?js= self.partial('members.tmpl', e) ?>
  156. <?js
  157. }
  158. }); ?>
  159. <?js } ?>
  160. <?js
  161. var events = self.find({kind: 'event', memberof: isGlobalPage ? {isUndefined: true} : doc.longname});
  162. if (events && events.length && events.forEach) {
  163. ?>
  164. <h3 class="subsection-title">Events</h3>
  165. <?js events.forEach(function(e) { ?>
  166. <?js= self.partial('method.tmpl', e) ?>
  167. <?js }); ?>
  168. <?js } ?>
  169. </article>
  170. </section>
  171. <?js } ?>
  172. <?js }); ?>