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