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