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