-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdocs.jade
223 lines (188 loc) · 7.7 KB
/
docs.jade
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
// Copyright 2014, Digium, Inc.
// All rights reserved.
//
// This source code is licensed under The MIT License found in the
// LICENSE file in the root directory of this source tree.
//
// For all details and documentation: https://www.respoke.io
- var subTitle = comments[0].ctx.file.input;
- var title = className;
- var publicComments = [];
- var publicEvents = [];
- var classComment = null;
doctype html
html
head
title=subTitle + " - " + title
link(rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css")
link(rel="stylesheet" href="https://highlightjs.org/static/styles/github.css")
link(href='https://fonts.googleapis.com/css?family=Open+Sans:400,600,700,300' rel='stylesheet' type='text/css')
style(type="text/css").
html, body {
font-family: 'Open Sans', sans-serif;
}
h1, h2, h3 {
color: #f76;
}
h4, h5 {
font-weight: 600;
}
a {
color: #57adff !important;
}
pre {
box-shadow: inset 1px 1px 2px #4a4a4a;
background: #f4f4f4;
border: none;
}
pre code {
background: #f4f4f4 !important;
}
code {
word-wrap: break-word;
}
.container {
max-width: 750px;
}
script(src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js")
script(src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js")
script(src="https://highlightjs.org/static/highlight.pack.js")
script.
hljs.initHighlightingOnLoad();
body
.container
//- h1= title
//- h2.help-block= subTitle
each comment in comments
if !comment.isPrivate && comment.ctx && ['method','property','function','declaration','event'].indexOf(comment.ctx.type) !== -1 && comment.ctx.name !== "className"
- comment.methodParams = [];
- comment.argumentArray = [];
- comment.eventPropertyArray = [];
each tag in comment.tags
if (tag.type === "param")
- var tagParamName = tag.name;//.replace('[','').replace(']','');
- comment.methodParams.push({ name: tagParamName, type: tag.types.join(', '), desc: tag.description.replace('- ','') });
- if (tagParamName.indexOf('.') === -1 && tagParamName.indexOf('[') === -1) comment.argumentArray.push(tagParamName);
else if (tag.type === "property")
- var tagParamName = tag.name.replace('[','').replace(']','');
- comment.eventPropertyArray.push({ name: tagParamName, type: tag.types[0], desc: tag.description.replace('- ','') });
else if (tag.type === "type")
- comment.type = tag.types.join('|');
else if ( (tag.type === "returns" || tag.type === "return") && tag.string)
- var returnStringArray = tag.string.split( /\{|\}/g );
- if (!returnStringArray[0]) returnStringArray.shift();
- comment.returns = returnStringArray[0];
else if (tag.type === "augments" && tag.otherClass)
- comment.augments = tag.otherClass
else if (tag.type === "auth")
- comment.auth = tag.string.split(', ')
- if (comment.ctx.name == className) classComment = comment;
- else if (comment.ctx.type === 'event') publicEvents.push(comment);
- else
- if (comment.ctx.receiver && comment.ctx.receiver.indexOf('.') !== -1)
- var commentPrefix = comment.ctx.receiver.split('.');
- commentPrefix.shift()
- comment.ctx.name = commentPrefix.join('.') + '.' + comment.ctx.name;
- publicComments.push(comment);
- publicComments.unshift(classComment);
//- Properties and methods
each comment, indx in publicComments
.comment(id=comment.ctx.name.replace('.','-'))
if (indx !== 0)
if (comment.ctx.type === "property")
//- the title of the method or prop
h4
code= comment.type
a.bold(href="#"+comment.ctx.name)= " " + className + "." + comment.ctx.name
else if (comment.ctx.type === "function")
h4
code= "function"
a.bold(href="#"+comment.ctx.name)= " " + className + "." + comment.ctx.name
else
h4: a(href="#"+comment.ctx.name)
span.bold= " " + className + "." + comment.ctx.name + "(" + comment.argumentArray.join(', ') + ")"
if (comment.returns)
p: strong returns
code= comment.returns || "undefined"
//- info about the method or prop
if (comment.augments)
p: strong extends
a(href="/js-library/" + comment.augments + ".html"): code= comment.augments
if (comment.fires && comment.fires.length)
p
strong fires
code= comment.fires.map(function(f){ return f.replace(className + '#','') }).join('|')
if (comment.auth)
p
each meth in comment.auth
span.label.label-default= meth
|
div!= comment.description.full
if (indx === 0)
br
h2 Constructor
h4: code new Respoke(options)
//- Arguments
if (comment.methodParams.length)
br
h5 Arguments
each param in comment.methodParams
.row.param
.col-sm-4: code= param.name
.col-sm-3: strong= param.type
.col-sm-5= param.desc
br.visible-xs
br
br
//- put a header at the end of the class declaration
if (indx === 0)
h2 Properties and Methods
br
//-
//- Uncomment for devving!!!
//-
//- a(href="javascript:void(0)" onclick="this.nextSibling.style.display = this.nextSibling.style.display == 'block' ? 'none' : 'block'") JSON
//- pre(style="display:none")
//- code=JSON.stringify(comment, null, 4)
//- Events
if (publicEvents.length)
br
br
h2 Events
p Listen for events on an instance of this class.
pre: code=className
| .on('event-name', function (arg) {
|
| });
br
each comment, indx in publicEvents
- var eventLinkId = "event-" + comment.ctx.name.replace('.','-').replace('#','-');
div(id=eventLinkId)
h3
code= comment.ctx.type
= " "
a.bold(href="#" + eventLinkId)= comment.ctx.name
div!= comment.description.full
if (comment.eventPropertyArray.length)
br
h4 Callback Arguments
.row.hidden-xs.param
.col-sm-4 Name
.col-sm-3 Type
.col-sm-5
each param in comment.eventPropertyArray
.row.param
.col-sm-4: code= param.name
.col-sm-3: strong= param.type
.col-sm-5= param.desc
br.visible-xs
br
br
//-
//-
//- Uncomment for devving!!!
//-
//-
//- a(href="javascript:void(0)" onclick="this.nextSibling.style.display = this.nextSibling.style.display == 'block' ? 'none' : 'block'") JSON
//- pre(style="display:none")
//- code=JSON.stringify(comment, null, 4)