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