478
|
1 |
Object subclass:#HTMLDocGenerator
|
|
2 |
instanceVariableNames:''
|
|
3 |
classVariableNames:''
|
|
4 |
poolDictionaries:''
|
|
5 |
category:'System-Documentation'
|
|
6 |
!
|
|
7 |
|
498
|
8 |
!HTMLDocGenerator class methodsFor:'documentation'!
|
478
|
9 |
|
|
10 |
documentation
|
|
11 |
"
|
|
12 |
helper class to generate HTML docuemntation
|
|
13 |
for classes - see DocViewers Class Documentation.
|
|
14 |
|
|
15 |
[author:]
|
|
16 |
Claus Gittinger
|
|
17 |
"
|
|
18 |
! !
|
|
19 |
|
498
|
20 |
!HTMLDocGenerator class methodsFor:'document generation'!
|
478
|
21 |
|
|
22 |
htmlClassCategoryList
|
492
|
23 |
|categories s prefixList prefix prefixStack prev|
|
478
|
24 |
|
|
25 |
categories := Set new.
|
|
26 |
|
|
27 |
Smalltalk allClasses do:[:cls |
|
498
|
28 |
cls isPrivate ifFalse:[
|
|
29 |
categories add:cls category
|
|
30 |
]
|
478
|
31 |
].
|
|
32 |
|
|
33 |
categories := categories asOrderedCollection sort.
|
|
34 |
|
|
35 |
s := '' writeStream.
|
|
36 |
|
|
37 |
s nextPutAll:'
|
|
38 |
<html>
|
|
39 |
<head>
|
|
40 |
<title>
|
|
41 |
Class categories:
|
|
42 |
</title>
|
|
43 |
</head>
|
|
44 |
<body>
|
|
45 |
<a NOPRINT HREF="TOP.html"> <IMG SRC="../icons/DocsUpArrow.gif" ALT="back"></A>
|
|
46 |
|
|
47 |
<hr>
|
|
48 |
<h1>Class categories:</h1>
|
|
49 |
|
|
50 |
<ul>
|
|
51 |
'.
|
|
52 |
|
|
53 |
prefixList := Set new.
|
|
54 |
|
|
55 |
categories keysAndValuesDo:[:index :element |
|
|
56 |
|prev common|
|
|
57 |
|
|
58 |
index ~~ 1 ifTrue:[
|
|
59 |
prev := categories at:(index - 1).
|
|
60 |
common := (Array with:prev with:element) longestCommonPrefix.
|
|
61 |
(common endsWith:'-') ifTrue:[
|
|
62 |
prefixList add:(common copyWithoutLast:1)
|
|
63 |
] ifFalse:[
|
|
64 |
common = prev ifTrue:[
|
|
65 |
prefixList add:common
|
|
66 |
]
|
|
67 |
]
|
|
68 |
]
|
|
69 |
].
|
|
70 |
|
|
71 |
prefix := ''. prefixStack := OrderedCollection new.
|
|
72 |
prev := ''.
|
|
73 |
|
|
74 |
categories := categories select:[:nm | nm ~= 'obsolete'].
|
|
75 |
|
|
76 |
categories do:[:nm |
|
|
77 |
|longest|
|
|
78 |
|
|
79 |
"/ longest prefix ....
|
|
80 |
longest := prefixList inject:'' into:[:maxPrefix :prefix |
|
|
81 |
nm = prefix ifTrue:[
|
|
82 |
maxPrefix
|
|
83 |
] ifFalse:[
|
|
84 |
(nm startsWith:prefix)
|
|
85 |
ifTrue:[
|
|
86 |
prefix size > maxPrefix size
|
|
87 |
ifTrue:[
|
|
88 |
prefix
|
|
89 |
] ifFalse:[
|
|
90 |
maxPrefix
|
|
91 |
]
|
|
92 |
] ifFalse:[
|
|
93 |
maxPrefix
|
|
94 |
]
|
|
95 |
]
|
|
96 |
].
|
|
97 |
|
|
98 |
longest size > 0 ifTrue:[
|
|
99 |
longest = prefix ifTrue:[
|
|
100 |
"/ no change
|
|
101 |
] ifFalse:[
|
|
102 |
(longest startsWith:prefix) ifTrue:[
|
|
103 |
prefixStack addLast:longest.
|
|
104 |
longest ~= prev ifTrue:[
|
|
105 |
prefixStack size == 1 ifTrue:[
|
|
106 |
s nextPutAll:'<p>';cr.
|
|
107 |
].
|
|
108 |
s nextPutAll:'<li>' , longest ;cr.
|
|
109 |
].
|
|
110 |
s nextPutAll:'<ul>'; cr.
|
|
111 |
prefix := longest.
|
|
112 |
] ifFalse:[
|
|
113 |
s nextPutAll:'</ul>';cr.
|
|
114 |
prefixStack removeLast.
|
|
115 |
|
|
116 |
[prefixStack notEmpty
|
|
117 |
and:[(longest startsWith:prefixStack last) not]] whileTrue:[
|
|
118 |
s nextPutAll:'</ul>';cr.
|
|
119 |
prefixStack removeLast.
|
|
120 |
].
|
|
121 |
|
|
122 |
prefixStack notEmpty ifTrue:[
|
|
123 |
prefix := prefixStack last.
|
|
124 |
] ifFalse:[
|
|
125 |
prefixStack addLast:longest.
|
|
126 |
prefix := longest.
|
|
127 |
longest ~= prev ifTrue:[
|
|
128 |
prefixStack size == 1 ifTrue:[
|
|
129 |
s nextPutAll:'<p>';cr.
|
|
130 |
].
|
|
131 |
s nextPutAll:'<li>' , longest ;cr.
|
|
132 |
].
|
|
133 |
s nextPutAll:'<ul>'; cr.
|
|
134 |
]
|
|
135 |
].
|
|
136 |
]
|
|
137 |
] ifFalse:[
|
|
138 |
[prefixStack size > 0] whileTrue:[
|
|
139 |
s nextPutAll:'</ul>';cr.
|
|
140 |
prefixStack removeLast.
|
|
141 |
].
|
|
142 |
prefixStack size == 0 ifTrue:[
|
|
143 |
s nextPutAll:'<p>';cr.
|
|
144 |
].
|
|
145 |
prefix := ''.
|
|
146 |
].
|
|
147 |
|
|
148 |
s nextPutAll:'<li><a href="../misc/onlyInSTX2.html" action="html:'
|
|
149 |
, self name
|
|
150 |
, ' htmlClassesListOfCategory:''' , nm
|
|
151 |
, ''' backTo:''htmlClassCategoryList''">'
|
|
152 |
"/ full name:
|
|
153 |
"/ , nm ,'</a>';cr.
|
|
154 |
|
|
155 |
"/ cut off prefix:
|
|
156 |
, (nm copyFrom:prefix size + 1) ,'</a>';cr.
|
|
157 |
prev := nm.
|
|
158 |
].
|
|
159 |
|
|
160 |
s nextPutAll:'
|
|
161 |
</ul>
|
|
162 |
|
|
163 |
</body>
|
|
164 |
</html>
|
|
165 |
'.
|
|
166 |
|
|
167 |
^ s contents
|
|
168 |
|
|
169 |
"
|
|
170 |
HTMLDocGenerator htmlClassCategoryList
|
|
171 |
"
|
|
172 |
|
|
173 |
"Created: 22.4.1996 / 20:03:30 / cg"
|
498
|
174 |
"Modified: 15.10.1996 / 19:52:31 / cg"
|
478
|
175 |
!
|
|
176 |
|
|
177 |
htmlClassListPrefix:prefix
|
|
178 |
|classes|
|
|
179 |
|
|
180 |
classes := Smalltalk allClasses
|
498
|
181 |
select:[:cls |
|
|
182 |
cls isPrivate not
|
|
183 |
and:[cls name startsWith:prefix]
|
|
184 |
].
|
478
|
185 |
|
498
|
186 |
^ self
|
|
187 |
htmlClasses:classes
|
|
188 |
title:('Classes starting with ''' , prefix asString , ''':').
|
478
|
189 |
|
|
190 |
"Created: 22.4.1996 / 20:03:31 / cg"
|
498
|
191 |
"Modified: 15.10.1996 / 19:53:03 / cg"
|
478
|
192 |
!
|
|
193 |
|
|
194 |
htmlClasses:classes title:title
|
|
195 |
^ self
|
|
196 |
htmlClasses:classes
|
|
197 |
title:title
|
|
198 |
backTo:nil
|
|
199 |
|
|
200 |
"Modified: 23.4.1996 / 15:32:10 / cg"
|
|
201 |
!
|
|
202 |
|
|
203 |
htmlClasses:classes title:title backTo:backRef
|
|
204 |
|classNames s|
|
|
205 |
|
|
206 |
classNames := (classes collect:[:cls | cls name]) asOrderedCollection sort.
|
|
207 |
|
|
208 |
s := '' writeStream.
|
|
209 |
|
|
210 |
|
|
211 |
s nextPutAll:'
|
|
212 |
<html>
|
|
213 |
<head>
|
|
214 |
<title>
|
|
215 |
'.
|
|
216 |
s nextPutAll:title.
|
|
217 |
s nextPutAll:'
|
|
218 |
</title>
|
|
219 |
</head>
|
|
220 |
<body>
|
|
221 |
'.
|
|
222 |
backRef notNil ifTrue:[
|
|
223 |
backRef == #none ifFalse:[
|
|
224 |
s nextPutAll:'<a NOPRINT HREF="TOP.html" action="html:' , self name , ' ' , backRef , '"> <IMG SRC="../icons/DocsUpArrow.gif" ALT="back"></A>'.
|
|
225 |
]
|
|
226 |
] ifFalse:[
|
|
227 |
s nextPutAll:'<a NOPRINT HREF="TOP.html"> <IMG SRC="../icons/DocsUpArrow.gif" ALT="back"></A>'.
|
|
228 |
].
|
|
229 |
backRef ~~ #none ifTrue:[
|
|
230 |
s nextPutAll:'<hr>
|
|
231 |
'.
|
|
232 |
].
|
|
233 |
|
|
234 |
s nextPutAll:'
|
|
235 |
<h1>
|
|
236 |
'.
|
|
237 |
s nextPutAll:title; cr.
|
|
238 |
s nextPutAll:'
|
|
239 |
</h1>
|
|
240 |
<ul>
|
|
241 |
'.
|
|
242 |
|
|
243 |
classNames do:[:nm |
|
|
244 |
s nextPutAll:'<li><a href="../misc/onlyInSTX2.html" action="html:' , self name ,' htmlDocOf:' , nm , '">' , nm , '</A>';cr
|
|
245 |
].
|
|
246 |
|
|
247 |
s nextPutAll:'
|
|
248 |
</ul>
|
|
249 |
</body>
|
|
250 |
</html>
|
|
251 |
'.
|
|
252 |
|
|
253 |
^ s contents
|
|
254 |
|
|
255 |
"Created: 23.4.1996 / 15:31:55 / cg"
|
|
256 |
"Modified: 7.9.1996 / 20:00:10 / cg"
|
|
257 |
!
|
|
258 |
|
|
259 |
htmlClassesListOfCategory:category
|
|
260 |
|classes|
|
|
261 |
|
|
262 |
classes := Smalltalk allClasses
|
498
|
263 |
select:[:cls | cls isPrivate not
|
|
264 |
and:[cls category = category]].
|
478
|
265 |
|
|
266 |
^ self
|
|
267 |
htmlClasses:classes
|
|
268 |
title:('Classes in: ' , category)
|
|
269 |
backTo:nil
|
|
270 |
|
|
271 |
"Created: 22.4.1996 / 20:03:31 / cg"
|
498
|
272 |
"Modified: 15.10.1996 / 19:53:25 / cg"
|
478
|
273 |
!
|
|
274 |
|
|
275 |
htmlClassesListOfCategory:category backTo:backRef
|
|
276 |
|classes|
|
|
277 |
|
|
278 |
classes := Smalltalk allClasses
|
498
|
279 |
select:[:cls | cls isPrivate not
|
|
280 |
and:[cls category = category]].
|
478
|
281 |
|
|
282 |
^ self
|
|
283 |
htmlClasses:classes title:('Classes in: ' , category)
|
|
284 |
backTo:backRef
|
|
285 |
|
|
286 |
"Created: 23.4.1996 / 15:39:39 / cg"
|
498
|
287 |
"Modified: 15.10.1996 / 19:53:37 / cg"
|
478
|
288 |
!
|
|
289 |
|
|
290 |
htmlDocOf:aClass
|
|
291 |
^ self htmlDocOf:aClass back:nil backRef:nil
|
|
292 |
|
|
293 |
"
|
|
294 |
self htmlDocOf:PostscriptPrinterStream
|
|
295 |
"
|
|
296 |
|
|
297 |
"Modified: 24.4.1996 / 15:03:06 / cg"
|
|
298 |
!
|
|
299 |
|
|
300 |
htmlDocOf:aClass back:backCmd
|
|
301 |
^ self htmlDocOf:aClass back:backCmd backRef:nil
|
|
302 |
|
|
303 |
"Modified: 24.4.1996 / 15:03:30 / cg"
|
|
304 |
!
|
|
305 |
|
|
306 |
htmlDocOf:aClass back:backCmd backRef:backRef
|
|
307 |
|supers s indent m docu examples firstIndent firstNonEmpty
|
|
308 |
collectionOfCategories collectionOfClassCategories
|
492
|
309 |
revInfo pckgInfo subs refLines demoLines
|
478
|
310 |
backHRef authorLines first wasLoaded didLoadBin|
|
|
311 |
|
|
312 |
(wasLoaded := aClass isLoaded) ifFalse:[
|
|
313 |
"/ load it - but not a binary
|
|
314 |
didLoadBin := Smalltalk loadBinaries.
|
|
315 |
Smalltalk loadBinaries:false.
|
|
316 |
aClass autoload.
|
|
317 |
didLoadBin ifTrue:[Smalltalk loadBinaries:true].
|
|
318 |
].
|
|
319 |
|
|
320 |
"/
|
|
321 |
"/ extract documentation or comment, if there is any
|
|
322 |
"/
|
|
323 |
m := aClass class compiledMethodAt:#documentation.
|
|
324 |
m notNil ifTrue:[
|
|
325 |
docu := m comment.
|
|
326 |
] ifFalse:[
|
|
327 |
"try comment"
|
|
328 |
docu := aClass comment.
|
|
329 |
].
|
|
330 |
docu notNil ifTrue:[
|
|
331 |
docu isEmpty ifTrue:[
|
|
332 |
docu := nil
|
|
333 |
].
|
|
334 |
].
|
|
335 |
docu notNil ifTrue:[
|
|
336 |
docu := (docu copy
|
|
337 |
replChar:$< withString:'<')
|
|
338 |
replChar:$> withString:'>'.
|
|
339 |
|
|
340 |
docu := docu asStringCollection.
|
|
341 |
|
|
342 |
"/
|
|
343 |
"/ search for a [see also:] line
|
|
344 |
"/
|
|
345 |
refLines := self extractSpecial:'[see also:]' from:docu.
|
|
346 |
|
|
347 |
"/
|
|
348 |
"/ search for a [start with:] line
|
|
349 |
"/
|
|
350 |
demoLines := self extractSpecial:'[start with:]' from:docu.
|
|
351 |
|
|
352 |
"/
|
|
353 |
"/ search for a [author:] line
|
|
354 |
"/
|
|
355 |
authorLines := self extractSpecial:'[author:]' from:docu.
|
|
356 |
|
|
357 |
"/
|
|
358 |
"/ strip off empty lines
|
|
359 |
"/
|
|
360 |
[(docu at:1) size == 0] whileTrue:[
|
|
361 |
docu removeIndex:1
|
|
362 |
].
|
|
363 |
[(docu at:docu size) size == 0] whileTrue:[
|
|
364 |
docu removeIndex:(docu size)
|
|
365 |
].
|
|
366 |
|
|
367 |
docu notEmpty ifTrue:[
|
|
368 |
firstIndent := docu first leftIndent.
|
|
369 |
firstIndent > 0 ifTrue:[
|
|
370 |
docu := docu collect:[:line |
|
|
371 |
line leftIndent >= firstIndent ifTrue:[
|
|
372 |
line copyFrom:firstIndent.
|
|
373 |
] ifFalse:[
|
|
374 |
line
|
|
375 |
]
|
|
376 |
].
|
|
377 |
].
|
|
378 |
firstNonEmpty := docu findFirst:[:line | line notEmpty].
|
|
379 |
firstNonEmpty > 1 ifTrue:[
|
|
380 |
docu := docu copyFrom:firstNonEmpty
|
|
381 |
]
|
|
382 |
].
|
|
383 |
docu := docu asString.
|
|
384 |
].
|
|
385 |
|
|
386 |
refLines notNil ifTrue:[
|
|
387 |
refLines := refLines collect:[:l |
|
|
388 |
|t|
|
|
389 |
|
|
390 |
((t := l withoutSeparators) startsWith:'(') ifTrue:[
|
|
391 |
t
|
|
392 |
] ifFalse:[
|
|
393 |
l asCollectionOfWords
|
|
394 |
]
|
|
395 |
].
|
|
396 |
].
|
|
397 |
|
|
398 |
"/
|
|
399 |
"/ extract examples if there are any
|
|
400 |
"/
|
|
401 |
m := aClass class compiledMethodAt:#examples.
|
|
402 |
m notNil ifTrue:[
|
|
403 |
examples := m comment.
|
|
404 |
examples notNil ifTrue:[
|
|
405 |
examples isEmpty ifTrue:[
|
|
406 |
examples := nil
|
|
407 |
].
|
|
408 |
].
|
|
409 |
examples notNil ifTrue:[
|
|
410 |
examples := (examples copy
|
|
411 |
replChar:$< withString:'<')
|
|
412 |
replChar:$> withString:'>'.
|
|
413 |
|
|
414 |
examples := examples asStringCollection.
|
|
415 |
|
|
416 |
"/
|
|
417 |
"/ strip off empty lines
|
|
418 |
"/
|
|
419 |
[examples first size == 0] whileTrue:[
|
|
420 |
examples removeIndex:1
|
|
421 |
].
|
|
422 |
[examples last size == 0] whileTrue:[
|
|
423 |
examples removeIndex:(examples size)
|
|
424 |
].
|
|
425 |
|
|
426 |
examples notEmpty ifTrue:[
|
|
427 |
firstIndent := examples first withTabsExpanded leftIndent.
|
|
428 |
firstIndent > 0 ifTrue:[
|
|
429 |
examples := examples collect:[:line |
|
|
430 |
|l|
|
|
431 |
|
|
432 |
l := line withTabsExpanded.
|
|
433 |
l leftIndent >= firstIndent ifTrue:[
|
|
434 |
l copyFrom:firstIndent.
|
|
435 |
] ifFalse:[
|
|
436 |
l
|
|
437 |
]
|
|
438 |
].
|
|
439 |
].
|
|
440 |
firstNonEmpty := examples findFirst:[:line | line notEmpty].
|
|
441 |
firstNonEmpty > 1 ifTrue:[
|
|
442 |
examples := examples copyFrom:firstNonEmpty
|
|
443 |
]
|
|
444 |
].
|
|
445 |
]
|
|
446 |
].
|
|
447 |
|
|
448 |
collectionOfClassCategories := aClass class categories.
|
|
449 |
collectionOfClassCategories size > 0 ifTrue:[
|
|
450 |
collectionOfClassCategories := collectionOfClassCategories asOrderedCollection.
|
|
451 |
collectionOfClassCategories remove:'documentation' ifAbsent:nil.
|
|
452 |
].
|
|
453 |
collectionOfCategories := aClass categories.
|
|
454 |
collectionOfCategories size > 0 ifTrue:[
|
|
455 |
collectionOfCategories := collectionOfCategories asOrderedCollection.
|
|
456 |
].
|
|
457 |
|
|
458 |
(aClass == Autoload or:[aClass == Object]) ifTrue:[
|
|
459 |
subs := #()
|
|
460 |
] ifFalse:[
|
|
461 |
subs := aClass subclasses
|
|
462 |
asOrderedCollection sort:[:a :b | a name < b name].
|
|
463 |
].
|
|
464 |
|
|
465 |
s := '' writeStream.
|
|
466 |
|
492
|
467 |
s nextPutAll:'<html><head><title>'; cr.
|
478
|
468 |
s nextPutAll:'Class: '; nextPutAll:(aClass name); cr.
|
492
|
469 |
s nextPutAll:'</title></head><body>'; cr.
|
478
|
470 |
|
|
471 |
backRef isNil ifTrue:[
|
|
472 |
backHRef := 'TOP.html'
|
|
473 |
] ifFalse:[
|
|
474 |
backHRef := backRef
|
|
475 |
].
|
|
476 |
backCmd notNil ifTrue:[
|
|
477 |
s nextPutAll:'<a NOPRINT HREF="' , backHRef , '" action="html:' , self name , ' ' , backCmd , '"> <IMG SRC="../icons/DocsUpArrow.gif" ALT="back"></A>'.
|
|
478 |
s nextPutAll:'<hr>'; cr.
|
|
479 |
] ifFalse:[
|
|
480 |
backHRef ~~ #none ifTrue:[
|
|
481 |
s nextPutAll:'<a NOPRINT HREF="' , backHRef , '"> <IMG SRC="../icons/DocsUpArrow.gif" ALT="back"></A>';cr.
|
|
482 |
s nextPutAll:'<hr>'; cr.
|
|
483 |
]
|
|
484 |
].
|
|
485 |
|
|
486 |
s nextPutAll:'<h1>'; cr.
|
|
487 |
s nextPutAll:'Class: ';
|
|
488 |
nextPutAll:'<a type="example" action="SystemBrowser openInClass:' , aClass name , '">';
|
|
489 |
nextPutAll:(aClass name); nextPutAll:'</a>'; cr.
|
|
490 |
s nextPutAll:'</h1>'; cr.
|
|
491 |
|
|
492 |
"/
|
|
493 |
"/ index
|
|
494 |
"/
|
|
495 |
"/ s nextPutAll:'Index:'; cr.
|
|
496 |
s nextPutAll:'<ul>'; cr.
|
|
497 |
s nextPutAll:'<li><a href="#INHERITANCE" name="I_INHERITANCE">Inheritance</a>'; cr.
|
|
498 |
docu notNil ifTrue:[
|
|
499 |
s nextPutAll:'<li><a href="#DESCRIPTION" name="I_DESCRIPTION">Description</a>'; cr.
|
|
500 |
].
|
|
501 |
|
|
502 |
refLines notNil ifTrue:[
|
|
503 |
s nextPutAll:'<li><a href="#SEEALSO" name="I_SEEALSO">Related information</a>'; cr.
|
|
504 |
].
|
|
505 |
|
|
506 |
"/ s nextPutAll:'<li><a href="#INSTANCEVARIABLES" name="I_INSTANCEVARIABLES">Instance variables</a>'; cr.
|
|
507 |
"/ s nextPutAll:'<li><a href="#CLASSVARIABLES" name="I_CLASSVARIABLES">Class variables</a>'; cr.
|
|
508 |
|
|
509 |
collectionOfClassCategories size > 0 ifTrue:[
|
|
510 |
s nextPutAll:'<li><a href="#CLASSPROTOCOL" name="I_CLASSPROTOCOL">Class protocol</a>'; cr.
|
|
511 |
s nextPutAll:'<ul>'; cr.
|
|
512 |
collectionOfClassCategories sort do:[:cat |
|
|
513 |
s nextPutAll:'<li><a name="I_' , aClass class name , '_category_' , cat , '"' ,
|
|
514 |
' href="#' , aClass class name , '_category_' , cat ,
|
|
515 |
'">' , cat , '</a> '; cr.
|
|
516 |
].
|
|
517 |
s nextPutAll:'</ul>'; cr.
|
|
518 |
].
|
|
519 |
collectionOfCategories size > 0 ifTrue:[
|
|
520 |
s nextPutAll:'<li><a href="#INSTANCEPROTOCOL" name="I_INSTANCEPROTOCOL">Instance protocol</a>'; cr.
|
|
521 |
s nextPutAll:'<ul>'; cr.
|
|
522 |
collectionOfCategories sort do:[:cat |
|
|
523 |
s nextPutAll:'<li><a name="I_' , aClass name , '_category_' , cat , '"' ,
|
|
524 |
' href="#' , aClass name , '_category_' , cat ,
|
|
525 |
'">' , cat , '</a> '; cr.
|
|
526 |
].
|
|
527 |
s nextPutAll:'</ul>'; cr.
|
|
528 |
].
|
|
529 |
|
|
530 |
(aClass == Object or:[aClass == Autoload]) ifTrue:[
|
|
531 |
s nextPutAll:'<li><a href="#SUBCLASSES" name="I_SUBCLASSES">Subclasses</a>'; cr.
|
|
532 |
].
|
|
533 |
demoLines notNil ifTrue:[
|
|
534 |
s nextPutAll:'<li><a href="#DEMOSTARTUP" name="I_DEMOSTARTUP">Demonstration</a>'; cr.
|
|
535 |
].
|
|
536 |
examples notNil ifTrue:[
|
|
537 |
s nextPutAll:'<li><a href="#EXAMPLES" name="I_EXAMPLES">Examples</a>'; cr.
|
|
538 |
].
|
|
539 |
s nextPutAll:'</ul>'; cr.
|
|
540 |
s nextPutAll:'<hr>'; cr.
|
|
541 |
|
|
542 |
|
|
543 |
"/
|
|
544 |
"/ hierarchy
|
|
545 |
"/
|
|
546 |
s nextPutAll:'<h2><a name="INHERITANCE" href="#I_INHERITANCE">Inheritance:</A></h2>'; cr.
|
|
547 |
s nextPutAll:'<pre>'; cr.
|
|
548 |
indent := 3.
|
|
549 |
first := true.
|
|
550 |
supers := aClass allSuperclasses.
|
|
551 |
(supers notNil) ifTrue:[
|
|
552 |
supers reverse do:[:cls |
|
|
553 |
|nm|
|
|
554 |
|
|
555 |
nm := cls name.
|
|
556 |
first ifFalse:[
|
|
557 |
s spaces:indent; nextPutAll:'|'; cr.
|
|
558 |
s spaces:indent; nextPutAll:'+--'.
|
|
559 |
indent := indent + 3.
|
|
560 |
] ifTrue:[
|
|
561 |
s spaces:indent
|
|
562 |
].
|
|
563 |
first := false.
|
|
564 |
|
|
565 |
s nextPutAll:'<a href="../misc/onlyInSTX2.html" action="html:' , self name , ' htmlDocOf:' , nm , '">' , nm , '</A>';cr.
|
|
566 |
].
|
|
567 |
s spaces:indent; nextPutAll:'|'; cr.
|
|
568 |
s spaces:indent.
|
|
569 |
s nextPutAll:'+--<B>'; nextPutAll:aClass name; nextPutAll:'</B>'; cr.
|
|
570 |
indent := indent + 3.
|
|
571 |
] ifFalse:[
|
|
572 |
s spaces:indent; nextPutAll:'nil'; cr.
|
|
573 |
s spaces:indent; nextPutAll:'|'; cr.
|
|
574 |
s spaces:indent; nextPutAll:'+--<B>'; nextPutAll:aClass name; nextPutAll:'</B>'; cr.
|
|
575 |
aClass ~~ Object ifTrue:[
|
|
576 |
s cr.
|
|
577 |
s nextPutAll:' <B>This class inherits NOTHING - most messages will lead into doesNotUnderstand:</B>'; cr
|
|
578 |
].
|
|
579 |
indent := indent + 3.
|
|
580 |
].
|
|
581 |
|
|
582 |
subs notEmpty ifTrue:[
|
|
583 |
subs do:[:aSubclass |
|
|
584 |
|nm|
|
|
585 |
|
|
586 |
nm := aSubclass name.
|
|
587 |
s spaces:indent; nextPutAll:'|'; cr.
|
|
588 |
s spaces:indent; nextPutAll:'+--'.
|
|
589 |
s nextPutAll:'<a href="../misc/onlyInSTX2.html" action="html:' , self name , ' htmlDocOf:' , nm , '">' , nm , '</A>';cr.
|
|
590 |
]
|
|
591 |
] ifFalse:[
|
|
592 |
aClass == Object ifTrue:[
|
|
593 |
s spaces:indent; nextPutAll:'|'; cr.
|
|
594 |
s spaces:indent; nextPutAll:'+-- ... almost every other class ...'; cr
|
|
595 |
]
|
|
596 |
].
|
|
597 |
|
|
598 |
|
|
599 |
s nextPutAll:'</pre>'; cr.
|
|
600 |
s nextPutAll:'<hr>'; cr.
|
|
601 |
|
|
602 |
"/
|
|
603 |
"/ category, version & package
|
|
604 |
"/
|
|
605 |
s nextPutAll:'<dl>'; cr.
|
|
606 |
s nextPutAll:'<dt><a name="CATEGORY"><b>Category:</b></A>'; cr.
|
|
607 |
s nextPutAll:'<dd><b>', aClass category , '</b>'; cr.
|
|
608 |
s nextPutAll:'</dl>'; cr.
|
|
609 |
|
|
610 |
revInfo := aClass revisionInfo.
|
|
611 |
pckgInfo := aClass packageSourceCodeInfo.
|
|
612 |
|
|
613 |
s nextPutAll:'<dl>'; cr.
|
|
614 |
s nextPutAll:'<dt><a name="VERSION"><b>Version:</b></A>'; cr.
|
|
615 |
|
|
616 |
(revInfo isNil and:[pckgInfo isNil]) ifTrue:[
|
|
617 |
s nextPutAll:'<dd>no revision info'; cr.
|
|
618 |
] ifFalse:[
|
|
619 |
revInfo isNil ifTrue:[revInfo := IdentityDictionary new].
|
|
620 |
pckgInfo isNil ifTrue:[pckgInfo := IdentityDictionary new].
|
|
621 |
|
|
622 |
s nextPutAll:'<dd>rev: <b>'; cr.
|
|
623 |
s nextPutAll:(revInfo at:#revision ifAbsent:'?'); cr.
|
|
624 |
s nextPutAll:'</b> date: <b>' , (revInfo at:#date ifAbsent:'')
|
|
625 |
, ' ', (revInfo at:#time ifAbsent:'') , '</b>'; cr.
|
|
626 |
s nextPutAll:'<dd>user: <b>' , (revInfo at:#user ifAbsent:'?') , '</b>';cr.
|
|
627 |
s nextPutAll:'<dd>file: <b>' , (revInfo at:#fileName ifAbsent:'?').
|
|
628 |
s nextPutAll:'</b> directory: <b>' , (pckgInfo at:#directory ifAbsent:'?') , '</b>'; cr.
|
|
629 |
|
|
630 |
s nextPutAll:'<dd>module: <b>' , (pckgInfo at:#module ifAbsent:'?')
|
|
631 |
, '</b> classLibrary: <b>' , (pckgInfo at:#library ifAbsent:'?') , '</b>';cr.
|
|
632 |
|
|
633 |
].
|
|
634 |
s nextPutAll:'</dl>'; cr.
|
|
635 |
|
|
636 |
authorLines notNil ifTrue:[
|
|
637 |
s nextPutAll:'<dl>'; cr.
|
|
638 |
s nextPutAll:'<dt><a name="AUTHOR"><b>Author:</b></A>'; cr.
|
|
639 |
authorLines do:[:l|
|
|
640 |
s nextPutAll:'<dd><b>', l , '</b>'; cr.
|
|
641 |
].
|
|
642 |
s nextPutAll:'</dl>'; cr.
|
|
643 |
].
|
|
644 |
|
|
645 |
s nextPutAll:'<hr>'; cr.
|
|
646 |
|
|
647 |
docu notNil ifTrue:[
|
|
648 |
s nextPutAll:'<h2><a name="DESCRIPTION" href="#I_DESCRIPTION">Description:</A></h2>'; cr.
|
|
649 |
s nextPutAll:'<BR>'; cr.
|
|
650 |
|
|
651 |
s nextPutAll:'<pre>'; cr.
|
|
652 |
s nextPutAll:docu;cr.
|
|
653 |
s nextPutAll:'</pre>'; cr.
|
|
654 |
s nextPutAll:'<hr>'; cr.
|
|
655 |
].
|
|
656 |
|
|
657 |
"/
|
|
658 |
"/ see also
|
|
659 |
"/
|
|
660 |
refLines notNil ifTrue:[
|
|
661 |
s nextPutAll:'<h2><a name="SEEALSO" href="#I_SEEALSO">Related information:</A></h2>'; cr.
|
|
662 |
s nextPutAll:'<pre>'; cr.
|
|
663 |
refLines do:[:l |
|
|
664 |
|nm href|
|
|
665 |
|
|
666 |
s nextPutAll:' '.
|
|
667 |
|
|
668 |
l isString ifTrue:[
|
|
669 |
nm := (l copyFrom:2 to:(l indexOf:$:)-1) withoutSpaces.
|
|
670 |
href := (l copyFrom:(l indexOf:$:)+1 to:(l size - 1)) withoutSpaces.
|
|
671 |
(href startsWith:'man:') ifTrue:[
|
|
672 |
href := (href copyFrom:5) withoutSpaces.
|
|
673 |
s nextPutAll:'<a href="../misc/onlyInSTX2.html" action="html:' , self name , ' manPageFor:''' , href , '''">[<I>' , nm , '</I>]</A>'.
|
|
674 |
] ifFalse:[
|
|
675 |
(href startsWith:'html:') ifTrue:[
|
|
676 |
href := (href copyFrom:6) withoutSpaces.
|
|
677 |
].
|
|
678 |
s nextPutAll:'<a href="../' , href , '">[<I>' , nm , '</I>]</a>'.
|
|
679 |
]
|
|
680 |
] ifFalse:[
|
|
681 |
l do:[:ref |
|
|
682 |
s nextPutAll:'<a href="../misc/onlyInSTX2.html" action="html:' , self name , ' htmlDocOf:' , ref , '">' , ref , '</A>'.
|
|
683 |
s nextPutAll:' '.
|
|
684 |
].
|
|
685 |
].
|
|
686 |
s cr.
|
|
687 |
].
|
|
688 |
s nextPutAll:'</pre>'; cr.
|
|
689 |
s nextPutAll:'<hr>'; cr.
|
|
690 |
].
|
|
691 |
|
|
692 |
|
|
693 |
"/
|
|
694 |
"/ inst & classVars
|
|
695 |
"/ to be added
|
|
696 |
|
|
697 |
|
|
698 |
"/
|
|
699 |
"/ protocol
|
|
700 |
"/
|
|
701 |
self printOutHTMLProtocolOf:aClass on:s.
|
|
702 |
|
|
703 |
"/
|
|
704 |
"/ subclasses (only for Object and Autoload)
|
|
705 |
"/
|
|
706 |
(aClass == Object or:[aClass == Autoload]) ifTrue:[
|
|
707 |
subs := aClass subclasses
|
|
708 |
asOrderedCollection sort:[:a :b | a name < b name].
|
|
709 |
|
|
710 |
s nextPutAll:'<h2><a name="SUBCLASSES" href="#I_SUBCLASSES">Subclasses (direct subclasses only):</A></h2>'; cr.
|
|
711 |
s nextPutAll:'<pre>'; cr.
|
|
712 |
subs do:[:cls |
|
|
713 |
|nm|
|
|
714 |
|
|
715 |
nm := cls name.
|
|
716 |
s nextPutAll:' '.
|
|
717 |
cls isLoaded ifFalse:[
|
|
718 |
s nextPutAll:'<a href="../misc/onlyInSTX2.html" action="html:' , nm , ' autoload. ',self name,' htmlDocOf:' , nm, '">' , nm , '</A>';cr
|
|
719 |
] ifTrue:[
|
|
720 |
s nextPutAll:'<a href="../misc/onlyInSTX2.html" action="html:',self name,' htmlDocOf:' , nm , '">' , nm , '</A>';cr
|
|
721 |
].
|
|
722 |
].
|
|
723 |
s nextPutAll:'</pre>'; cr.
|
|
724 |
s nextPutAll:'<hr>'; cr.
|
|
725 |
].
|
|
726 |
|
|
727 |
"/
|
|
728 |
"/ demonstration
|
|
729 |
"/
|
|
730 |
demoLines notNil ifTrue:[
|
|
731 |
s nextPutAll:'<h2><a name="DEMOSTARTUP" href="#I_DEMOSTARTUP">Demonstration:</A></h2>'; cr.
|
|
732 |
demoLines do:[:l |
|
|
733 |
s nextPutAll:'<a type="example">'; cr.
|
|
734 |
s nextPutAll:'<code><pre>'; cr.
|
|
735 |
s nextPutAll:' ' , l withoutSeparators; cr.
|
|
736 |
s nextPutAll:'</pre></code>'; cr.
|
|
737 |
s nextPutAll:'</a>'; cr.
|
|
738 |
s nextPutAll:'<br>'; cr.
|
|
739 |
].
|
|
740 |
s nextPutAll:'<hr>'; cr.
|
|
741 |
].
|
|
742 |
|
|
743 |
"/
|
|
744 |
"/ add examples if there are any
|
|
745 |
"/
|
|
746 |
examples notNil ifTrue:[
|
|
747 |
s nextPutAll:'<h2><a name="EXAMPLES" href="#I_EXAMPLES">Examples:</A></h2>'; cr.
|
|
748 |
s nextPutAll:'<BR>'; cr.
|
|
749 |
s nextPutAll:'<code><pre>'; cr.
|
|
750 |
examples do:[:line |
|
|
751 |
line withoutSeparators = '[exBegin]' ifTrue:[
|
|
752 |
s nextPutAll:'<a type="example">'; cr.
|
|
753 |
] ifFalse:[
|
|
754 |
line withoutSeparators = '[exEnd]' ifTrue:[
|
|
755 |
s nextPutAll:'</a>'; cr.
|
|
756 |
] ifFalse:[
|
|
757 |
s nextPutAll:line; cr
|
|
758 |
]
|
|
759 |
].
|
|
760 |
].
|
|
761 |
s nextPutAll:'</pre></code>'; cr.
|
|
762 |
s nextPutAll:'<hr>'; cr.
|
|
763 |
].
|
|
764 |
|
|
765 |
|
|
766 |
s nextPutAll:'</body>'; cr.
|
|
767 |
s nextPutAll:'</html>'; cr.
|
|
768 |
|
|
769 |
wasLoaded ifFalse:[
|
|
770 |
aClass unload
|
|
771 |
].
|
|
772 |
|
|
773 |
^ s contents
|
|
774 |
|
|
775 |
"
|
|
776 |
self htmlDocOf:Object
|
|
777 |
self htmlDocOf:Array
|
|
778 |
self htmlDocOf:Filename
|
|
779 |
self htmlDocOf:Block
|
|
780 |
"
|
|
781 |
|
|
782 |
"Created: 24.4.1996 / 15:01:59 / cg"
|
|
783 |
"Modified: 12.9.1996 / 08:05:38 / cg"
|
|
784 |
!
|
|
785 |
|
|
786 |
htmlDocOf:aClass backRef:backRef
|
|
787 |
^ self htmlDocOf:aClass back:nil backRef:backRef
|
|
788 |
|
|
789 |
"Modified: 24.4.1996 / 15:02:52 / cg"
|
|
790 |
"Created: 24.4.1996 / 15:03:25 / cg"
|
|
791 |
!
|
|
792 |
|
|
793 |
htmlDocOfImplementorsOf:selector
|
492
|
794 |
|sel s|
|
478
|
795 |
|
|
796 |
sel := (selector copy
|
|
797 |
replChar:$< withString:'<')
|
|
798 |
replChar:$> withString:'>'.
|
|
799 |
|
|
800 |
s := '' writeStream.
|
|
801 |
|
492
|
802 |
s nextPutAll:'<html><head><title>'; cr.
|
478
|
803 |
s nextPutAll:sel; cr.
|
492
|
804 |
s nextPutAll:'</title></head>'; cr.
|
478
|
805 |
|
|
806 |
s nextPutAll:'<body>'; cr.
|
|
807 |
s nextPutAll:'<a NOPRINT HREF="TOP.html"> <IMG SRC="../icons/DocsUpArrow.gif" ALT="back"></A>';cr.
|
|
808 |
s nextPutAll:'<hr>'; cr.
|
|
809 |
s nextPutAll:'<h1>'; cr.
|
|
810 |
s nextPutAll:sel ; cr.
|
|
811 |
s nextPutAll:'</h1>'; cr.
|
|
812 |
|
|
813 |
s nextPutAll:'<dl>'; cr.
|
|
814 |
|
|
815 |
sel := selector asSymbol.
|
|
816 |
Smalltalk allClassesDo:[:cls |
|
|
817 |
(cls implements:sel) ifTrue:[
|
|
818 |
self printOutHTMLMethodProtocol:(cls compiledMethodAt:sel)
|
|
819 |
on:s showClassName:true classRef:true.
|
|
820 |
s nextPutAll:'<p>'; cr.
|
|
821 |
]
|
|
822 |
].
|
|
823 |
|
|
824 |
s nextPutAll:'</dl>'; cr.
|
|
825 |
|
492
|
826 |
s nextPutAll:'</body></html>'; cr.
|
478
|
827 |
|
|
828 |
^ s contents
|
|
829 |
|
|
830 |
"Created: 22.4.1996 / 20:03:31 / cg"
|
|
831 |
"Modified: 7.9.1996 / 20:00:31 / cg"
|
|
832 |
!
|
|
833 |
|
|
834 |
htmlSelectorList
|
|
835 |
|selectors|
|
|
836 |
|
|
837 |
selectors := IdentitySet new.
|
|
838 |
Smalltalk allClassesDo:[:cls |
|
|
839 |
selectors addAll:cls methodDictionary keys.
|
|
840 |
].
|
|
841 |
selectors := selectors asOrderedCollection sort.
|
|
842 |
|
|
843 |
^ self htmlSelectors:selectors title:('All selectors:').
|
|
844 |
|
|
845 |
"
|
|
846 |
self htmlSelectorList
|
|
847 |
"
|
|
848 |
|
|
849 |
"Modified: 22.4.1996 / 12:48:45 / cg"
|
|
850 |
"Created: 22.4.1996 / 20:03:31 / cg"
|
|
851 |
"Modified: 5.6.1996 / 12:27:09 / stefan"
|
|
852 |
!
|
|
853 |
|
|
854 |
htmlSelectorListMatching:pattern
|
|
855 |
|selectors|
|
|
856 |
|
|
857 |
selectors := IdentitySet new.
|
|
858 |
Smalltalk allClassesDo:[:cls |
|
|
859 |
cls methodDictionary keysDo:[:sel |
|
|
860 |
(pattern match:sel) ifTrue:[
|
|
861 |
selectors add:sel.
|
|
862 |
]
|
|
863 |
]
|
|
864 |
].
|
|
865 |
selectors := selectors asOrderedCollection sort.
|
|
866 |
|
|
867 |
^ self htmlSelectors:selectors title:('Selectors matching ''' , pattern , ''':').
|
|
868 |
|
|
869 |
"
|
|
870 |
self htmlSelectorListMatching:'*do*'
|
|
871 |
"
|
|
872 |
|
|
873 |
"Modified: 22.4.1996 / 17:11:56 / cg"
|
|
874 |
"Created: 22.4.1996 / 20:03:31 / cg"
|
|
875 |
"Modified: 5.6.1996 / 12:29:27 / stefan"
|
|
876 |
!
|
|
877 |
|
|
878 |
htmlSelectorListPrefix:prefix
|
|
879 |
|selectors|
|
|
880 |
|
|
881 |
selectors := IdentitySet new.
|
|
882 |
Smalltalk allClassesDo:[:cls |
|
|
883 |
cls methodDictionary keysDo:[:sel |
|
|
884 |
(sel startsWith:prefix) ifTrue:[
|
|
885 |
selectors add:sel.
|
|
886 |
]
|
|
887 |
]
|
|
888 |
].
|
|
889 |
selectors := selectors asOrderedCollection sort.
|
|
890 |
|
|
891 |
^ self htmlSelectors:selectors title:('Selectors starting with ''' , prefix asString , ''':').
|
|
892 |
|
|
893 |
"
|
|
894 |
self htmlSelectorListPrefix:'a'
|
|
895 |
"
|
|
896 |
|
|
897 |
"Modified: 22.4.1996 / 19:57:50 / cg"
|
|
898 |
"Created: 22.4.1996 / 20:03:31 / cg"
|
|
899 |
"Modified: 5.6.1996 / 12:31:13 / stefan"
|
|
900 |
!
|
|
901 |
|
|
902 |
htmlSelectors:selectors title:title
|
492
|
903 |
|s|
|
478
|
904 |
|
|
905 |
s := '' writeStream.
|
|
906 |
|
492
|
907 |
s nextPutAll:'<html><head><title>'; cr.
|
478
|
908 |
s nextPutAll:title; cr.
|
492
|
909 |
s nextPutAll:'</title></head>'; cr.
|
478
|
910 |
|
|
911 |
s nextPutAll:'<body>'; cr.
|
|
912 |
s nextPutAll:'<a NOPRINT HREF="TOP.html"> <IMG SRC="../icons/DocsUpArrow.gif" ALT="back"></A>';cr.
|
|
913 |
s nextPutAll:'<hr>'; cr.
|
|
914 |
s nextPutAll:'<h1>'; cr.
|
|
915 |
s nextPutAll:title; cr.
|
|
916 |
s nextPutAll:'</h1>'; cr.
|
|
917 |
|
|
918 |
s nextPutAll:'<ul>'; cr.
|
|
919 |
|
|
920 |
selectors do:[:sel |
|
|
921 |
|nm|
|
|
922 |
|
|
923 |
nm := (sel copy replChar:$< withString:'<')
|
|
924 |
replChar:$> withString:'>'.
|
|
925 |
s nextPutAll:'<li><a href="../misc/onlyInSTX2.html" action="html:',self name,' htmlDocOfImplementorsOf:''' , nm , '''">' , nm , '</A>';cr
|
|
926 |
].
|
|
927 |
|
|
928 |
s nextPutAll:'</ul>'; cr.
|
|
929 |
|
492
|
930 |
s nextPutAll:'</body></html>'; cr.
|
478
|
931 |
|
|
932 |
^ s contents
|
|
933 |
|
|
934 |
"Created: 22.4.1996 / 20:03:31 / cg"
|
|
935 |
"Modified: 7.9.1996 / 20:00:34 / cg"
|
|
936 |
!
|
|
937 |
|
|
938 |
manPageFor:aCommand
|
|
939 |
"q&d hack to convert man output to html"
|
|
940 |
|
|
941 |
^ self
|
|
942 |
manPageFor:aCommand
|
|
943 |
inSection:nil
|
|
944 |
|
|
945 |
"Modified: 9.9.1996 / 17:45:29 / cg"
|
|
946 |
!
|
|
947 |
|
|
948 |
manPageFor:aCommand inSection:sectionOrNil
|
|
949 |
"q&d hack to convert man output to html"
|
|
950 |
|
|
951 |
|manCmd|
|
|
952 |
|
|
953 |
sectionOrNil isNil ifTrue:[
|
|
954 |
manCmd := 'man ' , aCommand
|
|
955 |
] ifFalse:[
|
|
956 |
manCmd := 'man ' , sectionOrNil printString , ' ' , aCommand
|
|
957 |
].
|
|
958 |
^ self
|
|
959 |
manPageFor:aCommand
|
|
960 |
manCommand:manCmd.
|
|
961 |
|
|
962 |
"Created: 9.9.1996 / 17:45:08 / cg"
|
|
963 |
"Modified: 9.9.1996 / 17:48:29 / cg"
|
|
964 |
!
|
|
965 |
|
|
966 |
manPageFor:aCommand manCommand:manCommand
|
|
967 |
"q&d hack to convert man output to html"
|
|
968 |
|
|
969 |
|s t outStream state ch keep|
|
|
970 |
|
|
971 |
s := PipeStream readingFrom:manCommand.
|
|
972 |
s notNil ifTrue:[
|
|
973 |
outStream := '' writeStream.
|
|
974 |
state := nil.
|
|
975 |
keep := nil.
|
|
976 |
[s atEnd] whileFalse:[
|
|
977 |
ch := s next.
|
|
978 |
|
|
979 |
ch notNil ifTrue:[
|
|
980 |
state == nil ifTrue:[
|
|
981 |
ch == Character backspace ifTrue:[
|
|
982 |
state := #back
|
|
983 |
] ifFalse:[
|
|
984 |
keep notNil ifTrue:[
|
|
985 |
keep == $< ifTrue:[
|
|
986 |
outStream nextPutAll:'<'.
|
|
987 |
] ifFalse:[
|
|
988 |
outStream nextPut:keep.
|
|
989 |
].
|
|
990 |
].
|
|
991 |
keep := ch
|
|
992 |
]
|
|
993 |
] ifFalse:[
|
|
994 |
state == #back ifTrue:[
|
|
995 |
ch == keep ifTrue:[
|
|
996 |
outStream nextPutAll:'<b>'.
|
|
997 |
ch == $< ifTrue:[
|
|
998 |
outStream nextPutAll:'<'.
|
|
999 |
] ifFalse:[
|
|
1000 |
outStream nextPut:ch.
|
|
1001 |
].
|
|
1002 |
outStream nextPutAll:'</b>'.
|
|
1003 |
state := nil.
|
|
1004 |
keep := nil.
|
|
1005 |
] ifFalse:[
|
|
1006 |
ch == $_ ifTrue:[
|
|
1007 |
keep notNil ifTrue:[
|
|
1008 |
outStream nextPutAll:'<i>'.
|
|
1009 |
keep == $< ifTrue:[
|
|
1010 |
outStream nextPutAll:'<'.
|
|
1011 |
] ifFalse:[
|
|
1012 |
outStream nextPut:keep.
|
|
1013 |
].
|
|
1014 |
outStream nextPutAll:'</i>'.
|
|
1015 |
].
|
|
1016 |
state := nil.
|
|
1017 |
keep := nil.
|
|
1018 |
] ifFalse:[
|
|
1019 |
keep == $_ ifTrue:[
|
|
1020 |
outStream nextPutAll:'<i>'.
|
|
1021 |
ch == $< ifTrue:[
|
|
1022 |
outStream nextPutAll:'<'.
|
|
1023 |
] ifFalse:[
|
|
1024 |
outStream nextPut:ch.
|
|
1025 |
].
|
|
1026 |
outStream nextPutAll:'</i>'.
|
|
1027 |
state := nil.
|
|
1028 |
keep := nil.
|
|
1029 |
] ifFalse:[
|
|
1030 |
keep notNil ifTrue:[
|
|
1031 |
keep == $< ifTrue:[
|
|
1032 |
outStream nextPutAll:'<'.
|
|
1033 |
] ifFalse:[
|
|
1034 |
outStream nextPut:keep.
|
|
1035 |
].
|
|
1036 |
ch == $< ifTrue:[
|
|
1037 |
outStream nextPutAll:'<'.
|
|
1038 |
] ifFalse:[
|
|
1039 |
outStream nextPut:ch.
|
|
1040 |
]
|
|
1041 |
].
|
|
1042 |
state := nil.
|
|
1043 |
keep := nil.
|
|
1044 |
]
|
|
1045 |
]
|
|
1046 |
]
|
|
1047 |
]
|
|
1048 |
]
|
|
1049 |
]
|
|
1050 |
].
|
|
1051 |
|
|
1052 |
keep notNil ifTrue:[
|
|
1053 |
keep == $< ifTrue:[
|
|
1054 |
outStream nextPutAll:'<'.
|
|
1055 |
] ifFalse:[
|
|
1056 |
outStream nextPut:keep
|
|
1057 |
]
|
|
1058 |
].
|
|
1059 |
t := outStream contents.
|
|
1060 |
s shutDown.
|
|
1061 |
].
|
|
1062 |
|
|
1063 |
(t isNil or:[t isEmpty]) ifTrue:[
|
|
1064 |
^ '
|
|
1065 |
No manual page for "<CODE><B>' , aCommand , '</B></CODE>" available.
|
|
1066 |
<BR>
|
|
1067 |
(the failed command was: "<CODE>' , manCommand , '"</CODE>.)
|
|
1068 |
'.
|
|
1069 |
].
|
|
1070 |
|
|
1071 |
^ '
|
|
1072 |
<pre>
|
|
1073 |
' , t , '
|
|
1074 |
</pre>
|
|
1075 |
'
|
|
1076 |
|
|
1077 |
"
|
|
1078 |
self manPageFor:'cvs'
|
|
1079 |
"
|
|
1080 |
|
|
1081 |
"Modified: 28.6.1996 / 21:28:47 / stefan"
|
|
1082 |
"Created: 9.9.1996 / 17:43:16 / cg"
|
|
1083 |
"Modified: 9.9.1996 / 17:58:00 / cg"
|
|
1084 |
!
|
|
1085 |
|
|
1086 |
printOutHTMLCategoryProtocol:aCategory of:aClass on:aStream
|
|
1087 |
|any dict selectors methods|
|
|
1088 |
|
|
1089 |
dict := aClass methodDictionary.
|
|
1090 |
|
|
1091 |
dict notNil ifTrue:[
|
|
1092 |
any := false.
|
|
1093 |
dict do:[:aMethod |
|
|
1094 |
(aCategory = aMethod category) ifTrue:[
|
|
1095 |
any := true
|
|
1096 |
]
|
|
1097 |
].
|
|
1098 |
|
|
1099 |
any ifTrue:[
|
|
1100 |
aStream nextPutAll:'<a name="' , aClass name , '_category_' , aCategory ,
|
|
1101 |
'" href="#I_' , aClass name , '_category_' , aCategory ,
|
|
1102 |
'"><b>' , aCategory , '</b></A>'; cr.
|
|
1103 |
aStream nextPutAll:'<dl>'; cr.
|
|
1104 |
|
|
1105 |
selectors := dict keys asArray.
|
|
1106 |
methods := dict values.
|
|
1107 |
selectors sortWith:methods.
|
|
1108 |
methods do:[:aMethod |
|
|
1109 |
(aCategory = aMethod category) ifTrue:[
|
|
1110 |
ErrorSignal catch:[
|
|
1111 |
self printOutHTMLMethodProtocol:aMethod on:aStream.
|
|
1112 |
].
|
|
1113 |
aStream nextPutAll:'<p>'; cr.
|
|
1114 |
]
|
|
1115 |
].
|
|
1116 |
aStream nextPutAll:'</dl>'; cr.
|
|
1117 |
]
|
|
1118 |
]
|
|
1119 |
|
|
1120 |
"
|
|
1121 |
self printOutHTMLProtocolOf:Float on:Stdout
|
|
1122 |
"
|
|
1123 |
|
|
1124 |
"Created: 22.4.1996 / 20:03:30 / cg"
|
|
1125 |
"Modified: 30.4.1996 / 15:14:20 / cg"
|
|
1126 |
"Modified: 5.6.1996 / 13:41:27 / stefan"
|
|
1127 |
!
|
|
1128 |
|
|
1129 |
printOutHTMLMethodProtocol:aMethod on:aStream
|
|
1130 |
"given the source in aString, print the methods message specification
|
|
1131 |
and any method comments - without source; used to generate documentation
|
|
1132 |
pages"
|
|
1133 |
|
|
1134 |
^ self printOutHTMLMethodProtocol:aMethod on:aStream showClassName:false classRef:false
|
|
1135 |
|
|
1136 |
"Modified: 22.4.1996 / 18:01:56 / cg"
|
|
1137 |
"Created: 22.4.1996 / 20:03:30 / cg"
|
|
1138 |
!
|
|
1139 |
|
|
1140 |
printOutHTMLMethodProtocol:aMethod on:aStream showClassName:showClassName classRef:withClassRef
|
|
1141 |
"given the source in aString, print the methods message specification
|
|
1142 |
and any method comments - without source; used to generate documentation
|
|
1143 |
pages"
|
|
1144 |
|
492
|
1145 |
|comment cls sel partStream args argStream who methodSpecLine first
|
478
|
1146 |
firstIndent firstNonEmpty isSubres isObsolete smallOrEmpty
|
|
1147 |
ballColor|
|
|
1148 |
|
|
1149 |
who := aMethod who.
|
|
1150 |
cls := who at:1.
|
|
1151 |
sel := who at:2.
|
|
1152 |
partStream := sel keywords readStream.
|
|
1153 |
|
|
1154 |
(args := aMethod methodArgNames) notNil ifTrue:[
|
|
1155 |
argStream := aMethod methodArgNames readStream.
|
|
1156 |
|
|
1157 |
methodSpecLine := ''. first := true.
|
|
1158 |
1 to:sel numArgs do:[:index |
|
|
1159 |
first ifTrue:[
|
|
1160 |
first := false.
|
|
1161 |
] ifFalse:[
|
|
1162 |
methodSpecLine := methodSpecLine , ' '
|
|
1163 |
].
|
|
1164 |
methodSpecLine := methodSpecLine , '<B>' , partStream next , '</B>'.
|
|
1165 |
methodSpecLine := methodSpecLine , ' <I>' , argStream next , '</I>'.
|
|
1166 |
].
|
|
1167 |
] ifFalse:[
|
|
1168 |
methodSpecLine := '<B>' , partStream next , '</B>'
|
|
1169 |
].
|
|
1170 |
|
|
1171 |
isSubres := (aMethod sends:#subclassResponsibility).
|
|
1172 |
|
|
1173 |
isObsolete := false.
|
|
1174 |
((aMethod sends:#obsoleteMethodWarning)
|
|
1175 |
or:[(aMethod sends:#obsoleteMethodWarning:)
|
|
1176 |
or:[(aMethod sends:#obsoleteMethodWarning:from:)]]) ifTrue:[
|
|
1177 |
cls ~~ Object ifTrue:[
|
|
1178 |
isObsolete := true
|
|
1179 |
]
|
|
1180 |
].
|
|
1181 |
|
|
1182 |
smallOrEmpty := ''.
|
|
1183 |
aMethod isPrivate ifTrue:[
|
|
1184 |
methodSpecLine := '<i>private</I> ' , methodSpecLine.
|
|
1185 |
"/ smallOrEmpty := '-small'.
|
|
1186 |
] ifFalse:[
|
|
1187 |
aMethod isProtected ifTrue:[
|
|
1188 |
methodSpecLine := '<i>protected</I> ' , methodSpecLine.
|
|
1189 |
"/ smallOrEmpty := '-small'.
|
|
1190 |
] ifFalse:[
|
|
1191 |
aMethod isIgnored ifTrue:[
|
|
1192 |
methodSpecLine := '[ ' , methodSpecLine , ' ] (<i>invisible</I>)'.
|
|
1193 |
"/ smallOrEmpty := '-small'.
|
|
1194 |
]
|
|
1195 |
]
|
|
1196 |
].
|
|
1197 |
|
|
1198 |
aStream nextPutAll:'<dt>'; cr.
|
|
1199 |
|
|
1200 |
|
|
1201 |
cls isMeta ifTrue:[
|
|
1202 |
ballColor := 'yellow'
|
|
1203 |
] ifFalse:[
|
|
1204 |
ballColor := 'red'
|
|
1205 |
].
|
|
1206 |
|
|
1207 |
aStream nextPutAll:'<img src="pictures/' , ballColor , '-ball' , smallOrEmpty , '.gif" width=6 height=6>'; cr.
|
|
1208 |
|
|
1209 |
sel := (sel copy
|
|
1210 |
replChar:$< withString:'<')
|
|
1211 |
replChar:$> withString:'>'.
|
|
1212 |
|
|
1213 |
withClassRef ifTrue:[
|
|
1214 |
aStream nextPutAll:'<a name="' , cls name , '_' , sel ,
|
|
1215 |
'" href="../misc/onlyInSTX2.html" action="html:',self name,' htmlDocOf:' , cls name ,
|
|
1216 |
'">' , cls name , '</a> ' , methodSpecLine; cr.
|
|
1217 |
] ifFalse:[
|
|
1218 |
showClassName ifTrue:[
|
|
1219 |
methodSpecLine := cls name , ' ' , methodSpecLine
|
|
1220 |
].
|
|
1221 |
|
|
1222 |
aStream nextPutAll:'<a name="' , cls name , '_' , sel ,
|
|
1223 |
"/ '" href="' , cls name , '_' , sel , '"' ,
|
|
1224 |
'>' , methodSpecLine , '</a>'; cr.
|
|
1225 |
].
|
|
1226 |
aStream nextPutAll:'<dd>';cr.
|
|
1227 |
|
|
1228 |
(comment := aMethod comment) notNil ifTrue:[
|
|
1229 |
comment := (comment copy
|
|
1230 |
replChar:$< withString:'<')
|
|
1231 |
replChar:$> withString:'>'.
|
|
1232 |
|
|
1233 |
comment notEmpty ifTrue:[
|
|
1234 |
comment := comment asStringCollection.
|
|
1235 |
firstIndent := comment first leftIndent.
|
|
1236 |
firstIndent > 0 ifTrue:[
|
|
1237 |
comment := comment collect:[:line |
|
|
1238 |
line leftIndent >= firstIndent ifTrue:[
|
|
1239 |
line copyFrom:firstIndent.
|
|
1240 |
] ifFalse:[
|
|
1241 |
line
|
|
1242 |
]
|
|
1243 |
].
|
|
1244 |
].
|
|
1245 |
firstNonEmpty := comment findFirst:[:line | line notEmpty].
|
|
1246 |
firstNonEmpty > 1 ifTrue:[
|
|
1247 |
comment := comment copyFrom:firstNonEmpty
|
|
1248 |
].
|
|
1249 |
comment := comment asString.
|
|
1250 |
].
|
|
1251 |
|
|
1252 |
comment asStringCollection do:[:line |
|
|
1253 |
aStream nextPutAll:line; nextPutAll:'<br>'; cr.
|
|
1254 |
].
|
|
1255 |
].
|
|
1256 |
|
|
1257 |
isSubres ifTrue:[
|
|
1258 |
aStream nextPutAll:'<BR>'; cr.
|
|
1259 |
aStream nextPutAll:'<I>** This method raises an error - it must be redefined in concrete classes **</I>'; cr.
|
|
1260 |
].
|
|
1261 |
isObsolete ifTrue:[
|
|
1262 |
aStream nextPutAll:'<BR>'; cr.
|
|
1263 |
aStream nextPutAll:'<I>** This is an obsolete interface - do not use it (it may vanish in future versions) **</I>'; cr.
|
|
1264 |
].
|
|
1265 |
|
|
1266 |
"Created: 22.4.1996 / 20:03:30 / cg"
|
|
1267 |
"Modified: 26.4.1996 / 18:27:13 / cg"
|
|
1268 |
!
|
|
1269 |
|
|
1270 |
printOutHTMLProtocolOf:aClass on:aStream
|
|
1271 |
|collectionOfCategories any|
|
|
1272 |
|
|
1273 |
"/ self printOutDefinitionOn:aPrintStream.
|
|
1274 |
|
|
1275 |
collectionOfCategories := aClass class categories.
|
|
1276 |
any := false.
|
|
1277 |
collectionOfCategories notNil ifTrue:[
|
|
1278 |
collectionOfCategories := collectionOfCategories asOrderedCollection sort.
|
|
1279 |
aStream nextPutAll:'<h2><a name="CLASSPROTOCOL" href="#I_CLASSPROTOCOL">Class protocol:</A></h2>'; cr.
|
|
1280 |
collectionOfCategories do:[:aCategory |
|
|
1281 |
aCategory ~= 'documentation' ifTrue:[
|
|
1282 |
self printOutHTMLCategoryProtocol:aCategory of:aClass class on:aStream.
|
|
1283 |
any := true.
|
|
1284 |
]
|
|
1285 |
].
|
|
1286 |
"/ any ifFalse:[
|
|
1287 |
"/ aStream nextPutAll:'no new protocol'
|
|
1288 |
"/ ].
|
|
1289 |
aStream nextPutAll:'<hr>'; cr.
|
|
1290 |
].
|
|
1291 |
|
|
1292 |
|
|
1293 |
collectionOfCategories := aClass categories.
|
|
1294 |
any := false.
|
|
1295 |
collectionOfCategories notNil ifTrue:[
|
|
1296 |
collectionOfCategories := collectionOfCategories asOrderedCollection sort.
|
|
1297 |
aStream nextPutAll:'<h2><a name="INSTANCEPROTOCOL" href="#I_INSTANCEPROTOCOL">Instance protocol:</A></h2>'; cr.
|
|
1298 |
collectionOfCategories do:[:aCategory |
|
|
1299 |
self printOutHTMLCategoryProtocol:aCategory of:aClass on:aStream
|
|
1300 |
].
|
|
1301 |
"/ any ifFalse:[
|
|
1302 |
"/ aStream nextPutAll:'no new protocol'
|
|
1303 |
"/ ].
|
|
1304 |
aStream nextPutAll:'<hr>'; cr.
|
|
1305 |
]
|
|
1306 |
|
|
1307 |
"
|
|
1308 |
self printOutHTMLProtocolOf:Float on:Stdout
|
|
1309 |
"
|
|
1310 |
|
|
1311 |
"Created: 22.4.1996 / 20:03:30 / cg"
|
|
1312 |
"Modified: 27.4.1996 / 15:05:19 / cg"
|
|
1313 |
! !
|
|
1314 |
|
498
|
1315 |
!HTMLDocGenerator class methodsFor:'helpers'!
|
478
|
1316 |
|
|
1317 |
extractSpecial:pattern from:docu
|
|
1318 |
"given a collection of docu lines (from documentation methods comment),
|
|
1319 |
extract things like [see also:], [author:] etc.
|
|
1320 |
If found, remove the lines from the string collection,
|
|
1321 |
and return the extracted ones. Otherwise return nil."
|
|
1322 |
|
|
1323 |
|srchIdx idx lines l|
|
|
1324 |
|
|
1325 |
srchIdx := docu findFirst:[:l | l asLowercase withoutSeparators = pattern].
|
|
1326 |
srchIdx ~~ 0 ifTrue:[
|
|
1327 |
lines := OrderedCollection new.
|
|
1328 |
|
|
1329 |
idx := srchIdx+1.
|
|
1330 |
[idx <= docu size] whileTrue:[
|
|
1331 |
l := docu at:idx.
|
|
1332 |
(l isNil or:[l withoutSeparators size == 0]) ifTrue:[
|
|
1333 |
idx := docu size + 1.
|
|
1334 |
] ifFalse:[
|
|
1335 |
lines add:l
|
|
1336 |
].
|
|
1337 |
idx := idx + 1.
|
|
1338 |
].
|
|
1339 |
|
|
1340 |
docu removeFromIndex:srchIdx toIndex:srchIdx+lines size
|
|
1341 |
].
|
|
1342 |
^ lines
|
|
1343 |
|
|
1344 |
"Created: 25.4.1996 / 14:16:01 / cg"
|
|
1345 |
"Modified: 27.4.1996 / 19:01:07 / cg"
|
|
1346 |
! !
|
|
1347 |
|
498
|
1348 |
!HTMLDocGenerator class methodsFor:'documentation'!
|
478
|
1349 |
|
|
1350 |
version
|
498
|
1351 |
^ '$Header: /cvs/stx/stx/libbasic3/HTMLDocGenerator.st,v 1.3 1996-10-15 18:55:44 cg Exp $'
|
478
|
1352 |
! !
|