container.tmpl 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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.import) { ?>
  54. <h2 class="subsection-title">Import</h2>
  55. <p><?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>.</p>
  56. <pre class="prettyprint source lang-js"><code><?js= doc.import ?></code></pre>
  57. <?js } ?>
  58. <?js
  59. var ignoreInheritedSymbols = { ...(self.ignoreInheritedSymbols ? { inherited: {isUndefined: true} } : {}) };
  60. var classes = self.find({kind: 'class', memberof: doc.longname});
  61. if (!isGlobalPage && classes && classes.length) {
  62. ?>
  63. <h2 class="subsection-title">Classes</h2>
  64. <dl><?js classes.forEach(function(c) { ?>
  65. <dt><?js= self.linkto(c.longname, c.name) ?></dt>
  66. <dd><?js if (c.summary) { ?><?js= c.summary ?><?js } ?></dd>
  67. <?js }); ?></dl>
  68. <?js } ?>
  69. <?js
  70. var members = self.find({kind: 'member', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...ignoreInheritedSymbols});
  71. // symbols that are assigned to module.exports are not globals, even though they're not a memberof anything
  72. if (isGlobalPage && members && members.length && members.forEach) {
  73. members = members.filter(function(m) {
  74. return m.longname && m.longname.indexOf('module:') !== 0;
  75. });
  76. }
  77. if (members && members.length && members.forEach) {
  78. ?>
  79. <h2 class="subsection-title">Properties</h2>
  80. <?js members.forEach(function(p) { ?>
  81. <?js= self.partial('members.tmpl', p) ?>
  82. <?js }); ?>
  83. <?js } ?>
  84. <?js
  85. var methods = self.find({kind: 'function', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...ignoreInheritedSymbols});
  86. var staticMethods = methods.filter(function(m) { return m.scope === 'static'; });
  87. var instanceMethods = methods.filter(function(m) { return m.scope !== 'static'; });
  88. if (instanceMethods.length) {
  89. ?>
  90. <h2 class="subsection-title">Methods</h2>
  91. <?js instanceMethods.forEach(function(m) { ?>
  92. <?js= self.partial('method.tmpl', m) ?>
  93. <?js }); ?>
  94. <?js } ?>
  95. <?js if (staticMethods.length) { ?>
  96. <h2 class="subsection-title">Static Methods</h2>
  97. <?js staticMethods.forEach(function(m) { ?>
  98. <?js= self.partial('method.tmpl', m) ?>
  99. <?js }); ?>
  100. <?js } ?>
  101. <?js
  102. var typedefs = self.find({kind: 'typedef', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...ignoreInheritedSymbols});
  103. if (typedefs && typedefs.length && typedefs.forEach) {
  104. ?>
  105. <h2 class="subsection-title">Type Definitions</h2>
  106. <?js typedefs.forEach(function(e) {
  107. if (e.signature) {
  108. ?>
  109. <?js= self.partial('method.tmpl', e) ?>
  110. <?js
  111. }
  112. else {
  113. ?>
  114. <?js= self.partial('members.tmpl', e) ?>
  115. <?js
  116. }
  117. }); ?>
  118. <?js } ?>
  119. <?js
  120. var events = self.find({kind: 'event', memberof: isGlobalPage ? {isUndefined: true} : doc.longname, ...ignoreInheritedSymbols});
  121. if (events && events.length && events.forEach) {
  122. ?>
  123. <h2 class="subsection-title">Events</h2>
  124. <?js events.forEach(function(e) { ?>
  125. <?js= self.partial('method.tmpl', e) ?>
  126. <?js }); ?>
  127. <?js } ?>
  128. <?js if (doc.meta && doc.meta.shortpath) { ?>
  129. <h2 class="subsection-title">Source</h2>
  130. <p>
  131. <a href="https://github.com/mrdoob/three.js/blob/master/<?js= doc.meta.shortpath ?>" target="_blank" rel="noopener"><?js= doc.meta.shortpath ?></a>
  132. </p>
  133. <?js } ?>
  134. </article>
  135. </section>
  136. <?js } ?>
  137. <?js }); ?>
粤ICP备19079148号