container.tmpl 6.7 KB

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