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