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