container.tmpl 6.5 KB

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