container.tmpl 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <?js
  2. var self = this;
  3. docs.forEach(function(doc, i) {
  4. ?>
  5. <?js if (doc.kind === 'mainpage' || (doc.kind === 'package')) { ?>
  6. <?js= self.partial('mainpage.tmpl', doc) ?>
  7. <?js } else if (doc.kind === 'source') { ?>
  8. <?js= self.partial('source.tmpl', doc) ?>
  9. <?js } else { ?>
  10. <section>
  11. <header>
  12. <h2><?js if (doc.ancestors && doc.ancestors.length) { ?>
  13. <span class="ancestors"><?js= doc.ancestors.join('') ?></span>
  14. <?js } ?>
  15. <?js= doc.name ?>
  16. <?js if (doc.variation) { ?>
  17. <sup class="variation"><?js= doc.variation ?></sup>
  18. <?js } ?></h2>
  19. <?js if (doc.classdesc) { ?>
  20. <div class="class-description"><?js= doc.classdesc ?></div>
  21. <?js } ?>
  22. </header>
  23. <article>
  24. <div class="container-overview">
  25. <?js if (doc.kind === 'module' && doc.module) { ?>
  26. <?js= self.partial('method.tmpl', doc.module) ?>
  27. <?js } ?>
  28. <?js if (doc.kind === 'class') { ?>
  29. <?js= self.partial('method.tmpl', doc) ?>
  30. <?js } else { ?>
  31. <?js if (doc.description) { ?>
  32. <div class="description"><?js= doc.description ?></div>
  33. <?js } ?>
  34. <?js= self.partial('details.tmpl', doc) ?>
  35. <?js if (doc.examples && doc.examples.length) { ?>
  36. <h3>Example<?js= doc.examples.length > 1? 's':'' ?></h3>
  37. <?js= self.partial('examples.tmpl', doc.examples) ?>
  38. <?js } ?>
  39. <?js } ?>
  40. </div>
  41. <?js if (doc.augments && doc.augments.length) { ?>
  42. <h3 class="subsection-title">Extends</h3>
  43. <ul><?js doc.augments.forEach(function(a) { ?>
  44. <li><?js= self.linkto(a, a) ?></li>
  45. <?js }); ?></ul>
  46. <?js } ?>
  47. <?js if (doc.mixes && doc.mixes.length) { ?>
  48. <h3 class="subsection-title">Mixes In</h3>
  49. <ul><?js doc.mixes.forEach(function(a) { ?>
  50. <li><?js= self.linkto(a, a) ?></li>
  51. <?js }); ?></ul>
  52. <?js } ?>
  53. <?js if (doc.requires && doc.requires.length) { ?>
  54. <h3 class="subsection-title">Requires</h3>
  55. <ul><?js doc.requires.forEach(function(r) { ?>
  56. <li><?js= self.linkto(r, r) ?></li>
  57. <?js }); ?></ul>
  58. <?js } ?>
  59. <?js
  60. var classes = self.find({kind: 'class', memberof: doc.longname});
  61. if (doc.kind !== 'globalobj' && classes && classes.length) {
  62. ?>
  63. <h3 class="subsection-title">Classes</h3>
  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 namespaces = self.find({kind: 'namespace', memberof: doc.longname});
  71. if (doc.kind !== 'globalobj' && namespaces && namespaces.length) {
  72. ?>
  73. <h3 class="subsection-title">Namespaces</h3>
  74. <dl><?js namespaces.forEach(function(n) { ?>
  75. <dt><a href="namespaces.html#<?js= n.longname ?>"><?js= self.linkto(n.longname, n.name) ?></a></dt>
  76. <dd><?js if (n.summary) { ?><?js= n.summary ?><?js } ?></dd>
  77. <?js }); ?></dl>
  78. <?js } ?>
  79. <?js
  80. var members = self.find({kind: 'member', memberof: title === 'Global' ? {isUndefined: true} : doc.longname});
  81. if (members && members.length && members.forEach) {
  82. ?>
  83. <h3 class="subsection-title">Members</h3>
  84. <dl><?js members.forEach(function(p) { ?>
  85. <?js= self.partial('members.tmpl', p) ?>
  86. <?js }); ?></dl>
  87. <?js } ?>
  88. <?js
  89. var methods = self.find({kind: 'function', memberof: title === 'Global' ? {isUndefined: true} : doc.longname});
  90. if (methods && methods.length && methods.forEach) {
  91. // Categorize methods
  92. var categories = {};
  93. methods.forEach(function(method) {
  94. var category = (method.category || 'Other') + ' methods';
  95. if (!(category in categories)) {
  96. categories[category] = [];
  97. }
  98. categories[category].push(method);
  99. });
  100. if (Object.keys(categories) === 1) {
  101. categories = { "Methods": categories['Other methods'] };
  102. }
  103. Object.keys(categories).sort().forEach(function(category) {
  104. ?>
  105. <h3 class="subsection-title"><a name="<?js= category.toLowerCase().replace(/[^a-z0-9]/gi, '-') ?>"></a><?js= category ?></h3>
  106. <dl><?js categories[category].forEach(function(m) { ?>
  107. <?js= self.partial('method.tmpl', m) ?>
  108. <?js }); ?></dl>
  109. <?js
  110. });
  111. }
  112. ?>
  113. <?js
  114. var typedefs = self.find({kind: 'typedef', memberof: title === 'Global' ? {isUndefined: true} : doc.longname});
  115. if (typedefs && typedefs.length && typedefs.forEach) {
  116. ?>
  117. <h3 class="subsection-title">Type Definitions</h3>
  118. <dl><?js typedefs.forEach(function(e) {
  119. if (e.signature) {
  120. ?>
  121. <?js= self.partial('method.tmpl', e) ?>
  122. <?js
  123. }
  124. else {
  125. ?>
  126. <?js= self.partial('members.tmpl', e) ?>
  127. <?js
  128. }
  129. }); ?></dl>
  130. <?js } ?>
  131. <?js
  132. var events = self.find({kind: 'event', memberof: title === 'Global' ? {isUndefined: true} : doc.longname});
  133. if (events && events.length && events.forEach) {
  134. ?>
  135. <h3 class="subsection-title">Events</h3>
  136. <dl><?js events.forEach(function(e) { ?>
  137. <?js= self.partial('method.tmpl', e) ?>
  138. <?js }); ?></dl>
  139. <?js } ?>
  140. </article>
  141. </section>
  142. <?js } ?>
  143. <?js }); ?>