-
Notifications
You must be signed in to change notification settings - Fork 17
/
documentation.html
280 lines (207 loc) · 7.13 KB
/
documentation.html
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PDoc</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="Tobie Langel">
<!-- Date: 2008-02-25 -->
<link rel="stylesheet" href="/stylesheets/reset.css" type="text/css" media="screen" charset="utf-8">
<link rel="stylesheet" href="/stylesheets/main.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<div id="wrapper">
<div id="header">
<h1><a href="/"><img src="/images/pdoc.jpg" alt="PDoc" /></a></h1>
</div>
<div id="navigation">
<ul>
<li><a href="/documentation.html">documentation</a></li>
<li><a href="http://github.com/tobie/pdoc/tree/master">source code</a></li>
<li><a href="http://prototype.lighthouseapp.com/projects/8889-pdoc/">bug tracker</a></li>
<li><a href="http://groups.google.com/group/pdoc">mailing list</a></li>
</ul>
</div>
<div id="content">
<h1 id="documentation">Documentation</h1>
<h2 id="comments">Comments</h2>
<p>Documentation comments start with <code>/**</code> and end with <code>**/</code>. Each new line starts with <code>*</code>. </p>
<pre><code>/** ...
* ...
**/
</code></pre>
<h2 id="tags">Tags</h2>
<p>The first line of a comment is reserved for tags. Tags are separated by a comma followed by whitespace (“, “). They can be either a tag name or a key / value pair separated by a colon and a space (<code>:</code>).</p>
<p>Currently accepted tags are: <code>deprecated</code>, <code>section:</code>, <code>alias of:</code>, <code>related to:</code></p>
<pre><code>/** deprecated, section: dom, alias of: Element#descendantOf
* Element#childOf(@element, className) -> Element
* ...
**/
</code></pre>
<h2 id="ebnf">EBNF</h2>
<p>The lines directly following tags are reserved for the EBNF description of the documented object. Typically, there’s only one EBNF per documented object. However, some objects might require more than one.</p>
<pre><code>/**
* Element#down(@element[, cssSelector][, index]) -> Element | null
* ...
**/
/**
* Element#writeAttribute(@element, attribute[, value = true]) -> Element
* Element#writeAttribute(@element, attributes) -> Element
* ...
**/
</code></pre>
<h3 id="arguments">Arguments</h3>
<p>For all methods, functions, etc. parentheses around the arguments are required even if no arguments are present.
The syntax for arguments is as follows:</p>
<h4 id="required_arguments">required arguments</h4>
<pre><code>/**
* Event.stop(event) -> Event
* ...
**/
</code></pre>
<h4 id="optional_arguments">optional arguments</h4>
<p>Optional arguments are surrounded by squared brackets (<code>[]</code>).</p>
<pre><code>/**
* String#evalJSON([sanitize]) -> Object | Array
* ...
**/
</code></pre>
<p>A default value may be indicated using the equal sign (<code>=</code>).</p>
<pre><code>/**
* String#evalJSON([sanitize = false]) -> Object | Array
* ...
**/
</code></pre>
<p>Note that the argument separating comas belong <em>inside</em> the brackets.</p>
<pre><code>/**
* Event.findElement(event[, cssSelector]) -> Element | null
* ...
**/
</code></pre>
<p>Arguments can be described below the EBNF description using the following syntax:</p>
<pre><code>- argumentName (acceptedTypes...): description.
</code></pre>
<p>For example (notice the 4 space indent in the last line): </p>
<pre><code>/**
* Event.findElement(event[, cssSelector]) -> Element | null
* - event (Event): a native Event instance
* - cssSelector (String): a optional CSS selector which uses
* the same syntax found in regular CSS.
**/
</code></pre>
<h3 id="supported_ebnf_types">Supported EBNF types</h3>
<h4 id="namespace">Namespace</h4>
<pre><code>/**
* Ajax
* ...
**/
/**
* Prototype.Browser
* ...
**/
</code></pre>
<h4 id="classes">Classes</h4>
<p>Classes require a <code>class</code> prefix:</p>
<pre><code>/**
* class Ajax.Base
* ...
**/
</code></pre>
<p>Sub-classes can indicate their parent just like in the Ruby syntax:</p>
<pre><code>/**
* class Ajax.Request < Ajax.Base
* ...
**/
</code></pre>
<p>Where <code>Ajax.Base</code> is the parent class and <code>Ajax.Request</code> the subclass.</p>
<p>Included mixins are indicated like so:</p>
<pre><code>/**
* class CustomHash
* includes Enumerable, Comparable
**/
</code></pre>
<h4 id="mixins">Mixins</h4>
<p>Mixins are indicated by a <code>mixin</code> prefix:</p>
<pre><code>/**
* mixin Enumerable
* ...
**/
</code></pre>
<h4 id="constructors">Constructors</h4>
<p>Constructors require the <code>new</code> prefix and their arguments.</p>
<pre><code>/**
* new Element(tagName[, attributes])
* ...
**/
/**
* new Foobar()
* ...
**/
</code></pre>
<h4 id="klass_methods">Klass Methods</h4>
<p>Klass methods are identified by a dot (<code>.</code>).</p>
<pre><code>/**
* Array.from([iterable]) -> Array
* ...
**/
</code></pre>
<h4 id="instance_methods">Instance Methods</h4>
<p>Instance methods are identified by the hash symbol (<code>#</code>).</p>
<pre><code>/**
* Array#first() -> Array element
* ...
**/
</code></pre>
<h4 id="utilities">Utilities</h4>
<p>Utilities are global functions starting with a dollar-sign (<code>$</code>).</p>
<pre><code>/**
* $w(string) -> Array
* ...
**/
</code></pre>
<h4 id="methodized_methods">Methodized Methods</h4>
<p>Methodized methods are methods which are both available as a class method and an instance method, in which case the first argument becomes the instance object itself. For example, all of <code>Element</code>’s instance methods are methodized and thus also available as class methods of <code>Element</code>. Methodized methods are indicated by prefixing their first argument with the <code>@</code> symbol.</p>
<pre><code>/**
* Element#hide(@element) -> Element
* ...
**/
</code></pre>
<h4 id="klass_properties">Klass Properties</h4>
<p>Klass properties are identified by a dot (<code>.</code>).</p>
<pre><code>/**
* Ajax.Responders.responders -> Array
* ...
**/
</code></pre>
<h4 id="instance_properties">Instance Properties</h4>
<p>Instance properties are identified by the hash symbol (<code>#</code>).</p>
<pre><code>/**
* Ajax.Response#responseText -> String
* ...
**/
</code></pre>
<h4 id="constants">Constants</h4>
<p>Constant must have their value specified using the equal sign (<code>=</code>).</p>
<pre><code>/**
* Prototype.JSONFilter = /^\/\*-secure-([\s\S]*)\*\/\s*$/
* ...
**/
</code></pre>
<h3 id="events">Events</h3>
<p>Some methods can fire native or custom events. These are indicated below the arguments descriptions:</p>
<pre><code>/**
* Ajax.Request#respondToReadyState(readyState) -> undefined
* - readyState (Number): a number from 0 to 4 corresponding to the state of the request.
* fires ajax:created, ajax:completed
**/
</code></pre>
</div>
<div id="sidebar">
</div>
<div id="footer">
<p>© 2008 Tobie Langel. PDoc logo © 2008 Sam Stephenson.</p>
</div>
</div>
</body>
</html>