container.tmpl 6.2 KB

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