lib.jade 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. - var methodSection, constructorSection, propertySection, eventSection;
  2. -function renameMemberTitle(title, count)
  3. if title.indexOf("ethods") >= 0
  4. span Functions (#{count})
  5. else if title.indexOf("ropert") >= 0
  6. span Properties (#{count})
  7. else
  8. span #{title} (#{count})
  9. mixin article(obj, parents)
  10. if typeof obj === 'string'
  11. obj = list[obj]
  12. if (obj.private !== true && obj.name.charAt(0) !== "$")
  13. title = obj.path + (obj.type ? ' (' + obj.type + ')' : '')
  14. article.article(id=obj.path, data-title=title)
  15. if obj.type === 'section' || obj.type === 'namespace' || obj.type === 'class' || obj.type === 'mixin'
  16. if obj.stability
  17. mixin markdown(">" + obj.stability)
  18. if obj.description
  19. .section.description
  20. .memberContent
  21. mixin markdown(obj.description)
  22. else
  23. .section.method
  24. .memberContent
  25. if obj.signatures
  26. div.title
  27. i(id='#{obj.path}', class='methodToggle methodClicker inactive icon-caret-right')
  28. ul.signatures
  29. -var loops = 0;
  30. for sig in obj.signatures
  31. li.signature
  32. ul
  33. li.signature-call!= signature(obj, sig, ["methodClicker"])
  34. if sig.returns
  35. li.signature-returns
  36. ul.argument-types
  37. for ret in sig.returns
  38. li.argument-type!= returnLink(obj, ret, [])
  39. -if (loops == 0)
  40. -loops = 1 // ensure that we only print ONE meta info UL per signature (some methods have multiple signatures)
  41. ul.metaInfo
  42. if obj.undocumented
  43. li
  44. span.label.undocumented Undocumented
  45. if obj.experimental
  46. li
  47. span.label.experimental Experimental
  48. if obj.readonly
  49. li
  50. span.label.read-only Read-Only
  51. if obj.chainable
  52. li
  53. span.label.chainable Chainable
  54. if obj.internal
  55. li
  56. span.label.internal Internal
  57. if obj.deprecated
  58. li
  59. span.label.deprecated
  60. | Deprecated
  61. if obj.deprecated.from
  62. |   (since #{obj.deprecated.from})
  63. if obj.deprecated.off
  64. |  and will be removed on #{obj.deprecated.off}
  65. if obj.alias_of
  66. li
  67. span.label.alias.single
  68. | Aliased as:
  69. != link(obj.alias_of)
  70. else if obj.aliases.length
  71. li
  72. span.label.alias.multiple
  73. | Aliased as:
  74. ul.alias
  75. for alias in obj.aliases
  76. li
  77. mixin link(alias)
  78. if obj.related_to
  79. li
  80. span.label.related-to
  81. | Related to
  82. mixin link(obj.related_to, ["relatedToLink"])
  83. div.sideToggler
  84. div(id='ellipsis_#{obj.path}', class='ellipsis_description')
  85. mixin markdown(obj.short_description)
  86. div.description
  87. mixin markdown(obj.description)
  88. if obj.bound && ~obj.bound.indexOf('#')
  89. p.note.methodized
  90. | This method can be called <em>either</em> as an
  91. != link(obj.bound, ['link-short'], 'instance method')
  92. | <em>or</em> as a generic method. If calling as generic, pass the instance in as the first argument.
  93. else if obj.bound && !~obj.bound.indexOf('#')
  94. p.note.functionalized
  95. | This method can be called <em>either</em> as an instance method <em>or</em> as a
  96. != link(obj.bound, ['link-short'], 'generic method')
  97. |. If calling as generic, pass the instance in as the first argument.
  98. if obj.arguments && obj.arguments.length
  99. h4 Arguments
  100. != argumentTable(obj.arguments, ["argument-list", "table", "table-striped", "table-bordered"])
  101. if obj.returns && obj.returns.length
  102. h4 Returns
  103. != returnTable(obj.returns, ["return-list", "table", "table-striped", "table-bordered"])
  104. //- children
  105. for child in obj.children.filter(function(x){return x.type === 'section'})
  106. mixin article(child, parents.concat(obj))
  107. for child in obj.children.filter(function(x){return x.type === 'utility'})
  108. mixin article(child, parents.concat(obj))
  109. for child in obj.children.filter(function(x){return x.type === 'constructor'})
  110. - if (!constructorSection)
  111. - constructorSection = true
  112. h3.sectionHeader Constructors
  113. mixin article(child, parents.concat(obj))
  114. for child in obj.children.filter(function(x){return x.type === 'event'})
  115. - if (!eventSection)
  116. - eventSection = true
  117. h3.sectionHeader Events
  118. mixin article(child, parents.concat(obj), 'event')
  119. for child in obj.children.filter(function(x){return x.type === 'class method'})
  120. - if (!methodSection)
  121. - methodSection = true
  122. h3.sectionHeader Methods
  123. mixin article(child, parents.concat(obj))
  124. for child in obj.children.filter(function(x){return x.type === 'class property'})
  125. - if (!propertySection)
  126. - propertySection = true
  127. h3.sectionHeader Properties
  128. mixin article(child, parents.concat(obj))
  129. for child in obj.children.filter(function(x){return x.type === 'instance method'})
  130. mixin article(child, parents.concat(obj))
  131. for child in obj.children.filter(function(x){return x.type === 'instance property'})
  132. mixin article(child, parents.concat(obj))
  133. for child in obj.children.filter(function(x){return x.type === 'constant'})
  134. mixin article(child, parents.concat(obj))
  135. mixin api()
  136. -pos = 0
  137. for obj in tree.children
  138. -if (obj.subclasses.length == 0)
  139. mixin render_starting_tabs(obj, pos)
  140. -else
  141. mixin render_starting_tabs(obj, pos)
  142. for child in obj.children.filter(function(x){return x.type === 'namespace' || x.type === 'class' || x.type === 'mixin'})
  143. -pos++
  144. mixin render_starting_tabs(child, pos)
  145. mixin render_starting_tabs(obj, pos)
  146. .classContent
  147. .membersBackground
  148. div(class=' members pos#{pos}')
  149. div(class=' membersContent pos#{pos}')
  150. h1.memberHeader
  151. -var heading = obj.path
  152. span.name #{heading}
  153. -if (true || obj.filename.indexOf("index") < 0)
  154. ul(class='nav tabs pos#{pos}', data-tabs='tabs')
  155. for selector, title in {'Events': ['event', 'events'], 'Constructors': ['constructor', 'constructors'], 'Class methods': ['class method', 'class_methods'], 'Class properties': ['class property', 'class_properties'], 'Instance methods': ['instance method', 'instance_methods'], 'Instance properties': ['instance property', 'instance_properties'], 'Constants': ['constant', 'constants']}
  156. members = obj.children.filter(function(x){return x.type === selector[0]})
  157. li(class="dropdown", data-dropdown="dropdown")
  158. if members.length
  159. a(href="\#", class="dropdown-toggle", data-toggle="dropdown")
  160. != renameMemberTitle(title, members.length)
  161. b.caret
  162. ul.dropdown-menu
  163. for m in members
  164. if (m.private !== true && m.name.charAt(0) !== "$")
  165. li(id='dropdown_#{m.path}', data-id='#{m.path}', class='memberLink')
  166. mixin link(m, [], true)
  167. -methodSection = constructorSection = propertySection = eventSection = false;
  168. mixin article(obj, [])
  169. mixin short_description_list(collection)
  170. ul.method-details-list
  171. for obj in collection
  172. if typeof obj === 'string'
  173. obj = list[obj]
  174. li.method-description
  175. h4
  176. mixin link(obj)
  177. if obj.short_description
  178. mixin markdown(obj.short_description)
  179. mixin link(obj, classes, short)
  180. l = link(obj, classes, short)
  181. != l
  182. mixin links(collection)
  183. ul.method-list
  184. for obj in collection
  185. li
  186. mixin link(obj)