author | Claus Gittinger <cg@exept.de> |
Thu, 18 Dec 1997 11:47:18 +0100 | |
changeset 637 | cf0dd8f6030d |
parent 632 | 41efc16a4119 |
child 642 | 077371c28483 |
permissions | -rw-r--r-- |
601 | 1 |
" |
2 |
COPYRIGHT (c) 1996 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
||
14 |
||
478 | 15 |
Object subclass:#HTMLDocGenerator |
16 |
instanceVariableNames:'' |
|
17 |
classVariableNames:'' |
|
18 |
poolDictionaries:'' |
|
19 |
category:'System-Documentation' |
|
20 |
! |
|
21 |
||
498 | 22 |
!HTMLDocGenerator class methodsFor:'documentation'! |
478 | 23 |
|
601 | 24 |
copyright |
25 |
" |
|
26 |
COPYRIGHT (c) 1996 by Claus Gittinger |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
||
37 |
||
38 |
! |
|
39 |
||
478 | 40 |
documentation |
41 |
" |
|
42 |
helper class to generate HTML docuemntation |
|
43 |
for classes - see DocViewers Class Documentation. |
|
44 |
||
45 |
[author:] |
|
46 |
Claus Gittinger |
|
47 |
" |
|
48 |
! ! |
|
49 |
||
498 | 50 |
!HTMLDocGenerator class methodsFor:'document generation'! |
478 | 51 |
|
52 |
htmlClassCategoryList |
|
632 | 53 |
"generate a formatted list of all available class categories as |
54 |
an HTML string. Each category will be a hyperlink to another |
|
55 |
autogenerated page, containing the classes per category. |
|
56 |
The generated page is supposed to be given to an HTML reader |
|
57 |
with home being set to ../doc/online/xxx/classDoc |
|
58 |
(i.e. the images are to be found one-up in the doc hierarchy)" |
|
59 |
||
492 | 60 |
|categories s prefixList prefix prefixStack prev| |
478 | 61 |
|
62 |
categories := Set new. |
|
63 |
||
64 |
Smalltalk allClasses do:[:cls | |
|
498 | 65 |
cls isPrivate ifFalse:[ |
528 | 66 |
(cls isNamespace not or:[cls == Smalltalk]) ifTrue:[ |
67 |
categories add:cls category |
|
68 |
] |
|
498 | 69 |
] |
478 | 70 |
]. |
71 |
||
72 |
categories := categories asOrderedCollection sort. |
|
73 |
||
74 |
s := '' writeStream. |
|
75 |
||
76 |
s nextPutAll:' |
|
77 |
<html> |
|
78 |
<head> |
|
79 |
<title> |
|
80 |
Class categories: |
|
81 |
</title> |
|
82 |
</head> |
|
83 |
<body> |
|
632 | 84 |
<a NOPRINT HREF="TOP.html"> <IMG SRC="../icons/DocsUpArrow.gif" ALT="[back]"></A> |
478 | 85 |
|
86 |
<hr> |
|
87 |
<h1>Class categories:</h1> |
|
88 |
||
89 |
<ul> |
|
90 |
'. |
|
91 |
||
92 |
prefixList := Set new. |
|
93 |
||
94 |
categories keysAndValuesDo:[:index :element | |
|
95 |
|prev common| |
|
96 |
||
97 |
index ~~ 1 ifTrue:[ |
|
98 |
prev := categories at:(index - 1). |
|
99 |
common := (Array with:prev with:element) longestCommonPrefix. |
|
100 |
(common endsWith:'-') ifTrue:[ |
|
101 |
prefixList add:(common copyWithoutLast:1) |
|
102 |
] ifFalse:[ |
|
553 | 103 |
(common includes:$-) ifTrue:[ |
104 |
prefixList add:(common copyTo:(common lastIndexOf:$-)-1). |
|
105 |
] ifFalse:[ |
|
106 |
common = prev ifTrue:[ |
|
107 |
prefixList add:common |
|
108 |
] |
|
478 | 109 |
] |
110 |
] |
|
111 |
] |
|
112 |
]. |
|
113 |
||
114 |
prefix := ''. prefixStack := OrderedCollection new. |
|
115 |
prev := ''. |
|
116 |
||
117 |
categories := categories select:[:nm | nm ~= 'obsolete']. |
|
118 |
||
119 |
categories do:[:nm | |
|
120 |
|longest| |
|
121 |
||
122 |
"/ longest prefix .... |
|
123 |
longest := prefixList inject:'' into:[:maxPrefix :prefix | |
|
124 |
nm = prefix ifTrue:[ |
|
125 |
maxPrefix |
|
126 |
] ifFalse:[ |
|
127 |
(nm startsWith:prefix) |
|
128 |
ifTrue:[ |
|
129 |
prefix size > maxPrefix size |
|
130 |
ifTrue:[ |
|
131 |
prefix |
|
132 |
] ifFalse:[ |
|
133 |
maxPrefix |
|
134 |
] |
|
135 |
] ifFalse:[ |
|
136 |
maxPrefix |
|
137 |
] |
|
138 |
] |
|
139 |
]. |
|
140 |
||
141 |
longest size > 0 ifTrue:[ |
|
142 |
longest = prefix ifTrue:[ |
|
143 |
"/ no change |
|
144 |
] ifFalse:[ |
|
145 |
(longest startsWith:prefix) ifTrue:[ |
|
146 |
prefixStack addLast:longest. |
|
147 |
longest ~= prev ifTrue:[ |
|
148 |
prefixStack size == 1 ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
149 |
s nextPutLine:'<p>'. |
478 | 150 |
]. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
151 |
s nextPutLine:'<li>' , longest. |
478 | 152 |
]. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
153 |
s nextPutLine:'<ul>'. |
478 | 154 |
prefix := longest. |
155 |
] ifFalse:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
156 |
s nextPutLine:'</ul>'. |
552 | 157 |
prefixStack notEmpty ifTrue:[ |
158 |
prefixStack removeLast. |
|
159 |
]. |
|
478 | 160 |
|
161 |
[prefixStack notEmpty |
|
162 |
and:[(longest startsWith:prefixStack last) not]] whileTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
163 |
s nextPutLine:'</ul>'. |
478 | 164 |
prefixStack removeLast. |
165 |
]. |
|
166 |
||
167 |
prefixStack notEmpty ifTrue:[ |
|
168 |
prefix := prefixStack last. |
|
169 |
] ifFalse:[ |
|
170 |
prefixStack addLast:longest. |
|
171 |
prefix := longest. |
|
172 |
longest ~= prev ifTrue:[ |
|
173 |
prefixStack size == 1 ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
174 |
s nextPutLine:'<p>'. |
478 | 175 |
]. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
176 |
s nextPutLine:'<li>' , longest. |
478 | 177 |
]. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
178 |
s nextPutLine:'<ul>'. |
478 | 179 |
] |
180 |
]. |
|
181 |
] |
|
182 |
] ifFalse:[ |
|
183 |
[prefixStack size > 0] whileTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
184 |
s nextPutLine:'</ul>'. |
478 | 185 |
prefixStack removeLast. |
186 |
]. |
|
187 |
prefixStack size == 0 ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
188 |
s nextPutLine:'<p>'. |
478 | 189 |
]. |
190 |
prefix := ''. |
|
191 |
]. |
|
192 |
||
193 |
s nextPutAll:'<li><a href="../misc/onlyInSTX2.html" action="html:' |
|
194 |
, self name |
|
195 |
, ' htmlClassesListOfCategory:''' , nm |
|
196 |
, ''' backTo:''htmlClassCategoryList''">' |
|
197 |
"/ full name: |
|
198 |
"/ , nm ,'</a>';cr. |
|
199 |
||
200 |
"/ cut off prefix: |
|
201 |
, (nm copyFrom:prefix size + 1) ,'</a>';cr. |
|
202 |
prev := nm. |
|
203 |
]. |
|
204 |
||
205 |
s nextPutAll:' |
|
206 |
</ul> |
|
207 |
||
208 |
</body> |
|
209 |
</html> |
|
210 |
'. |
|
211 |
||
212 |
^ s contents |
|
213 |
||
214 |
" |
|
215 |
HTMLDocGenerator htmlClassCategoryList |
|
216 |
" |
|
217 |
||
632 | 218 |
"Created: / 22.4.1996 / 20:03:30 / cg" |
219 |
"Modified: / 30.10.1997 / 13:16:08 / cg" |
|
478 | 220 |
! |
221 |
||
222 |
htmlClassListPrefix:prefix |
|
632 | 223 |
"generate an HTML document string which contains HREFS for a list |
224 |
of classes which start with some prefix (typically, the first |
|
225 |
character is given)" |
|
226 |
||
478 | 227 |
|classes| |
228 |
||
229 |
classes := Smalltalk allClasses |
|
498 | 230 |
select:[:cls | |
231 |
cls isPrivate not |
|
528 | 232 |
and:[(cls isNamespace not or:[cls == Smalltalk]) |
233 |
and:[cls name startsWith:prefix]] |
|
498 | 234 |
]. |
478 | 235 |
|
498 | 236 |
^ self |
237 |
htmlClasses:classes |
|
632 | 238 |
title:('Classes starting with ''' , prefix asString , ''':'). |
478 | 239 |
|
632 | 240 |
"Created: / 22.4.1996 / 20:03:31 / cg" |
241 |
"Modified: / 30.10.1997 / 13:21:49 / cg" |
|
478 | 242 |
! |
243 |
||
244 |
htmlClasses:classes title:title |
|
632 | 245 |
"generate an HTML document string which contains HREFS for a given list |
246 |
of classes" |
|
247 |
||
478 | 248 |
^ self |
249 |
htmlClasses:classes |
|
250 |
title:title |
|
251 |
backTo:nil |
|
252 |
||
632 | 253 |
"Modified: / 30.10.1997 / 13:21:40 / cg" |
478 | 254 |
! |
255 |
||
256 |
htmlClasses:classes title:title backTo:backRef |
|
632 | 257 |
"generate an HTML document string which contains HREFS for a given list |
258 |
of classes. If backref is nonNil, a back-button to that |
|
259 |
HREF is added at the top. |
|
260 |
The generated page is supposed to be given to an HTML reader |
|
261 |
with home being set to ../doc/online/xxx/classDoc |
|
262 |
(i.e. the images are to be found one-up in the doc hierarchy)" |
|
263 |
||
478 | 264 |
|classNames s| |
265 |
||
266 |
classNames := (classes collect:[:cls | cls name]) asOrderedCollection sort. |
|
267 |
||
268 |
s := '' writeStream. |
|
269 |
||
270 |
||
271 |
s nextPutAll:' |
|
272 |
<html> |
|
273 |
<head> |
|
274 |
<title> |
|
275 |
'. |
|
276 |
s nextPutAll:title. |
|
277 |
s nextPutAll:' |
|
278 |
</title> |
|
279 |
</head> |
|
280 |
<body> |
|
281 |
'. |
|
282 |
backRef notNil ifTrue:[ |
|
283 |
backRef == #none ifFalse:[ |
|
632 | 284 |
s nextPutAll:'<a NOPRINT HREF="TOP.html" action="html:' , self name , ' ' , backRef , '"> <IMG SRC="../icons/DocsUpArrow.gif" ALT="[back]"></A>'. |
478 | 285 |
] |
286 |
] ifFalse:[ |
|
632 | 287 |
s nextPutAll:'<a NOPRINT HREF="TOP.html"> <IMG SRC="../icons/DocsUpArrow.gif" ALT="[back]"></A>'. |
478 | 288 |
]. |
289 |
backRef ~~ #none ifTrue:[ |
|
290 |
s nextPutAll:'<hr> |
|
291 |
'. |
|
292 |
]. |
|
293 |
||
294 |
s nextPutAll:' |
|
295 |
<h1> |
|
296 |
'. |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
297 |
s nextPutLine:title. |
478 | 298 |
s nextPutAll:' |
299 |
</h1> |
|
300 |
<ul> |
|
301 |
'. |
|
302 |
||
303 |
classNames do:[:nm | |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
304 |
s nextPutLine:'<li><a href="../misc/onlyInSTX2.html" action="html:' , self name ,' htmlDocOf:' , nm , '">' , nm , '</A>' |
478 | 305 |
]. |
306 |
||
307 |
s nextPutAll:' |
|
308 |
</ul> |
|
309 |
</body> |
|
310 |
</html> |
|
311 |
'. |
|
312 |
||
313 |
^ s contents |
|
314 |
||
632 | 315 |
"Created: / 23.4.1996 / 15:31:55 / cg" |
316 |
"Modified: / 30.10.1997 / 13:21:32 / cg" |
|
478 | 317 |
! |
318 |
||
319 |
htmlClassesListOfCategory:category |
|
632 | 320 |
"generate an HTML document string which contains HREFS for a list |
321 |
of classes which are contained in a particular category." |
|
322 |
||
528 | 323 |
^ self |
324 |
htmlClassesListOfCategory:category |
|
478 | 325 |
backTo:nil |
326 |
||
632 | 327 |
"Modified: / 30.10.1997 / 13:21:23 / cg" |
478 | 328 |
! |
329 |
||
330 |
htmlClassesListOfCategory:category backTo:backRef |
|
632 | 331 |
"generate an HTML document string which contains HREFS for a list |
332 |
of classes which are contained in a particular category." |
|
333 |
||
478 | 334 |
|classes| |
335 |
||
336 |
classes := Smalltalk allClasses |
|
498 | 337 |
select:[:cls | cls isPrivate not |
528 | 338 |
and:[(cls isNamespace not or:[cls == Smalltalk]) |
339 |
and:[cls category = category]] |
|
340 |
]. |
|
478 | 341 |
|
342 |
^ self |
|
632 | 343 |
htmlClasses:classes |
344 |
title:('Classes in: ' , category) |
|
478 | 345 |
backTo:backRef |
346 |
||
632 | 347 |
"Created: / 23.4.1996 / 15:39:39 / cg" |
348 |
"Modified: / 30.10.1997 / 13:21:16 / cg" |
|
478 | 349 |
! |
350 |
||
541
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
351 |
htmlClassesMatching:aMatchPattern backTo:backRef |
632 | 352 |
"generate an HTML document string which contains HREFS |
353 |
for a list of classes whose name matches a given matchPattern." |
|
354 |
||
541
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
355 |
|classes cls| |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
356 |
|
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
357 |
classes := Smalltalk allClasses |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
358 |
select:[:cls | cls isPrivate not |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
359 |
and:[(cls isNamespace not or:[cls == Smalltalk]) |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
360 |
and:[aMatchPattern match:cls name]] |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
361 |
]. |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
362 |
|
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
363 |
^ self |
632 | 364 |
htmlClasses:classes |
365 |
title:('Classes matching: ' , aMatchPattern) |
|
541
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
366 |
backTo:backRef |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
367 |
|
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
368 |
" |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
369 |
self htmlClassesMatching:'Tgen::*' backTo:nil |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
370 |
" |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
371 |
|
632 | 372 |
"Modified: / 30.10.1997 / 13:21:06 / cg" |
541
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
373 |
! |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
374 |
|
478 | 375 |
htmlDocOf:aClass |
632 | 376 |
"generate an HTML document string which contains a classes documentation" |
377 |
||
478 | 378 |
^ self htmlDocOf:aClass back:nil backRef:nil |
379 |
||
380 |
" |
|
381 |
self htmlDocOf:PostscriptPrinterStream |
|
382 |
" |
|
383 |
||
632 | 384 |
"Modified: / 30.10.1997 / 13:22:19 / cg" |
478 | 385 |
! |
386 |
||
387 |
htmlDocOf:aClass back:backCmd |
|
632 | 388 |
"generate an HTML document string which contains a classes documentation" |
389 |
||
478 | 390 |
^ self htmlDocOf:aClass back:backCmd backRef:nil |
391 |
||
632 | 392 |
"Modified: / 30.10.1997 / 13:22:27 / cg" |
478 | 393 |
! |
394 |
||
395 |
htmlDocOf:aClass back:backCmd backRef:backRef |
|
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
396 |
"generate a nice HTML page from a class, with a back-reference |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
397 |
to a command or document. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
398 |
|
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
399 |
Extract sections from the classes documentation method, |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
400 |
where the following lines start a special subsection: |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
401 |
[see also:] - references to other classes and/or documents |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
402 |
[start with:] - one-liners to start a demonstration |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
403 |
[author:] - author(s) of this class |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
404 |
[warning:] - usage warnings if any |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
405 |
[hints:] - usage hints if any |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
406 |
Each section ends with an empty line - however, for formatting, |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
407 |
a line consisting of a single backslash character will be converted |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
408 |
to an empty line. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
409 |
|
632 | 410 |
Also extract examples from the classes example method, |
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
411 |
where executable examples are made from sections enclosed in: |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
412 |
[exBegin] |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
413 |
... |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
414 |
[exEnd] |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
415 |
these parts are displayed in courier and will be made executable. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
416 |
everything else is plain documentation text. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
417 |
" |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
418 |
|
478 | 419 |
|supers s indent m docu examples firstIndent firstNonEmpty |
420 |
collectionOfCategories collectionOfClassCategories |
|
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
421 |
revInfo pckgInfo subs refLines demoLines warnLines hintLines |
499 | 422 |
backHRef authorLines first wasLoaded didLoadBin |
530
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
423 |
privateClasses owner className metaClass shortName shortMetaName |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
424 |
text path| |
478 | 425 |
|
600 | 426 |
aClass isNil ifTrue:[ |
427 |
^ '' "/ just in case ... |
|
428 |
]. |
|
429 |
||
478 | 430 |
(wasLoaded := aClass isLoaded) ifFalse:[ |
431 |
"/ load it - but not a binary |
|
432 |
didLoadBin := Smalltalk loadBinaries. |
|
433 |
Smalltalk loadBinaries:false. |
|
530
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
434 |
[ |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
435 |
aClass autoload. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
436 |
] valueNowOrOnUnwindDo:[ |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
437 |
didLoadBin ifTrue:[Smalltalk loadBinaries:true]. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
438 |
] |
478 | 439 |
]. |
440 |
||
499 | 441 |
owner := aClass owningClass. |
569 | 442 |
privateClasses := aClass privateClassesSorted. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
443 |
className := aClass name. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
444 |
shortName := aClass nameWithoutPrefix. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
445 |
metaClass := aClass class. |
523 | 446 |
shortMetaName := metaClass nameWithoutPrefix. |
499 | 447 |
|
478 | 448 |
"/ |
449 |
"/ extract documentation or comment, if there is any |
|
450 |
"/ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
451 |
m := metaClass compiledMethodAt:#documentation. |
478 | 452 |
m notNil ifTrue:[ |
453 |
docu := m comment. |
|
454 |
] ifFalse:[ |
|
455 |
"try comment" |
|
456 |
docu := aClass comment. |
|
457 |
]. |
|
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
458 |
|
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
459 |
(docu notNil and:[docu isEmpty]) ifTrue:[ |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
460 |
docu := nil |
478 | 461 |
]. |
462 |
docu notNil ifTrue:[ |
|
463 |
docu := (docu copy |
|
464 |
replChar:$< withString:'<') |
|
465 |
replChar:$> withString:'>'. |
|
466 |
||
467 |
docu := docu asStringCollection. |
|
468 |
||
469 |
"/ |
|
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
470 |
"/ search for a [see also:] section |
478 | 471 |
"/ |
472 |
refLines := self extractSpecial:'[see also:]' from:docu. |
|
473 |
||
474 |
"/ |
|
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
475 |
"/ search for a [start with:] section |
478 | 476 |
"/ |
477 |
demoLines := self extractSpecial:'[start with:]' from:docu. |
|
478 |
||
479 |
"/ |
|
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
480 |
"/ search for a [author:] section |
478 | 481 |
"/ |
482 |
authorLines := self extractSpecial:'[author:]' from:docu. |
|
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
483 |
authorLines isNil ifTrue:[ |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
484 |
authorLines := self extractSpecial:'[authors:]' from:docu. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
485 |
]. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
486 |
|
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
487 |
"/ |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
488 |
"/ search for a [warning:] section |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
489 |
"/ |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
490 |
warnLines := self extractSpecial:'[warning:]' from:docu. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
491 |
|
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
492 |
"/ |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
493 |
"/ search for a [hints:] section |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
494 |
"/ |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
495 |
hintLines := self extractSpecial:'[hints:]' from:docu. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
496 |
hintLines isNil ifTrue:[ |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
497 |
hintLines := self extractSpecial:'[hint:]' from:docu. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
498 |
]. |
478 | 499 |
|
500 |
"/ |
|
501 |
"/ strip off empty lines |
|
502 |
"/ |
|
503 |
[(docu at:1) size == 0] whileTrue:[ |
|
504 |
docu removeIndex:1 |
|
505 |
]. |
|
506 |
[(docu at:docu size) size == 0] whileTrue:[ |
|
507 |
docu removeIndex:(docu size) |
|
508 |
]. |
|
509 |
||
510 |
docu notEmpty ifTrue:[ |
|
511 |
firstIndent := docu first leftIndent. |
|
512 |
firstIndent > 0 ifTrue:[ |
|
513 |
docu := docu collect:[:line | |
|
514 |
line leftIndent >= firstIndent ifTrue:[ |
|
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
515 |
line copyFrom:firstIndent + 1. |
478 | 516 |
] ifFalse:[ |
517 |
line |
|
518 |
] |
|
519 |
]. |
|
520 |
]. |
|
521 |
firstNonEmpty := docu findFirst:[:line | line notEmpty]. |
|
522 |
firstNonEmpty > 1 ifTrue:[ |
|
523 |
docu := docu copyFrom:firstNonEmpty |
|
524 |
] |
|
525 |
]. |
|
526 |
docu := docu asString. |
|
527 |
]. |
|
528 |
||
529 |
refLines notNil ifTrue:[ |
|
530 |
refLines := refLines collect:[:l | |
|
531 |
|t| |
|
532 |
||
533 |
((t := l withoutSeparators) startsWith:'(') ifTrue:[ |
|
534 |
t |
|
535 |
] ifFalse:[ |
|
536 |
l asCollectionOfWords |
|
537 |
] |
|
538 |
]. |
|
539 |
]. |
|
540 |
||
541 |
"/ |
|
542 |
"/ extract examples if there are any |
|
543 |
"/ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
544 |
m := metaClass compiledMethodAt:#examples. |
478 | 545 |
m notNil ifTrue:[ |
546 |
examples := m comment. |
|
547 |
examples notNil ifTrue:[ |
|
548 |
examples isEmpty ifTrue:[ |
|
549 |
examples := nil |
|
550 |
]. |
|
551 |
]. |
|
552 |
examples notNil ifTrue:[ |
|
553 |
examples := (examples copy |
|
554 |
replChar:$< withString:'<') |
|
555 |
replChar:$> withString:'>'. |
|
556 |
||
557 |
examples := examples asStringCollection. |
|
558 |
||
559 |
"/ |
|
560 |
"/ strip off empty lines |
|
561 |
"/ |
|
562 |
[examples first size == 0] whileTrue:[ |
|
563 |
examples removeIndex:1 |
|
564 |
]. |
|
565 |
[examples last size == 0] whileTrue:[ |
|
566 |
examples removeIndex:(examples size) |
|
567 |
]. |
|
568 |
||
569 |
examples notEmpty ifTrue:[ |
|
570 |
firstIndent := examples first withTabsExpanded leftIndent. |
|
571 |
firstIndent > 0 ifTrue:[ |
|
572 |
examples := examples collect:[:line | |
|
573 |
|l| |
|
574 |
||
575 |
l := line withTabsExpanded. |
|
576 |
l leftIndent >= firstIndent ifTrue:[ |
|
577 |
l copyFrom:firstIndent. |
|
578 |
] ifFalse:[ |
|
579 |
l |
|
580 |
] |
|
581 |
]. |
|
582 |
]. |
|
583 |
firstNonEmpty := examples findFirst:[:line | line notEmpty]. |
|
584 |
firstNonEmpty > 1 ifTrue:[ |
|
585 |
examples := examples copyFrom:firstNonEmpty |
|
586 |
] |
|
587 |
]. |
|
588 |
] |
|
589 |
]. |
|
590 |
||
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
591 |
collectionOfClassCategories := metaClass categories. |
478 | 592 |
collectionOfClassCategories size > 0 ifTrue:[ |
593 |
collectionOfClassCategories := collectionOfClassCategories asOrderedCollection. |
|
594 |
collectionOfClassCategories remove:'documentation' ifAbsent:nil. |
|
595 |
]. |
|
596 |
collectionOfCategories := aClass categories. |
|
597 |
collectionOfCategories size > 0 ifTrue:[ |
|
598 |
collectionOfCategories := collectionOfCategories asOrderedCollection. |
|
599 |
]. |
|
600 |
||
601 |
(aClass == Autoload or:[aClass == Object]) ifTrue:[ |
|
602 |
subs := #() |
|
603 |
] ifFalse:[ |
|
604 |
subs := aClass subclasses |
|
605 |
asOrderedCollection sort:[:a :b | a name < b name]. |
|
606 |
]. |
|
607 |
||
608 |
s := '' writeStream. |
|
609 |
||
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
610 |
s nextPutLine:'<html><head><title>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
611 |
s nextPutAll:'Class: '; nextPutLine:(className). |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
612 |
s nextPutLine:'</title></head><body>'. |
478 | 613 |
|
614 |
backRef isNil ifTrue:[ |
|
615 |
backHRef := 'TOP.html' |
|
616 |
] ifFalse:[ |
|
617 |
backHRef := backRef |
|
618 |
]. |
|
619 |
backCmd notNil ifTrue:[ |
|
632 | 620 |
s nextPutAll:'<a NOPRINT HREF="' , backHRef , '" action="html:' , self name , ' ' , backCmd , '"> <IMG NOPRINT SRC="../icons/DocsUpArrow.gif" ALT="[back]"></A>'. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
621 |
s nextPutLine:'<hr>'. |
478 | 622 |
] ifFalse:[ |
623 |
backHRef ~~ #none ifTrue:[ |
|
632 | 624 |
s nextPutAll:'<a NOPRINT HREF="' , backHRef , '"> <IMG NOPRINT SRC="../icons/DocsUpArrow.gif" ALT="[back]"></A>';cr. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
625 |
s nextPutLine:'<hr>'. |
478 | 626 |
] |
627 |
]. |
|
628 |
||
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
629 |
s nextPutLine:'<h1>'. |
478 | 630 |
s nextPutAll:'Class: '; |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
631 |
nextPutAll:'<a INFO="open a browser on ' , shortName , '" type="example" action="SystemBrowser openInClass:' , className , '">'; |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
632 |
nextPutAll:(shortName); nextPutLine:'</a>'. |
499 | 633 |
|
634 |
owner notNil ifTrue:[ |
|
635 |
s nextPutAll:' (private in '; |
|
636 |
nextPutAll:'<a INFO="open a browser on ' , owner nameWithoutPrefix , '" type="example" action="SystemBrowser openInClass:' , owner name , '">'; |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
637 |
nextPutAll:(owner nameWithoutPrefix); nextPutLine:'</a>)'. |
523 | 638 |
] ifFalse:[ |
639 |
aClass nameSpace ~~ Smalltalk ifTrue:[ |
|
640 |
s nextPutAll:' (in ' , aClass nameSpace name , ')' |
|
641 |
] |
|
499 | 642 |
]. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
643 |
s nextPutLine:'</h1>'. |
478 | 644 |
|
499 | 645 |
owner notNil ifTrue:[ |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
646 |
s nextPutLine:'This class is only visible from within'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
647 |
s nextPutLine:owner nameWithoutPrefix. |
499 | 648 |
owner owningClass notNil ifTrue:[ |
649 |
s nextPutAll:'(which is itself a private class of '. |
|
650 |
s nextPutAll:owner owningClass nameWithoutPrefix. |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
651 |
s nextPutLine:')' |
499 | 652 |
]. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
653 |
s nextPutLine:'.' |
499 | 654 |
]. |
655 |
||
478 | 656 |
"/ |
657 |
"/ index |
|
658 |
"/ |
|
659 |
"/ s nextPutAll:'Index:'; cr. |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
660 |
s nextPutLine:'<ul>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
661 |
s nextPutLine:'<li><a href="#INHERITANCE" name="I_INHERITANCE">Inheritance</a>'. |
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
662 |
|
478 | 663 |
docu notNil ifTrue:[ |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
664 |
s nextPutLine:'<li><a href="#DESCRIPTION" name="I_DESCRIPTION">Description</a>'. |
478 | 665 |
]. |
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
666 |
warnLines notNil ifTrue:[ |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
667 |
warnLines := warnLines asStringCollection. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
668 |
s nextPutLine:'<li><a href="#WARNING" name="I_WARNING">Warning</a>'. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
669 |
]. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
670 |
hintLines notNil ifTrue:[ |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
671 |
hintLines := hintLines asStringCollection. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
672 |
s nextPutLine:'<li><a href="#HINTS" name="I_HINTS">Hints</a>'. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
673 |
]. |
478 | 674 |
|
675 |
refLines notNil ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
676 |
s nextPutLine:'<li><a href="#SEEALSO" name="I_SEEALSO">Related information</a>'. |
478 | 677 |
]. |
678 |
||
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
679 |
"/ s nextPutLine:'<li><a href="#INSTANCEVARIABLES" name="I_INSTANCEVARIABLES">Instance variables</a>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
680 |
"/ s nextPutLine:'<li><a href="#CLASSVARIABLES" name="I_CLASSVARIABLES">Class variables</a>'. |
478 | 681 |
|
682 |
collectionOfClassCategories size > 0 ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
683 |
s nextPutLine:'<li><a href="#CLASSPROTOCOL" name="I_CLASSPROTOCOL">Class protocol</a>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
684 |
s nextPutLine:'<ul>'. |
478 | 685 |
collectionOfClassCategories sort do:[:cat | |
523 | 686 |
s nextPutLine:'<li><a name="I_' , shortMetaName , '_category_' , cat , '"' , |
687 |
' href="#' , shortMetaName , '_category_' , cat , |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
688 |
'">' , cat , '</a> '. |
478 | 689 |
]. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
690 |
s nextPutLine:'</ul>'. |
478 | 691 |
]. |
692 |
collectionOfCategories size > 0 ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
693 |
s nextPutLine:'<li><a href="#INSTANCEPROTOCOL" name="I_INSTANCEPROTOCOL">Instance protocol</a>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
694 |
s nextPutLine:'<ul>'. |
478 | 695 |
collectionOfCategories sort do:[:cat | |
523 | 696 |
s nextPutLine:'<li><a name="I_' , shortName , '_category_' , cat , '"' , |
697 |
' href="#' , shortName , '_category_' , cat , |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
698 |
'">' , cat , '</a> '. |
478 | 699 |
]. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
700 |
s nextPutLine:'</ul>'. |
478 | 701 |
]. |
702 |
||
499 | 703 |
privateClasses size > 0 ifTrue:[ |
704 |
privateClasses := privateClasses asOrderedCollection sort:[:a :b | a nameWithoutPrefix < b nameWithoutPrefix]. |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
705 |
s nextPutLine:'<li><a href="#PRIVATECLASSES" name="I_PRIVATECLASSES">Private classes</a>'. |
499 | 706 |
]. |
707 |
||
478 | 708 |
(aClass == Object or:[aClass == Autoload]) ifTrue:[ |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
709 |
s nextPutLine:'<li><a href="#SUBCLASSES" name="I_SUBCLASSES">Subclasses</a>'. |
478 | 710 |
]. |
711 |
demoLines notNil ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
712 |
s nextPutLine:'<li><a href="#DEMOSTARTUP" name="I_DEMOSTARTUP">Demonstration</a>'. |
478 | 713 |
]. |
714 |
examples notNil ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
715 |
s nextPutLine:'<li><a href="#EXAMPLES" name="I_EXAMPLES">Examples</a>'. |
478 | 716 |
]. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
717 |
s nextPutLine:'</ul>'; nextPutLine:'<hr>'. |
478 | 718 |
|
719 |
||
720 |
"/ |
|
721 |
"/ hierarchy |
|
722 |
"/ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
723 |
s nextPutLine:'<h2><a name="INHERITANCE" href="#I_INHERITANCE">Inheritance:</A></h2>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
724 |
s nextPutLine:'<pre>'. |
478 | 725 |
indent := 3. |
726 |
first := true. |
|
727 |
supers := aClass allSuperclasses. |
|
728 |
(supers notNil) ifTrue:[ |
|
637 | 729 |
supers reverseDo:[:cls | |
478 | 730 |
|nm| |
731 |
||
732 |
nm := cls name. |
|
733 |
first ifFalse:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
734 |
s spaces:indent; nextPutLine:'|'. |
478 | 735 |
s spaces:indent; nextPutAll:'+--'. |
736 |
indent := indent + 3. |
|
737 |
] ifTrue:[ |
|
738 |
s spaces:indent |
|
739 |
]. |
|
740 |
first := false. |
|
741 |
||
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
742 |
s nextPutLine:'<a INFO="show documentation of ' , nm , '" href="../misc/onlyInSTX2.html" action="html:' , self name , ' htmlDocOf:' , nm , '">' , nm , '</A>'. |
478 | 743 |
]. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
744 |
s spaces:indent; nextPutLine:'|'. |
478 | 745 |
s spaces:indent. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
746 |
s nextPutAll:'+--<B>'; nextPutAll:className; nextPutLine:'</B>'. |
478 | 747 |
indent := indent + 3. |
748 |
] ifFalse:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
749 |
s spaces:indent; nextPutLine:'nil'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
750 |
s spaces:indent; nextPutLine:'|'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
751 |
s spaces:indent; nextPutAll:'+--<B>'; nextPutAll:className; nextPutLine:'</B>'. |
478 | 752 |
aClass ~~ Object ifTrue:[ |
753 |
s cr. |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
754 |
s nextPutLine:' <B>This class inherits NOTHING - most messages will lead into doesNotUnderstand:</B>' |
478 | 755 |
]. |
756 |
indent := indent + 3. |
|
757 |
]. |
|
758 |
||
759 |
subs notEmpty ifTrue:[ |
|
760 |
subs do:[:aSubclass | |
|
761 |
|nm| |
|
762 |
||
763 |
nm := aSubclass name. |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
764 |
s spaces:indent; nextPutLine:'|'. |
478 | 765 |
s spaces:indent; nextPutAll:'+--'. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
766 |
s nextPutLine:'<a INFO="show documentation of ' , nm , '" href="../misc/onlyInSTX2.html" action="html:' , self name , ' htmlDocOf:' , nm , '">' , nm , '</A>'. |
478 | 767 |
] |
768 |
] ifFalse:[ |
|
769 |
aClass == Object ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
770 |
s spaces:indent; nextPutLine:'|'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
771 |
s spaces:indent; nextPutLine:'+-- ... almost every other class ...' |
478 | 772 |
] |
773 |
]. |
|
774 |
||
775 |
||
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
776 |
s nextPutLine:'</pre>'; nextPutLine:'<hr>'. |
478 | 777 |
|
778 |
"/ |
|
779 |
"/ category, version & package |
|
780 |
"/ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
781 |
s nextPutLine:'<dl>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
782 |
s nextPutLine:'<dt><a name="CATEGORY"><b>Category:</b></A>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
783 |
s nextPutLine:'<dd><b>', aClass category , '</b>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
784 |
s nextPutLine:'</dl>'. |
478 | 785 |
|
499 | 786 |
owner notNil ifTrue:[ |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
787 |
s nextPutLine:'<dl>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
788 |
s nextPutLine:'<dt><a name="OWNER"><b>Owner:</b></A>'. |
499 | 789 |
s nextPutAll:'<dd><b>'; |
790 |
nextPutAll:'<a INFO="show documentation of ' , owner nameWithoutPrefix , '" href="../misc/onlyInSTX2.html" action="html:' , self name , ' htmlDocOf:' , owner name , '">' , owner nameWithoutPrefix , '</A>'; |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
791 |
nextPutLine:'</b>'. |
499 | 792 |
] ifFalse:[ |
530
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
793 |
self htmlRevisionDocOf:aClass to:s. |
478 | 794 |
]. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
795 |
s nextPutLine:'</dl>'. |
478 | 796 |
|
797 |
authorLines notNil ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
798 |
s nextPutLine:'<dl><dt><a name="AUTHOR"><b>Author:</b></A>'. |
478 | 799 |
authorLines do:[:l| |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
800 |
s nextPutLine:'<dd><b>', l , '</b>'. |
478 | 801 |
]. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
802 |
s nextPutLine:'</dl>'. |
478 | 803 |
]. |
804 |
||
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
805 |
s nextPutLine:'<hr>'. |
478 | 806 |
|
807 |
docu notNil ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
808 |
s nextPutLine:'<h2><a name="DESCRIPTION" href="#I_DESCRIPTION">Description:</A></h2>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
809 |
s nextPutLine:'<BR>'. |
478 | 810 |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
811 |
s nextPutLine:'<pre>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
812 |
s nextPutLine:docu. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
813 |
s nextPutLine:'</pre>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
814 |
s nextPutLine:'<hr>'. |
478 | 815 |
]. |
816 |
||
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
817 |
warnLines notNil ifTrue:[ |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
818 |
s nextPutLine:'<h2><a name="WARNING" href="#I_WARNING">Warning:</A></h2>'. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
819 |
s nextPutLine:'<BR>'. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
820 |
|
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
821 |
s nextPutLine:'<pre>'. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
822 |
firstIndent := warnLines first leftIndent. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
823 |
|
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
824 |
warnLines do:[:aLine | |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
825 |
aLine leftIndent >= firstIndent ifTrue:[ |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
826 |
s nextPutLine:(aLine copyFrom:firstIndent+1) |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
827 |
] ifFalse:[ |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
828 |
s nextPutLine:aLine |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
829 |
]. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
830 |
]. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
831 |
s nextPutLine:'</pre>'. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
832 |
s nextPutLine:'<hr>'. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
833 |
]. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
834 |
|
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
835 |
hintLines notNil ifTrue:[ |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
836 |
s nextPutLine:'<h2><a name="HINTS" href="#I_HINTS">Hints:</A></h2>'. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
837 |
s nextPutLine:'<BR>'. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
838 |
|
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
839 |
s nextPutLine:'<pre>'. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
840 |
firstIndent := hintLines first leftIndent. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
841 |
|
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
842 |
hintLines do:[:aLine | |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
843 |
aLine leftIndent >= firstIndent ifTrue:[ |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
844 |
s nextPutLine:(aLine copyFrom:firstIndent+1) |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
845 |
] ifFalse:[ |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
846 |
s nextPutLine:aLine |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
847 |
]. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
848 |
]. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
849 |
s nextPutLine:'</pre>'. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
850 |
s nextPutLine:'<hr>'. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
851 |
]. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
852 |
|
478 | 853 |
"/ |
854 |
"/ see also |
|
855 |
"/ |
|
856 |
refLines notNil ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
857 |
s nextPutLine:'<h2><a name="SEEALSO" href="#I_SEEALSO">Related information:</A></h2>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
858 |
s nextPutLine:'<pre>'. |
478 | 859 |
refLines do:[:l | |
860 |
|nm href| |
|
861 |
||
862 |
s nextPutAll:' '. |
|
863 |
||
864 |
l isString ifTrue:[ |
|
865 |
nm := (l copyFrom:2 to:(l indexOf:$:)-1) withoutSpaces. |
|
866 |
href := (l copyFrom:(l indexOf:$:)+1 to:(l size - 1)) withoutSpaces. |
|
867 |
(href startsWith:'man:') ifTrue:[ |
|
868 |
href := (href copyFrom:5) withoutSpaces. |
|
500 | 869 |
s nextPutAll:'<a INFO="show man page" href="../misc/onlyInSTX2.html" action="html:' , self name , ' manPageFor:''' , href , '''">[<I>' , nm , '</I>]</A>'. |
478 | 870 |
] ifFalse:[ |
871 |
(href startsWith:'html:') ifTrue:[ |
|
872 |
href := (href copyFrom:6) withoutSpaces. |
|
873 |
]. |
|
874 |
s nextPutAll:'<a href="../' , href , '">[<I>' , nm , '</I>]</a>'. |
|
875 |
] |
|
876 |
] ifFalse:[ |
|
877 |
l do:[:ref | |
|
523 | 878 |
|realRef ns| |
879 |
||
542 | 880 |
(ref includesMatchCharacters) ifTrue:[ |
541
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
881 |
s nextPutAll:'<a INFO="show documentation of ' , ref , '" href="../misc/onlyInSTX2.html" action="html:' , self name , ' htmlClassesMatching:''' , ref , ''' backTo:nil">' , ref , '</A>'. |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
882 |
] ifFalse:[ |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
883 |
realRef := ref. |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
884 |
(ns := aClass nameSpace) notNil ifTrue:[ |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
885 |
(ns at:realRef asSymbol) notNil ifTrue:[ |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
886 |
realRef := ns name , '::' , realRef |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
887 |
] |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
888 |
]. |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
889 |
s nextPutAll:'<a INFO="show documentation of ' , realRef , '" href="../misc/onlyInSTX2.html" action="html:' , self name , ' htmlDocOf:' , realRef , '">' , ref , '</A>'. |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
890 |
s nextPutAll:' '. |
095de1529e29
allow matchPatterns in related information
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
891 |
] |
478 | 892 |
]. |
893 |
]. |
|
894 |
s cr. |
|
895 |
]. |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
896 |
s nextPutLine:'</pre>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
897 |
s nextPutLine:'<hr>'. |
478 | 898 |
]. |
899 |
||
900 |
||
901 |
"/ |
|
902 |
"/ inst & classVars |
|
903 |
"/ to be added |
|
904 |
||
905 |
||
906 |
"/ |
|
907 |
"/ protocol |
|
908 |
"/ |
|
909 |
self printOutHTMLProtocolOf:aClass on:s. |
|
910 |
||
911 |
"/ |
|
912 |
"/ subclasses (only for Object and Autoload) |
|
913 |
"/ |
|
914 |
(aClass == Object or:[aClass == Autoload]) ifTrue:[ |
|
915 |
subs := aClass subclasses |
|
916 |
asOrderedCollection sort:[:a :b | a name < b name]. |
|
917 |
||
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
918 |
s nextPutLine:'<h2><a name="SUBCLASSES" href="#I_SUBCLASSES">Subclasses (direct subclasses only):</A></h2>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
919 |
s nextPutLine:'<pre>'. |
478 | 920 |
subs do:[:cls | |
921 |
|nm| |
|
922 |
||
923 |
nm := cls name. |
|
924 |
s nextPutAll:' '. |
|
925 |
cls isLoaded ifFalse:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
926 |
s nextPutLine:'<a INFO="show documentation of ' , nm , '" href="../misc/onlyInSTX2.html" action="html:' , nm , ' autoload. ',self name,' htmlDocOf:' , nm, '">' , nm , '</A>' |
478 | 927 |
] ifTrue:[ |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
928 |
s nextPutLine:'<a INFO="show documentation of ' , nm , '" href="../misc/onlyInSTX2.html" action="html:',self name,' htmlDocOf:' , nm , '">' , nm , '</A>' |
478 | 929 |
]. |
930 |
]. |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
931 |
s nextPutLine:'</pre>'; nextPutLine:'<hr>'. |
478 | 932 |
]. |
933 |
||
934 |
"/ |
|
499 | 935 |
"/ private classes |
936 |
"/ |
|
937 |
privateClasses size > 0 ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
938 |
s nextPutLine:'<h2><a name="PRIVATECLASSES" href="#I_PRIVATECLASSES">Private classes:</A></h2>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
939 |
s nextPutLine:'<pre>'. |
499 | 940 |
privateClasses do:[:cls | |
523 | 941 |
|nm fullName| |
499 | 942 |
|
943 |
nm := cls nameWithoutPrefix. |
|
523 | 944 |
fullName := cls owningClass name , '::' , nm. |
499 | 945 |
s nextPutAll:' '. |
523 | 946 |
s nextPutLine:'<a INFO="show documentation of ' , fullName , '" href="../misc/onlyInSTX2.html" action="html:',self name,' htmlDocOf:' , fullName , '">' , nm , '</A>' |
499 | 947 |
]. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
948 |
s nextPutLine:'</pre>'; nextPutLine:'<hr>'. |
499 | 949 |
]. |
950 |
||
951 |
"/ |
|
478 | 952 |
"/ demonstration |
953 |
"/ |
|
954 |
demoLines notNil ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
955 |
s nextPutLine:'<h2><a name="DEMOSTARTUP" href="#I_DEMOSTARTUP">Demonstration:</A></h2>'. |
478 | 956 |
demoLines do:[:l | |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
957 |
s nextPutLine:'<a INFO="demonstration" type="example">'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
958 |
s nextPutLine:'<code><pre>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
959 |
s nextPutLine:' ' , l withoutSeparators. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
960 |
s nextPutLine:'</pre></code>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
961 |
s nextPutLine:'</a>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
962 |
s nextPutLine:'<br>'. |
478 | 963 |
]. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
964 |
s nextPutLine:'<hr>'. |
478 | 965 |
]. |
966 |
||
967 |
"/ |
|
968 |
"/ add examples if there are any |
|
969 |
"/ |
|
970 |
examples notNil ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
971 |
s nextPutLine:'<h2><a name="EXAMPLES" href="#I_EXAMPLES">Examples:</A></h2>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
972 |
s nextPutLine:'<BR>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
973 |
s nextPutLine:'<code><pre>'. |
478 | 974 |
examples do:[:line | |
975 |
line withoutSeparators = '[exBegin]' ifTrue:[ |
|
599 | 976 |
s nextPutLine:'<a INFO="execute the example" type="example" showresult>'. |
478 | 977 |
] ifFalse:[ |
978 |
line withoutSeparators = '[exEnd]' ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
979 |
s nextPutLine:'</a>'. |
478 | 980 |
] ifFalse:[ |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
981 |
s nextPutLine:line |
478 | 982 |
] |
983 |
]. |
|
984 |
]. |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
985 |
s nextPutLine:'</pre></code>'; nextPutLine:'<hr>'. |
478 | 986 |
]. |
987 |
||
988 |
||
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
989 |
s nextPutLine:'</body>'; nextPutLine:'</html>'. |
478 | 990 |
|
991 |
wasLoaded ifFalse:[ |
|
992 |
aClass unload |
|
993 |
]. |
|
994 |
||
995 |
^ s contents |
|
996 |
||
997 |
" |
|
998 |
self htmlDocOf:Object |
|
999 |
self htmlDocOf:Array |
|
1000 |
self htmlDocOf:Filename |
|
1001 |
self htmlDocOf:Block |
|
1002 |
" |
|
1003 |
||
632 | 1004 |
"Created: / 24.4.1996 / 15:01:59 / cg" |
637 | 1005 |
"Modified: / 18.12.1997 / 10:37:11 / cg" |
478 | 1006 |
! |
1007 |
||
1008 |
htmlDocOf:aClass backRef:backRef |
|
632 | 1009 |
"generate an HTML document string which contains a classes documentation" |
1010 |
||
478 | 1011 |
^ self htmlDocOf:aClass back:nil backRef:backRef |
1012 |
||
632 | 1013 |
"Created: / 24.4.1996 / 15:03:25 / cg" |
1014 |
"Modified: / 30.10.1997 / 13:23:12 / cg" |
|
478 | 1015 |
! |
1016 |
||
1017 |
htmlDocOfImplementorsOf:selector |
|
632 | 1018 |
"generate an HTML document string which contains HREFS |
1019 |
to all implementors of a particular selector" |
|
1020 |
||
492 | 1021 |
|sel s| |
478 | 1022 |
|
1023 |
sel := (selector copy |
|
1024 |
replChar:$< withString:'<') |
|
1025 |
replChar:$> withString:'>'. |
|
1026 |
||
1027 |
s := '' writeStream. |
|
1028 |
||
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1029 |
s nextPutLine:'<html><head><title>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1030 |
s nextPutLine:sel. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1031 |
s nextPutLine:'</title></head>'. |
478 | 1032 |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1033 |
s nextPutLine:'<body>'. |
632 | 1034 |
s nextPutLine:'<a NOPRINT HREF="TOP.html"> <IMG SRC="../icons/DocsUpArrow.gif" ALT="[back]"></A>'. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1035 |
s nextPutLine:'<hr>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1036 |
s nextPutAll:'<h1>'; nextPutAll:sel; nextPutAll:'</h1>'. |
478 | 1037 |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1038 |
s nextPutLine:'<dl>'. |
478 | 1039 |
|
1040 |
sel := selector asSymbol. |
|
1041 |
Smalltalk allClassesDo:[:cls | |
|
499 | 1042 |
cls isPrivate ifFalse:[ |
1043 |
(cls implements:sel) ifTrue:[ |
|
1044 |
self printOutHTMLMethodProtocol:(cls compiledMethodAt:sel) |
|
1045 |
on:s showClassName:true classRef:true. |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1046 |
s nextPutLine:'<p>'. |
499 | 1047 |
] |
478 | 1048 |
] |
1049 |
]. |
|
1050 |
||
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1051 |
s nextPutLine:'</dl>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1052 |
s nextPutLine:'</body></html>'. |
478 | 1053 |
|
1054 |
^ s contents |
|
1055 |
||
632 | 1056 |
"Created: / 22.4.1996 / 20:03:31 / cg" |
1057 |
"Modified: / 30.10.1997 / 13:23:49 / cg" |
|
478 | 1058 |
! |
1059 |
||
530
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1060 |
htmlRevisionDocOf:aClass to:s |
632 | 1061 |
"extract a classes versionInfo and return an HTML document string |
1062 |
for that." |
|
1063 |
||
530
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1064 |
|revInfo pckgInfo text path| |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1065 |
|
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1066 |
revInfo := aClass revisionInfo. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1067 |
pckgInfo := aClass packageSourceCodeInfo. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1068 |
|
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1069 |
s nextPutLine:'<dl><dt><a name="VERSION"><b>Version:</b></A>'. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1070 |
|
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1071 |
(revInfo isNil and:[pckgInfo isNil]) ifTrue:[ |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1072 |
s nextPutLine:'<dd>no revision info'. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1073 |
] ifFalse:[ |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1074 |
|
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1075 |
revInfo isNil ifTrue:[revInfo := IdentityDictionary new]. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1076 |
pckgInfo isNil ifTrue:[pckgInfo := IdentityDictionary new]. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1077 |
|
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1078 |
s nextPutLine:'<dd>rev: <b>'. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1079 |
|
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1080 |
"/ fetch the revision-info; prefer revisionInfo |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1081 |
text := revInfo at:#revision ifAbsent:(pckgInfo at:#revision ifAbsent:'?'). |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1082 |
s nextPutLine:text. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1083 |
|
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1084 |
"/ fetch the date & time; prefer revisionInfo |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1085 |
text := revInfo at:#date ifAbsent:(pckgInfo at:#date ifAbsent:'?'). |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1086 |
s nextPutAll:'</b> date: <b>' , text. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1087 |
text := revInfo at:#time ifAbsent:(pckgInfo at:#time ifAbsent:'?'). |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1088 |
s nextPutLine:' ', text , '</b>'. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1089 |
|
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1090 |
text := revInfo at:#user ifAbsent:(pckgInfo at:#user ifAbsent:'?'). |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1091 |
s nextPutLine:'<dd>user: <b>' , text , '</b>'. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1092 |
|
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1093 |
text := revInfo at:#fileName ifAbsent:(pckgInfo at:#fileNamer ifAbsent:'?'). |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1094 |
s nextPutAll:'<dd>file: <b>' , text. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1095 |
|
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1096 |
text := revInfo at:#directory ifAbsent:(pckgInfo at:#directory ifAbsent:nil). |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1097 |
text isNil ifTrue:[ |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1098 |
path := revInfo at:#repositoryPathName ifAbsent:(pckgInfo at:#repositoryPathName ifAbsent:nil). |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1099 |
path notNil ifTrue:[ |
548
f5b7b050ce01
dont ask SourceCodeManager, if there is none
Claus Gittinger <cg@exept.de>
parents:
542
diff
changeset
|
1100 |
SourceCodeManager notNil ifTrue:[ |
f5b7b050ce01
dont ask SourceCodeManager, if there is none
Claus Gittinger <cg@exept.de>
parents:
542
diff
changeset
|
1101 |
text := SourceCodeManager directoryFromContainerPath:path. |
f5b7b050ce01
dont ask SourceCodeManager, if there is none
Claus Gittinger <cg@exept.de>
parents:
542
diff
changeset
|
1102 |
]. |
530
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1103 |
text isNil ifTrue:[text := '?']. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1104 |
] ifFalse:[ |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1105 |
text := '?' |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1106 |
] |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1107 |
]. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1108 |
s nextPutLine:'</b> directory: <b>' , text , '</b>'. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1109 |
|
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1110 |
text := revInfo at:#module ifAbsent:(pckgInfo at:#module ifAbsent:nil). |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1111 |
text isNil ifTrue:[ |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1112 |
path := revInfo at:#repositoryPathName ifAbsent:(pckgInfo at:#repositoryPathName ifAbsent:nil). |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1113 |
path notNil ifTrue:[ |
548
f5b7b050ce01
dont ask SourceCodeManager, if there is none
Claus Gittinger <cg@exept.de>
parents:
542
diff
changeset
|
1114 |
SourceCodeManager notNil ifTrue:[ |
f5b7b050ce01
dont ask SourceCodeManager, if there is none
Claus Gittinger <cg@exept.de>
parents:
542
diff
changeset
|
1115 |
text := SourceCodeManager moduleFromContainerPath:path. |
f5b7b050ce01
dont ask SourceCodeManager, if there is none
Claus Gittinger <cg@exept.de>
parents:
542
diff
changeset
|
1116 |
]. |
530
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1117 |
text isNil ifTrue:[text := '?']. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1118 |
] ifFalse:[ |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1119 |
text := '?' |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1120 |
] |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1121 |
]. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1122 |
s nextPutAll:'<dd>module: <b>' , text. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1123 |
|
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1124 |
text := revInfo at:#library ifAbsent:(pckgInfo at:#library ifAbsent:'*none*'). |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1125 |
s nextPutLine:'</b> stc-classLibrary: <b>' , text , '</b>'. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1126 |
]. |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1127 |
|
632 | 1128 |
"Created: / 8.1.1997 / 13:43:28 / cg" |
1129 |
"Modified: / 30.10.1997 / 13:24:39 / cg" |
|
530
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1130 |
! |
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1131 |
|
478 | 1132 |
htmlSelectorList |
632 | 1133 |
"generate an HTML string for all selectors (for which methods exist) |
1134 |
in the system" |
|
1135 |
||
478 | 1136 |
|selectors| |
1137 |
||
1138 |
selectors := IdentitySet new. |
|
1139 |
Smalltalk allClassesDo:[:cls | |
|
1140 |
selectors addAll:cls methodDictionary keys. |
|
1141 |
]. |
|
1142 |
selectors := selectors asOrderedCollection sort. |
|
1143 |
||
1144 |
^ self htmlSelectors:selectors title:('All selectors:'). |
|
1145 |
||
1146 |
" |
|
1147 |
self htmlSelectorList |
|
1148 |
" |
|
1149 |
||
632 | 1150 |
"Created: / 22.4.1996 / 20:03:31 / cg" |
1151 |
"Modified: / 5.6.1996 / 12:27:09 / stefan" |
|
1152 |
"Modified: / 30.10.1997 / 13:25:19 / cg" |
|
478 | 1153 |
! |
1154 |
||
1155 |
htmlSelectorListMatching:pattern |
|
632 | 1156 |
"generate an HTML string for all selectors which match a pattern |
1157 |
(and for which methods exist) in the system" |
|
1158 |
||
478 | 1159 |
|selectors| |
1160 |
||
1161 |
selectors := IdentitySet new. |
|
1162 |
Smalltalk allClassesDo:[:cls | |
|
1163 |
cls methodDictionary keysDo:[:sel | |
|
1164 |
(pattern match:sel) ifTrue:[ |
|
1165 |
selectors add:sel. |
|
1166 |
] |
|
1167 |
] |
|
1168 |
]. |
|
1169 |
selectors := selectors asOrderedCollection sort. |
|
1170 |
||
1171 |
^ self htmlSelectors:selectors title:('Selectors matching ''' , pattern , ''':'). |
|
1172 |
||
1173 |
" |
|
1174 |
self htmlSelectorListMatching:'*do*' |
|
1175 |
" |
|
1176 |
||
632 | 1177 |
"Created: / 22.4.1996 / 20:03:31 / cg" |
1178 |
"Modified: / 5.6.1996 / 12:29:27 / stefan" |
|
1179 |
"Modified: / 30.10.1997 / 13:25:50 / cg" |
|
478 | 1180 |
! |
1181 |
||
1182 |
htmlSelectorListPrefix:prefix |
|
632 | 1183 |
"generate an HTML string for all selectors whose names starts with |
1184 |
a prefix (and for which methods exist) in the system" |
|
1185 |
||
478 | 1186 |
|selectors| |
1187 |
||
1188 |
selectors := IdentitySet new. |
|
1189 |
Smalltalk allClassesDo:[:cls | |
|
1190 |
cls methodDictionary keysDo:[:sel | |
|
1191 |
(sel startsWith:prefix) ifTrue:[ |
|
1192 |
selectors add:sel. |
|
1193 |
] |
|
1194 |
] |
|
1195 |
]. |
|
1196 |
selectors := selectors asOrderedCollection sort. |
|
1197 |
||
1198 |
^ self htmlSelectors:selectors title:('Selectors starting with ''' , prefix asString , ''':'). |
|
1199 |
||
1200 |
" |
|
1201 |
self htmlSelectorListPrefix:'a' |
|
1202 |
" |
|
1203 |
||
632 | 1204 |
"Created: / 22.4.1996 / 20:03:31 / cg" |
1205 |
"Modified: / 5.6.1996 / 12:31:13 / stefan" |
|
1206 |
"Modified: / 30.10.1997 / 13:26:15 / cg" |
|
478 | 1207 |
! |
1208 |
||
1209 |
htmlSelectors:selectors title:title |
|
632 | 1210 |
"generate an HTML string for a given list of selectors" |
1211 |
||
492 | 1212 |
|s| |
478 | 1213 |
|
1214 |
s := '' writeStream. |
|
1215 |
||
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1216 |
s nextPutLine:'<html><head><title>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1217 |
s nextPutLine:title. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1218 |
s nextPutLine:'</title></head>'. |
478 | 1219 |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1220 |
s nextPutLine:'<body>'. |
632 | 1221 |
s nextPutLine:'<a NOPRINT HREF="TOP.html"> <IMG SRC="../icons/DocsUpArrow.gif" ALT="[back]"></A>'. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1222 |
s nextPutLine:'<hr>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1223 |
s nextPutAll:'<h1>'; nextPutAll:title; nextPutAll:'</h1>'. |
478 | 1224 |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1225 |
s nextPutLine:'<ul>'. |
478 | 1226 |
|
1227 |
selectors do:[:sel | |
|
1228 |
|nm| |
|
1229 |
||
1230 |
nm := (sel copy replChar:$< withString:'<') |
|
1231 |
replChar:$> withString:'>'. |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1232 |
s nextPutLine:'<li><a href="../misc/onlyInSTX2.html" action="html:',self name,' htmlDocOfImplementorsOf:''' , nm , '''">' , nm , '</A>' |
478 | 1233 |
]. |
1234 |
||
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1235 |
s nextPutLine:'</ul>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1236 |
s nextPutLine:'</body></html>'. |
478 | 1237 |
|
1238 |
^ s contents |
|
1239 |
||
632 | 1240 |
"Created: / 22.4.1996 / 20:03:31 / cg" |
1241 |
"Modified: / 30.10.1997 / 13:26:34 / cg" |
|
478 | 1242 |
! |
1243 |
||
1244 |
printOutHTMLCategoryProtocol:aCategory of:aClass on:aStream |
|
632 | 1245 |
"append documentation on each method in a particular methodCategory |
1246 |
of the given class in HTML onto aStream." |
|
1247 |
||
523 | 1248 |
|any dict selectors methods shortName| |
1249 |
||
1250 |
shortName := aClass nameWithoutPrefix. |
|
478 | 1251 |
|
1252 |
dict := aClass methodDictionary. |
|
1253 |
||
1254 |
dict notNil ifTrue:[ |
|
1255 |
any := false. |
|
1256 |
dict do:[:aMethod | |
|
1257 |
(aCategory = aMethod category) ifTrue:[ |
|
1258 |
any := true |
|
1259 |
] |
|
1260 |
]. |
|
1261 |
||
1262 |
any ifTrue:[ |
|
523 | 1263 |
aStream nextPutLine:'<a name="' , shortName , '_category_' , aCategory , |
1264 |
'" href="#I_' , shortName , '_category_' , aCategory , |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1265 |
'"><b>' , aCategory , '</b></A>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1266 |
aStream nextPutLine:'<dl>'. |
478 | 1267 |
|
1268 |
selectors := dict keys asArray. |
|
1269 |
methods := dict values. |
|
1270 |
selectors sortWith:methods. |
|
1271 |
methods do:[:aMethod | |
|
1272 |
(aCategory = aMethod category) ifTrue:[ |
|
1273 |
ErrorSignal catch:[ |
|
1274 |
self printOutHTMLMethodProtocol:aMethod on:aStream. |
|
1275 |
]. |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1276 |
aStream nextPutLine:'<p>'. |
478 | 1277 |
] |
1278 |
]. |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1279 |
aStream nextPutLine:'</dl>'. |
478 | 1280 |
] |
1281 |
] |
|
1282 |
||
1283 |
" |
|
1284 |
self printOutHTMLProtocolOf:Float on:Stdout |
|
1285 |
" |
|
1286 |
||
632 | 1287 |
"Created: / 22.4.1996 / 20:03:30 / cg" |
1288 |
"Modified: / 5.6.1996 / 13:41:27 / stefan" |
|
1289 |
"Modified: / 30.10.1997 / 13:27:58 / cg" |
|
478 | 1290 |
! |
1291 |
||
1292 |
printOutHTMLMethodProtocol:aMethod on:aStream |
|
1293 |
"given the source in aString, print the methods message specification |
|
1294 |
and any method comments - without source; used to generate documentation |
|
1295 |
pages" |
|
1296 |
||
1297 |
^ self printOutHTMLMethodProtocol:aMethod on:aStream showClassName:false classRef:false |
|
1298 |
||
1299 |
"Modified: 22.4.1996 / 18:01:56 / cg" |
|
1300 |
"Created: 22.4.1996 / 20:03:30 / cg" |
|
1301 |
! |
|
1302 |
||
1303 |
printOutHTMLMethodProtocol:aMethod on:aStream showClassName:showClassName classRef:withClassRef |
|
1304 |
"given the source in aString, print the methods message specification |
|
1305 |
and any method comments - without source; used to generate documentation |
|
1306 |
pages" |
|
1307 |
||
492 | 1308 |
|comment cls sel partStream args argStream who methodSpecLine first |
478 | 1309 |
firstIndent firstNonEmpty isSubres isObsolete smallOrEmpty |
1310 |
ballColor| |
|
1311 |
||
1312 |
who := aMethod who. |
|
505
d8d7556d05ee
use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1313 |
cls := who methodClass. |
d8d7556d05ee
use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1314 |
sel := who methodSelector. |
478 | 1315 |
partStream := sel keywords readStream. |
1316 |
||
1317 |
(args := aMethod methodArgNames) notNil ifTrue:[ |
|
1318 |
argStream := aMethod methodArgNames readStream. |
|
1319 |
||
1320 |
methodSpecLine := ''. first := true. |
|
1321 |
1 to:sel numArgs do:[:index | |
|
1322 |
first ifTrue:[ |
|
1323 |
first := false. |
|
1324 |
] ifFalse:[ |
|
1325 |
methodSpecLine := methodSpecLine , ' ' |
|
1326 |
]. |
|
1327 |
methodSpecLine := methodSpecLine , '<B>' , partStream next , '</B>'. |
|
1328 |
methodSpecLine := methodSpecLine , ' <I>' , argStream next , '</I>'. |
|
1329 |
]. |
|
1330 |
] ifFalse:[ |
|
1331 |
methodSpecLine := '<B>' , partStream next , '</B>' |
|
1332 |
]. |
|
1333 |
||
632 | 1334 |
"/ use string-asSymbol (instead of the obvious symbol itself) |
1335 |
"/ in the checks below, to avoid tricking myself, |
|
1336 |
"/ when the documentation on this method is generated |
|
1337 |
"/ (otherwise, I'll say that this method is both |
|
1338 |
"/ a subres and and obsolete method ...) |
|
1339 |
||
1340 |
isSubres := (aMethod sends:'subclassResponsibility' asSymbol). |
|
478 | 1341 |
|
1342 |
isObsolete := false. |
|
632 | 1343 |
((aMethod sends:'obsoleteMethodWarning' asSymbol) |
1344 |
or:[(aMethod sends:'obsoleteMethodWarning:' asSymbol) |
|
1345 |
or:[(aMethod sends:'obsoleteMethodWarning:from:' asSymbol)]]) ifTrue:[ |
|
478 | 1346 |
cls ~~ Object ifTrue:[ |
1347 |
isObsolete := true |
|
1348 |
] |
|
1349 |
]. |
|
1350 |
||
1351 |
smallOrEmpty := ''. |
|
1352 |
aMethod isPrivate ifTrue:[ |
|
1353 |
methodSpecLine := '<i>private</I> ' , methodSpecLine. |
|
1354 |
"/ smallOrEmpty := '-small'. |
|
1355 |
] ifFalse:[ |
|
1356 |
aMethod isProtected ifTrue:[ |
|
1357 |
methodSpecLine := '<i>protected</I> ' , methodSpecLine. |
|
1358 |
"/ smallOrEmpty := '-small'. |
|
1359 |
] ifFalse:[ |
|
1360 |
aMethod isIgnored ifTrue:[ |
|
1361 |
methodSpecLine := '[ ' , methodSpecLine , ' ] (<i>invisible</I>)'. |
|
1362 |
"/ smallOrEmpty := '-small'. |
|
1363 |
] |
|
1364 |
] |
|
1365 |
]. |
|
1366 |
||
632 | 1367 |
aStream nextPutLine:'<DT>'. |
478 | 1368 |
|
1369 |
||
1370 |
cls isMeta ifTrue:[ |
|
1371 |
ballColor := 'yellow' |
|
1372 |
] ifFalse:[ |
|
1373 |
ballColor := 'red' |
|
1374 |
]. |
|
1375 |
||
632 | 1376 |
aStream nextPutLine:'<IMG src="pictures/' , ballColor , '-ball' , smallOrEmpty , '.gif" alt="o " width=6 height=6>'. |
478 | 1377 |
|
1378 |
sel := (sel copy |
|
1379 |
replChar:$< withString:'<') |
|
1380 |
replChar:$> withString:'>'. |
|
1381 |
||
1382 |
withClassRef ifTrue:[ |
|
632 | 1383 |
aStream nextPutLine:'<A name="' , cls name , '_' , sel , |
478 | 1384 |
'" href="../misc/onlyInSTX2.html" action="html:',self name,' htmlDocOf:' , cls name , |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1385 |
'">' , cls name , '</a> ' , methodSpecLine. |
478 | 1386 |
] ifFalse:[ |
1387 |
showClassName ifTrue:[ |
|
1388 |
methodSpecLine := cls name , ' ' , methodSpecLine |
|
1389 |
]. |
|
1390 |
||
632 | 1391 |
aStream nextPutLine:'<A name="' , cls name , '_' , sel , |
478 | 1392 |
"/ '" href="' , cls name , '_' , sel , '"' , |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1393 |
'>' , methodSpecLine , '</a>'. |
478 | 1394 |
]. |
632 | 1395 |
aStream nextPutLine:'<DD>'. |
478 | 1396 |
|
1397 |
(comment := aMethod comment) notNil ifTrue:[ |
|
1398 |
comment := (comment copy |
|
1399 |
replChar:$< withString:'<') |
|
1400 |
replChar:$> withString:'>'. |
|
1401 |
||
1402 |
comment notEmpty ifTrue:[ |
|
1403 |
comment := comment asStringCollection. |
|
1404 |
firstIndent := comment first leftIndent. |
|
1405 |
firstIndent > 0 ifTrue:[ |
|
1406 |
comment := comment collect:[:line | |
|
1407 |
line leftIndent >= firstIndent ifTrue:[ |
|
1408 |
line copyFrom:firstIndent. |
|
1409 |
] ifFalse:[ |
|
1410 |
line |
|
1411 |
] |
|
1412 |
]. |
|
1413 |
]. |
|
1414 |
firstNonEmpty := comment findFirst:[:line | line notEmpty]. |
|
1415 |
firstNonEmpty > 1 ifTrue:[ |
|
1416 |
comment := comment copyFrom:firstNonEmpty |
|
1417 |
]. |
|
1418 |
comment := comment asString. |
|
1419 |
]. |
|
1420 |
||
1421 |
comment asStringCollection do:[:line | |
|
632 | 1422 |
aStream nextPutAll:line; nextPutLine:'<BR>'. |
478 | 1423 |
]. |
1424 |
]. |
|
1425 |
||
1426 |
isSubres ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1427 |
aStream nextPutLine:'<BR>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1428 |
aStream nextPutLine:'<I>** This method raises an error - it must be redefined in concrete classes **</I>'. |
478 | 1429 |
]. |
1430 |
isObsolete ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1431 |
aStream nextPutLine:'<BR>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1432 |
aStream nextPutLine:'<I>** This is an obsolete interface - do not use it (it may vanish in future versions) **</I>'. |
478 | 1433 |
]. |
1434 |
||
632 | 1435 |
"Created: / 22.4.1996 / 20:03:30 / cg" |
1436 |
"Modified: / 30.10.1997 / 13:09:45 / cg" |
|
478 | 1437 |
! |
1438 |
||
1439 |
printOutHTMLProtocolOf:aClass on:aStream |
|
632 | 1440 |
"append documentation of the given class in HTML onto aStream." |
1441 |
||
478 | 1442 |
|collectionOfCategories any| |
1443 |
||
1444 |
"/ self printOutDefinitionOn:aPrintStream. |
|
1445 |
||
1446 |
collectionOfCategories := aClass class categories. |
|
1447 |
any := false. |
|
523 | 1448 |
|
1449 |
collectionOfCategories size > 0 ifTrue:[ |
|
1450 |
collectionOfCategories := collectionOfCategories asOrderedCollection. |
|
1451 |
collectionOfCategories remove:'documentation' ifAbsent:[]. |
|
1452 |
collectionOfCategories size > 0 ifTrue:[ |
|
1453 |
collectionOfCategories sort. |
|
1454 |
aStream nextPutLine:'<h2><a name="CLASSPROTOCOL" href="#I_CLASSPROTOCOL">Class protocol:</A></h2>'. |
|
1455 |
collectionOfCategories do:[:aCategory | |
|
478 | 1456 |
self printOutHTMLCategoryProtocol:aCategory of:aClass class on:aStream. |
1457 |
any := true. |
|
523 | 1458 |
]. |
478 | 1459 |
"/ any ifFalse:[ |
1460 |
"/ aStream nextPutAll:'no new protocol' |
|
1461 |
"/ ]. |
|
523 | 1462 |
aStream nextPutLine:'<hr>'. |
1463 |
] |
|
478 | 1464 |
]. |
1465 |
||
1466 |
||
1467 |
collectionOfCategories := aClass categories. |
|
1468 |
any := false. |
|
523 | 1469 |
collectionOfCategories size > 0 ifTrue:[ |
478 | 1470 |
collectionOfCategories := collectionOfCategories asOrderedCollection sort. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1471 |
aStream nextPutLine:'<h2><a name="INSTANCEPROTOCOL" href="#I_INSTANCEPROTOCOL">Instance protocol:</A></h2>'. |
478 | 1472 |
collectionOfCategories do:[:aCategory | |
1473 |
self printOutHTMLCategoryProtocol:aCategory of:aClass on:aStream |
|
1474 |
]. |
|
1475 |
"/ any ifFalse:[ |
|
1476 |
"/ aStream nextPutAll:'no new protocol' |
|
1477 |
"/ ]. |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1478 |
aStream nextPutLine:'<hr>'. |
478 | 1479 |
] |
1480 |
||
1481 |
" |
|
1482 |
self printOutHTMLProtocolOf:Float on:Stdout |
|
1483 |
" |
|
1484 |
||
632 | 1485 |
"Created: / 22.4.1996 / 20:03:30 / cg" |
1486 |
"Modified: / 30.10.1997 / 13:28:20 / cg" |
|
478 | 1487 |
! ! |
1488 |
||
575 | 1489 |
!HTMLDocGenerator class methodsFor:'format conversion - man pages'! |
1490 |
||
1491 |
manPageFor:aCommand |
|
632 | 1492 |
"generate a (unix-) man page for a given command & convert the output to html" |
575 | 1493 |
|
1494 |
^ self |
|
1495 |
manPageFor:aCommand |
|
1496 |
inSection:nil |
|
1497 |
||
632 | 1498 |
"Modified: / 30.10.1997 / 13:29:31 / cg" |
575 | 1499 |
! |
1500 |
||
1501 |
manPageFor:aCommand inSection:sectionOrNil |
|
632 | 1502 |
"generate a (unix-) man page for some entry in a section |
575 | 1503 |
& convert the output to html" |
1504 |
||
1505 |
|manCmd| |
|
1506 |
||
1507 |
sectionOrNil isNil ifTrue:[ |
|
1508 |
manCmd := 'man ' , aCommand |
|
1509 |
] ifFalse:[ |
|
1510 |
manCmd := 'man ' , sectionOrNil printString , ' ' , aCommand |
|
1511 |
]. |
|
1512 |
^ self |
|
1513 |
manPageFor:aCommand |
|
1514 |
manCommand:manCmd. |
|
1515 |
||
632 | 1516 |
"Created: / 9.9.1996 / 17:45:08 / cg" |
1517 |
"Modified: / 30.10.1997 / 13:29:44 / cg" |
|
575 | 1518 |
! |
1519 |
||
1520 |
manPageFor:aCommand manCommand:manCommand |
|
577 | 1521 |
"convert man-command output to html. |
632 | 1522 |
Only the body of the text (without head../head and body../body) is generated" |
575 | 1523 |
|
1524 |
|s t outStream state ch keep| |
|
1525 |
||
1526 |
s := PipeStream readingFrom:manCommand. |
|
1527 |
s notNil ifTrue:[ |
|
1528 |
outStream := '' writeStream. |
|
1529 |
state := nil. |
|
1530 |
keep := nil. |
|
1531 |
[s atEnd] whileFalse:[ |
|
1532 |
ch := s next. |
|
1533 |
||
1534 |
ch notNil ifTrue:[ |
|
1535 |
state == nil ifTrue:[ |
|
1536 |
ch == Character backspace ifTrue:[ |
|
1537 |
state := #back |
|
1538 |
] ifFalse:[ |
|
1539 |
keep notNil ifTrue:[ |
|
1540 |
keep == $< ifTrue:[ |
|
1541 |
outStream nextPutAll:'<'. |
|
1542 |
] ifFalse:[ |
|
1543 |
outStream nextPut:keep. |
|
1544 |
]. |
|
1545 |
]. |
|
1546 |
keep := ch |
|
1547 |
] |
|
1548 |
] ifFalse:[ |
|
1549 |
state == #back ifTrue:[ |
|
1550 |
ch == keep ifTrue:[ |
|
1551 |
outStream nextPutAll:'<b>'. |
|
1552 |
ch == $< ifTrue:[ |
|
1553 |
outStream nextPutAll:'<'. |
|
1554 |
] ifFalse:[ |
|
1555 |
outStream nextPut:ch. |
|
1556 |
]. |
|
1557 |
outStream nextPutAll:'</b>'. |
|
1558 |
state := nil. |
|
1559 |
keep := nil. |
|
1560 |
] ifFalse:[ |
|
1561 |
ch == $_ ifTrue:[ |
|
1562 |
keep notNil ifTrue:[ |
|
1563 |
outStream nextPutAll:'<i>'. |
|
1564 |
keep == $< ifTrue:[ |
|
1565 |
outStream nextPutAll:'<'. |
|
1566 |
] ifFalse:[ |
|
1567 |
outStream nextPut:keep. |
|
1568 |
]. |
|
1569 |
outStream nextPutAll:'</i>'. |
|
1570 |
]. |
|
1571 |
state := nil. |
|
1572 |
keep := nil. |
|
1573 |
] ifFalse:[ |
|
1574 |
keep == $_ ifTrue:[ |
|
1575 |
outStream nextPutAll:'<i>'. |
|
1576 |
ch == $< ifTrue:[ |
|
1577 |
outStream nextPutAll:'<'. |
|
1578 |
] ifFalse:[ |
|
1579 |
outStream nextPut:ch. |
|
1580 |
]. |
|
1581 |
outStream nextPutAll:'</i>'. |
|
1582 |
state := nil. |
|
1583 |
keep := nil. |
|
1584 |
] ifFalse:[ |
|
1585 |
keep notNil ifTrue:[ |
|
1586 |
keep == $< ifTrue:[ |
|
1587 |
outStream nextPutAll:'<'. |
|
1588 |
] ifFalse:[ |
|
1589 |
outStream nextPut:keep. |
|
1590 |
]. |
|
1591 |
ch == $< ifTrue:[ |
|
1592 |
outStream nextPutAll:'<'. |
|
1593 |
] ifFalse:[ |
|
1594 |
outStream nextPut:ch. |
|
1595 |
] |
|
1596 |
]. |
|
1597 |
state := nil. |
|
1598 |
keep := nil. |
|
1599 |
] |
|
1600 |
] |
|
1601 |
] |
|
1602 |
] |
|
1603 |
] |
|
1604 |
] |
|
1605 |
]. |
|
1606 |
||
1607 |
keep notNil ifTrue:[ |
|
1608 |
keep == $< ifTrue:[ |
|
1609 |
outStream nextPutAll:'<'. |
|
1610 |
] ifFalse:[ |
|
1611 |
outStream nextPut:keep |
|
1612 |
] |
|
1613 |
]. |
|
1614 |
t := outStream contents. |
|
1615 |
s shutDown. |
|
1616 |
]. |
|
1617 |
||
1618 |
(t isNil or:[t isEmpty]) ifTrue:[ |
|
1619 |
^ ' |
|
1620 |
No manual page for "<CODE><B>' , aCommand , '</B></CODE>" available. |
|
1621 |
<BR> |
|
1622 |
(the failed command was: "<CODE>' , manCommand , '"</CODE>.) |
|
1623 |
'. |
|
1624 |
]. |
|
1625 |
||
1626 |
^ ' |
|
1627 |
<pre> |
|
1628 |
' , t , ' |
|
1629 |
</pre> |
|
1630 |
' |
|
1631 |
||
1632 |
" |
|
1633 |
self manPageFor:'cvs' |
|
1634 |
" |
|
1635 |
||
632 | 1636 |
"Modified: / 28.6.1996 / 21:28:47 / stefan" |
1637 |
"Created: / 9.9.1996 / 17:43:16 / cg" |
|
1638 |
"Modified: / 30.10.1997 / 13:30:22 / cg" |
|
575 | 1639 |
! |
1640 |
||
1641 |
manPageForFile:aFilename |
|
1642 |
"convert a .man file to html" |
|
1643 |
||
1644 |
^ self |
|
1645 |
manPageFor:aFilename asFilename name |
|
1646 |
manCommand:('nroff -man ' , aFilename asFilename pathName). |
|
1647 |
||
1648 |
" |
|
1649 |
self manPageForFile:'../../stc/stc.1' |
|
1650 |
" |
|
1651 |
" |
|
1652 |
HTMLDocumentView openFullOnText:(self manPageForFile:'../../stc/stc.1') |
|
1653 |
" |
|
1654 |
||
1655 |
"Modified: 4.4.1997 / 10:44:05 / cg" |
|
1656 |
! ! |
|
1657 |
||
498 | 1658 |
!HTMLDocGenerator class methodsFor:'helpers'! |
478 | 1659 |
|
1660 |
extractSpecial:pattern from:docu |
|
1661 |
"given a collection of docu lines (from documentation methods comment), |
|
1662 |
extract things like [see also:], [author:] etc. |
|
1663 |
If found, remove the lines from the string collection, |
|
1664 |
and return the extracted ones. Otherwise return nil." |
|
1665 |
||
1666 |
|srchIdx idx lines l| |
|
1667 |
||
1668 |
srchIdx := docu findFirst:[:l | l asLowercase withoutSeparators = pattern]. |
|
1669 |
srchIdx ~~ 0 ifTrue:[ |
|
1670 |
lines := OrderedCollection new. |
|
1671 |
||
1672 |
idx := srchIdx+1. |
|
1673 |
[idx <= docu size] whileTrue:[ |
|
1674 |
l := docu at:idx. |
|
1675 |
(l isNil or:[l withoutSeparators size == 0]) ifTrue:[ |
|
1676 |
idx := docu size + 1. |
|
1677 |
] ifFalse:[ |
|
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1678 |
l withoutSeparators = '\' ifTrue:[ |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1679 |
l := '' |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1680 |
]. |
478 | 1681 |
lines add:l |
1682 |
]. |
|
1683 |
idx := idx + 1. |
|
1684 |
]. |
|
1685 |
||
1686 |
docu removeFromIndex:srchIdx toIndex:srchIdx+lines size |
|
1687 |
]. |
|
1688 |
^ lines |
|
1689 |
||
1690 |
"Created: 25.4.1996 / 14:16:01 / cg" |
|
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1691 |
"Modified: 11.1.1997 / 13:03:38 / cg" |
478 | 1692 |
! ! |
1693 |
||
498 | 1694 |
!HTMLDocGenerator class methodsFor:'documentation'! |
478 | 1695 |
|
1696 |
version |
|
637 | 1697 |
^ '$Header: /cvs/stx/stx/libbasic3/HTMLDocGenerator.st,v 1.24 1997-12-18 10:47:18 cg Exp $' |
478 | 1698 |
! ! |