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