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