author | Claus Gittinger <cg@exept.de> |
Sun, 01 Dec 2019 05:23:25 +0100 | |
changeset 4518 | 1e1874f7a287 |
parent 4511 | 0b19a84bbea2 |
child 4520 | f7e5c7641306 |
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 |
||
1258
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
721 |
|inExample| |
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 |
|
1258
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
727 |
examples do:[:line | |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
728 |
line withoutSeparators = '[exBegin]' ifTrue:[ |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
729 |
inExample ifTrue:[ |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
730 |
self generateExampleEnd. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
731 |
]. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
732 |
self generateExampleStart. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
733 |
inExample := true. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
734 |
] ifFalse:[ |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
735 |
line withoutSeparators = '[exEnd]' ifTrue:[ |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
736 |
inExample ifTrue:[ |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
737 |
self generateExampleEnd. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
738 |
]. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
739 |
inExample := false. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
740 |
] ifFalse:[ |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
741 |
outStream nextPutLine:line |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
742 |
] |
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 |
]. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
745 |
inExample ifTrue:[ |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
746 |
self generateExampleEnd. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
747 |
]. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
748 |
self generateHorizontalLine. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
749 |
! |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
750 |
|
2016 | 751 |
generateInheritanceTreeForClass:aClass |
752 |
|indent first supers subs| |
|
753 |
||
754 |
supers := aClass allSuperclasses. |
|
755 |
(aClass == Autoload or:[aClass == Object]) ifTrue:[ |
|
756 |
subs := #() |
|
757 |
] ifFalse:[ |
|
758 |
subs := self shownSubclassesOf:aClass. |
|
759 |
]. |
|
760 |
||
761 |
outStream nextPutLine:'<h2><a name="INHERITANCE" href="#I_INHERITANCE">Inheritance:</A></h2>'. |
|
762 |
outStream nextPutLine:'<pre>'. |
|
763 |
indent := 3. |
|
764 |
first := true. |
|
4404 | 765 |
(supers size ~~ 0) ifTrue:[ |
2016 | 766 |
supers reverseDo:[:cls | |
767 |
|className| |
|
768 |
||
769 |
className := cls name. |
|
770 |
first ifFalse:[ |
|
771 |
outStream spaces:indent; nextPutLine:'|'. |
|
772 |
outStream spaces:indent; nextPutAll:'+--'. |
|
773 |
indent := indent + 3. |
|
774 |
] ifTrue:[ |
|
775 |
outStream spaces:indent |
|
1312
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
776 |
]. |
2016 | 777 |
first := false. |
778 |
||
779 |
self generateClassDocReferenceFor:className. |
|
780 |
outStream cr. |
|
781 |
]. |
|
782 |
outStream spaces:indent; nextPutLine:'|'. |
|
783 |
outStream spaces:indent. |
|
784 |
outStream nextPutAll:'+--<B>'; nextPutAll:aClass name; nextPutLine:'</B>'. |
|
785 |
indent := indent + 3. |
|
786 |
] ifFalse:[ |
|
787 |
outStream spaces:indent; nextPutLine:'nil'. |
|
788 |
outStream spaces:indent; nextPutLine:'|'. |
|
789 |
outStream spaces:indent; nextPutAll:'+--<B>'; nextPutAll:aClass name; nextPutLine:'</B>'. |
|
790 |
aClass ~~ Object ifTrue:[ |
|
791 |
outStream cr. |
|
792 |
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
|
793 |
]. |
2016 | 794 |
indent := indent + 3. |
795 |
]. |
|
796 |
||
797 |
subs notEmpty ifTrue:[ |
|
798 |
subs do:[:aSubclass | |
|
799 |
|className| |
|
800 |
||
801 |
className := aSubclass name. |
|
802 |
outStream spaces:indent; nextPutLine:'|'. |
|
803 |
outStream spaces:indent; nextPutAll:'+--'. |
|
804 |
self generateClassDocReferenceFor:className. |
|
805 |
outStream cr. |
|
806 |
] |
|
807 |
] ifFalse:[ |
|
808 |
aClass == Object ifTrue:[ |
|
809 |
outStream spaces:indent; nextPutLine:'|'. |
|
810 |
outStream spaces:indent; nextPutLine:'+-- ... almost every other class ...' |
|
811 |
] |
|
812 |
]. |
|
813 |
||
814 |
outStream nextPutLine:'</pre>'. |
|
4404 | 815 |
|
816 |
"Modified: / 01-03-2019 / 15:52:20 / Claus Gittinger" |
|
1312
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
817 |
! |
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
818 |
|
2016 | 819 |
generateInstanceProtocolDocumentationForClass:aClass |
820 |
|shortName| |
|
821 |
||
822 |
shortName := aClass nameWithoutPrefix. |
|
823 |
instanceProtocolCategories notEmpty ifTrue:[ |
|
824 |
outStream nextPutLine:'<li><a href="#INSTANCEPROTOCOL" name="I_INSTANCEPROTOCOL">Instance protocol</a>'. |
|
825 |
outStream nextPutLine:'<ul>'. |
|
826 |
instanceProtocolCategories do:[:cat | |
|
827 |
outStream nextPutLine:'<li><a name="I_' , shortName , '_category_' , cat , '"' , |
|
828 |
' href="#' , shortName , '_category_' , cat , |
|
829 |
'">' , cat , '</a> '. |
|
830 |
]. |
|
831 |
outStream nextPutLine:'</ul>'. |
|
832 |
]. |
|
833 |
! |
|
834 |
||
835 |
generatePrivateClassInfoForClass:aClass withPrivateClasses:privateClasses |
|
836 |
outStream nextPutLine:'<pre>'. |
|
837 |
privateClasses do:[:cls | |
|
838 |
|nm fullName| |
|
839 |
||
840 |
nm := cls nameWithoutPrefix. |
|
841 |
fullName := cls name. |
|
842 |
outStream nextPutAll:' '. |
|
843 |
(cls owningClass isLoaded not |
|
844 |
or:[cls owningClass wasAutoloaded]) ifTrue:[ |
|
845 |
self |
|
846 |
generateClassDocReferenceFor:fullName |
|
847 |
text:nm |
|
848 |
autoloading:(cls owningClass name) |
|
849 |
] ifFalse:[ |
|
850 |
self |
|
851 |
generateClassDocReferenceFor:fullName |
|
852 |
text:nm. |
|
853 |
]. |
|
854 |
outStream cr. |
|
855 |
]. |
|
856 |
outStream nextPutLine:'</pre>'. |
|
857 |
! |
|
858 |
||
859 |
generateRefLineFor:ref forClass:aClass |
|
4469 | 860 |
|idx1 idx2 realRef ns nm href selString clsName| |
1337
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
861 |
|
2016 | 862 |
outStream nextPutAll:' '. |
1337
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
863 |
|
4469 | 864 |
(ref startsWith:'#') ifTrue:[ |
865 |
idx2 := (ref indexOfSeparatorStartingAt:2). |
|
866 |
idx2 == 0 ifTrue:[idx2 := ref size] ifFalse:[idx2 := idx2-1]. |
|
867 |
selString := ref copyFrom:2 to:idx2. |
|
868 |
(idx1 := ref indexOfString:'method in ' caseSensitive:false) ~~ 0 ifTrue:[ |
|
869 |
clsName := ref copyFrom:idx1 + 'method in ' size. |
|
870 |
clsName := clsName withoutSuffix:'.'. |
|
871 |
]. |
|
872 |
self generateClassDocReferenceFor:clsName |
|
873 |
text:('Implementation of: ',selString, ' in ',clsName) |
|
874 |
autoloading:nil. |
|
875 |
^ self |
|
876 |
]. |
|
877 |
||
1337
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
878 |
idx1 := ref indexOf:$:. |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
879 |
idx2 := ref indexOf:$: startingAt:idx1+1. |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
880 |
|
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
881 |
(idx1 == 0 or:[idx2 == (idx1+1)]) ifTrue:[ |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
882 |
(ref includesMatchCharacters) ifTrue:[ |
2016 | 883 |
outStream nextPutAll:(self |
1337
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
884 |
anchorForHTMLDocAction: |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
885 |
('htmlClassesMatching:''' , ref , ''' backTo:nil') |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
886 |
info: |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
887 |
( 'Show documentation of ' , ref ) |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
888 |
text: |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
889 |
ref). |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
890 |
^ self |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
891 |
]. |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
892 |
|
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
893 |
realRef := ref. |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
894 |
((ns := aClass nameSpace) notNil and:[ns ~~ Smalltalk]) ifTrue:[ |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
895 |
ns isNameSpace ifTrue:[ |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
896 |
(ns at:realRef asSymbol) notNil ifTrue:[ |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
897 |
realRef := ns name , '::' , realRef |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
898 |
] |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
899 |
] |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
900 |
]. |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
901 |
self generateClassDocReferenceFor:realRef text:ref. |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
902 |
^ self |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
903 |
]. |
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 |
(ref startsWith:'http:') ifTrue:[ |
2016 | 906 |
outStream nextPutAll:'<a href="' , ref , '"><I>' , ref , '</I></a>'. |
1337
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
907 |
^ self. |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
908 |
]. |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
909 |
|
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
910 |
nm := (ref copyFrom:2 to:idx1-1) withoutSpaces. |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
911 |
href := (ref copyFrom:(ref indexOf:$:)+1 to:(ref size - 1)) withoutSpaces. |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
912 |
(href startsWith:'man:') ifTrue:[ |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
913 |
href := (href copyFrom:5) withoutSpaces. |
4450 | 914 |
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
|
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 |
(href startsWith:'http:') ifTrue:[ |
2016 | 918 |
outStream nextPutAll:'<a href="' , href , '">[<I>' , nm , '</I>]</a>'. |
1337
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
919 |
^ self |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
920 |
]. |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
921 |
(href startsWith:'html:') ifTrue:[ |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
922 |
href := (href copyFrom:6) withoutSpaces. |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
923 |
]. |
2016 | 924 |
outStream nextPutAll:'<a href="' , (self pathToDocumentationFile:href) , '">[<I>' , nm , '</I>]</a>'. |
4450 | 925 |
|
926 |
"Modified: / 28-06-2019 / 09:01:50 / Claus Gittinger" |
|
1337
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
927 |
! |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
928 |
|
2016 | 929 |
generateRefLines:refLines forClass:aClass |
930 |
outStream nextPutLine:'<pre>'. |
|
1312
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
931 |
refLines do:[:l | |
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
932 |
l isString ifTrue:[ |
2016 | 933 |
self generateRefLineFor:l forClass:aClass. |
934 |
outStream cr. |
|
1312
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
935 |
] ifFalse:[ |
4469 | 936 |
(l asString startsWith:'#') ifTrue:[ |
937 |
self generateRefLineFor:(l asStringWith:' ') forClass:aClass. |
|
2016 | 938 |
outStream cr. |
4469 | 939 |
] ifFalse:[ |
940 |
l do:[:ref | |
|
941 |
self generateRefLineFor:ref forClass:aClass. |
|
942 |
outStream cr. |
|
943 |
]. |
|
1312
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
944 |
]. |
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
945 |
]. |
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
946 |
]. |
2016 | 947 |
outStream nextPutLine:'</pre>'. |
1312
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
948 |
! |
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
949 |
|
2016 | 950 |
generateSubclassInfoForClass:aClass |
951 |
|subs| |
|
1312
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
952 |
|
1974 | 953 |
subs := self shownSubclassesOf:aClass. |
1312
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
954 |
|
2016 | 955 |
outStream nextPutLine:'<pre>'. |
1312
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
956 |
subs do:[:cls | |
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
957 |
|nm| |
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 |
nm := cls name. |
2016 | 960 |
outStream nextPutAll:' '. |
1312
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
961 |
cls isLoaded ifFalse:[ |
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
962 |
self |
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
963 |
generateClassDocReferenceFor:nm |
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
964 |
text:nm |
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
965 |
autoloading:nm |
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
966 |
] ifTrue:[ |
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
967 |
self generateClassDocReferenceFor:nm. |
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
968 |
]. |
2016 | 969 |
outStream cr. |
1312
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
970 |
]. |
2016 | 971 |
outStream nextPutLine:'</pre>'. |
1973 | 972 |
|
1974 | 973 |
"Modified: / 05-11-2007 / 17:22:43 / cg" |
3643 | 974 |
! ! |
975 |
||
976 |
!HTMLDocGenerator methodsFor:'document generation-API'! |
|
1312
88d8f1ea1645
fields / urlParameters vs. arguments
Claus Gittinger <cg@exept.de>
parents:
1311
diff
changeset
|
977 |
|
478 | 978 |
htmlDocOf:aClass |
632 | 979 |
"generate an HTML document string which contains a classes documentation" |
980 |
||
4002 | 981 |
^ self htmlDocOf:aClass theNonMetaclass back:nil backRef:nil |
478 | 982 |
|
983 |
" |
|
984 |
self htmlDocOf:PostscriptPrinterStream |
|
985 |
" |
|
986 |
||
632 | 987 |
"Modified: / 30.10.1997 / 13:22:19 / cg" |
478 | 988 |
! |
989 |
||
990 |
htmlDocOf:aClass back:backCmd |
|
632 | 991 |
"generate an HTML document string which contains a classes documentation" |
992 |
||
478 | 993 |
^ self htmlDocOf:aClass back:backCmd backRef:nil |
994 |
||
632 | 995 |
"Modified: / 30.10.1997 / 13:22:27 / cg" |
478 | 996 |
! |
997 |
||
998 |
htmlDocOf:aClass back:backCmd backRef:backRef |
|
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
999 |
"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
|
1000 |
to a command or document. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1001 |
|
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1002 |
Extract sections from the classes documentation method, |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1003 |
where the following lines start a special subsection: |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1004 |
[see also:] - references to other classes and/or documents |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1005 |
[start with:] - one-liners to start a demonstration |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1006 |
[author:] - author(s) of this class |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1007 |
[warning:] - usage warnings if any |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1008 |
[hints:] - usage hints if any |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1009 |
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
|
1010 |
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
|
1011 |
to an empty line. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1012 |
|
632 | 1013 |
Also extract examples from the classes example method, |
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1014 |
where executable examples are made from sections enclosed in: |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1015 |
[exBegin] |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1016 |
... |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1017 |
[exEnd] |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1018 |
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
|
1019 |
everything else is plain documentation text. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1020 |
" |
907
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1021 |
|
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1022 |
^ self |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1023 |
htmlDocOf:aClass |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1024 |
back:backCmd |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1025 |
backRef:backRef |
1255 | 1026 |
imagePath:(self pathToTopOfDocumentation , '/icons') |
907
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1027 |
! |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1028 |
|
1328 | 1029 |
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
|
1030 |
"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
|
1031 |
to a command or document. |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1032 |
|
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1033 |
Extract sections from the classes documentation method, |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1034 |
where the following lines start a special subsection: |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1035 |
[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
|
1036 |
[start with:] - one-liners to start a demonstration |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1037 |
[author:] - author(s) of this class |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1038 |
[warning:] - usage warnings if any |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1039 |
[hints:] - usage hints if any |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1040 |
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
|
1041 |
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
|
1042 |
to an empty line. |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1043 |
|
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1044 |
Also extract examples from the classes example method, |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1045 |
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
|
1046 |
[exBegin] |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1047 |
... |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1048 |
[exEnd] |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1049 |
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
|
1050 |
everything else is plain documentation text. |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1051 |
" |
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1052 |
|
2016 | 1053 |
|docu examples wasLoaded didLoadBin |
3643 | 1054 |
privateClasses owner ownerName shortName | |
478 | 1055 |
|
1328 | 1056 |
backRef := backRefArg. |
1057 |
backCmd := backCmdArg. |
|
1058 |
imagePath := imagePathArg. |
|
1059 |
||
600 | 1060 |
aClass isNil ifTrue:[ |
1061 |
^ '' "/ just in case ... |
|
1062 |
]. |
|
1063 |
||
2016 | 1064 |
outStream := '' writeStream. |
1328 | 1065 |
shortName := aClass nameWithoutPrefix. |
2016 | 1066 |
|
1067 |
self generateHTMLHeadWithTitle:('Class: ' , aClass name). |
|
1328 | 1068 |
self generateBODYStart. |
1069 |
self generateBackButton. |
|
1070 |
||
1896
ed785b09f5b1
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
1435
diff
changeset
|
1071 |
(aClass isRealNameSpace) ifTrue:[ |
2016 | 1072 |
outStream |
1073 |
nextPutLine:'<h1>'; |
|
1074 |
nextPutAll:'NameSpace: '; |
|
1075 |
nextPutLine:(shortName); |
|
1076 |
nextPutLine:'</h1>'. |
|
1328 | 1077 |
self generateBODYandHTMLEnd. |
2016 | 1078 |
^ outStream contents. |
1328 | 1079 |
]. |
1080 |
||
478 | 1081 |
(wasLoaded := aClass isLoaded) ifFalse:[ |
1082 |
"/ load it - but not a binary |
|
1083 |
didLoadBin := Smalltalk loadBinaries. |
|
1084 |
Smalltalk loadBinaries:false. |
|
530
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1085 |
[ |
1256 | 1086 |
Autoload autoloadFailedSignal handle:[:ex | |
1309 | 1087 |
^ 'Autoload of ' , aClass name , ' failed - no documentation available.' |
1256 | 1088 |
] do:[ |
1089 |
aClass autoload. |
|
1090 |
]. |
|
1140
96ccc944d23a
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
1091 |
] ensure:[ |
530
d27016ae003f
try harder to extract some source info (module & directory)
Claus Gittinger <cg@exept.de>
parents:
528
diff
changeset
|
1092 |
didLoadBin ifTrue:[Smalltalk loadBinaries:true]. |
1256 | 1093 |
]. |
478 | 1094 |
]. |
1095 |
||
499 | 1096 |
owner := aClass owningClass. |
569 | 1097 |
privateClasses := aClass privateClassesSorted. |
499 | 1098 |
|
2016 | 1099 |
docu := self extractDocumentationFromClass:aClass. |
1100 |
"/ refLines, demoLines etc. are generated as a side effect. |
|
1101 |
||
1102 |
examples := self extractExamplesFromClass:aClass. |
|
1103 |
||
1104 |
self extractProtocolCategoriesFrom:aClass. |
|
1105 |
||
1106 |
outStream nextPutLine:'<h1>'. |
|
1107 |
outStream nextPutAll:'Class: '. |
|
1923
57fbb3e512e3
generate valid HTML 4.01 transitional
Stefan Vogel <sv@exept.de>
parents:
1896
diff
changeset
|
1108 |
|
57fbb3e512e3
generate valid HTML 4.01 transitional
Stefan Vogel <sv@exept.de>
parents:
1896
diff
changeset
|
1109 |
self generatingForSTXBrowser ifTrue:[ |
2016 | 1110 |
outStream |
1111 |
nextPutAll:'<a INFO="Open a Browser on ' , shortName , '" type="example" action="Smalltalk browseInClass:' , aClass name , '">'; |
|
1112 |
nextPutAll:shortName; nextPutLine:'</a>'. |
|
1923
57fbb3e512e3
generate valid HTML 4.01 transitional
Stefan Vogel <sv@exept.de>
parents:
1896
diff
changeset
|
1113 |
] ifFalse:[ |
2016 | 1114 |
outStream nextPutAll:shortName. |
1923
57fbb3e512e3
generate valid HTML 4.01 transitional
Stefan Vogel <sv@exept.de>
parents:
1896
diff
changeset
|
1115 |
]. |
499 | 1116 |
owner notNil ifTrue:[ |
3643 | 1117 |
ownerName := owner nameWithoutPrefix. |
2016 | 1118 |
outStream nextPutAll:' (private in '. |
1923
57fbb3e512e3
generate valid HTML 4.01 transitional
Stefan Vogel <sv@exept.de>
parents:
1896
diff
changeset
|
1119 |
self generatingForSTXBrowser ifTrue:[ |
2016 | 1120 |
outStream |
3643 | 1121 |
nextPutAll:'<a INFO="Open a Browser on ' , ownerName , '" type="example" action="Smalltalk browseInClass:' , owner name , '">'; |
1122 |
nextPutAll:(ownerName); nextPutLine:'</a>)'. |
|
1923
57fbb3e512e3
generate valid HTML 4.01 transitional
Stefan Vogel <sv@exept.de>
parents:
1896
diff
changeset
|
1123 |
] ifFalse:[ |
3643 | 1124 |
outStream nextPutAll:ownerName. |
1923
57fbb3e512e3
generate valid HTML 4.01 transitional
Stefan Vogel <sv@exept.de>
parents:
1896
diff
changeset
|
1125 |
]. |
523 | 1126 |
] ifFalse:[ |
1127 |
aClass nameSpace ~~ Smalltalk ifTrue:[ |
|
2016 | 1128 |
outStream nextPutAll:' (in ' , aClass nameSpace name , ')' |
523 | 1129 |
] |
499 | 1130 |
]. |
2016 | 1131 |
outStream nextPutLine:'</h1>'. |
478 | 1132 |
|
499 | 1133 |
owner notNil ifTrue:[ |
2016 | 1134 |
outStream nextPutLine:'This class is only visible from within'. |
3643 | 1135 |
outStream nextPutAll:ownerName. |
499 | 1136 |
owner owningClass notNil ifTrue:[ |
2016 | 1137 |
outStream nextPutAll:' (which is itself a private class of '. |
1138 |
outStream nextPutAll:owner owningClass nameWithoutPrefix. |
|
1139 |
outStream nextPutAll:')' |
|
499 | 1140 |
]. |
2016 | 1141 |
outStream nextPutLine:'.' |
499 | 1142 |
]. |
1143 |
||
478 | 1144 |
"/ |
1145 |
"/ index |
|
1146 |
"/ |
|
1147 |
"/ s nextPutAll:'Index:'; cr. |
|
2016 | 1148 |
outStream nextPutLine:'<ul>'. |
1149 |
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
|
1150 |
|
478 | 1151 |
docu notNil ifTrue:[ |
2016 | 1152 |
outStream nextPutLine:'<li><a href="#DESCRIPTION" name="I_DESCRIPTION">Description</a>'. |
478 | 1153 |
]. |
2016 | 1154 |
warnLines notEmptyOrNil ifTrue:[ |
1155 |
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
|
1156 |
]. |
2016 | 1157 |
hintLines notEmptyOrNil ifTrue:[ |
1158 |
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
|
1159 |
]. |
478 | 1160 |
refLines notNil ifTrue:[ |
2016 | 1161 |
outStream nextPutLine:'<li><a href="#SEEALSO" name="I_SEEALSO">Related information</a>'. |
478 | 1162 |
]. |
1163 |
||
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1164 |
"/ 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
|
1165 |
"/ s nextPutLine:'<li><a href="#CLASSVARIABLES" name="I_CLASSVARIABLES">Class variables</a>'. |
478 | 1166 |
|
2016 | 1167 |
self generateClassProtocolDocumentationForClass:aClass. |
1168 |
self generateInstanceProtocolDocumentationForClass:aClass. |
|
1169 |
||
1170 |
privateClasses notEmptyOrNil ifTrue:[ |
|
499 | 1171 |
privateClasses := privateClasses asOrderedCollection sort:[:a :b | a nameWithoutPrefix < b nameWithoutPrefix]. |
2016 | 1172 |
outStream nextPutLine:'<li><a href="#PRIVATECLASSES" name="I_PRIVATECLASSES">Private classes</a>'. |
499 | 1173 |
]. |
1174 |
||
478 | 1175 |
(aClass == Object or:[aClass == Autoload]) ifTrue:[ |
2016 | 1176 |
outStream nextPutLine:'<li><a href="#SUBCLASSES" name="I_SUBCLASSES">Subclasses</a>'. |
478 | 1177 |
]. |
1178 |
demoLines notNil ifTrue:[ |
|
2016 | 1179 |
outStream nextPutLine:'<li><a href="#DEMOSTARTUP" name="I_DEMOSTARTUP">Demonstration</a>'. |
478 | 1180 |
]. |
1181 |
examples notNil ifTrue:[ |
|
2016 | 1182 |
outStream nextPutLine:'<li><a href="#EXAMPLES" name="I_EXAMPLES">Examples</a>'. |
478 | 1183 |
]. |
2016 | 1184 |
outStream nextPutLine:'</ul>'. |
1249 | 1185 |
self generateHorizontalLine. |
478 | 1186 |
|
1187 |
"/ |
|
1188 |
"/ hierarchy |
|
1189 |
"/ |
|
2016 | 1190 |
self generateInheritanceTreeForClass:aClass. |
1249 | 1191 |
self generateHorizontalLine. |
478 | 1192 |
|
1193 |
"/ |
|
1194 |
"/ category, version & package |
|
1195 |
"/ |
|
2016 | 1196 |
self generateClassInfoForClass:aClass. |
1249 | 1197 |
self generateHorizontalLine. |
478 | 1198 |
|
2016 | 1199 |
self generateDescription:docu. |
478 | 1200 |
|
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1201 |
warnLines notNil ifTrue:[ |
2016 | 1202 |
outStream nextPutLine:'<h2><a name="WARNING" href="#I_WARNING">Warning:</A></h2>'. |
1203 |
outStream nextPutLine:'<BR>'. |
|
1204 |
||
1205 |
outStream nextPutLine:'<pre>'. |
|
1206 |
||
1207 |
warnLines := self undentedToFirstLinesIndent:warnLines. |
|
2865 | 1208 |
outStream nextPutAllLines:warnLines. |
2016 | 1209 |
outStream nextPutLine:'</pre>'. |
1249 | 1210 |
self generateHorizontalLine. |
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1211 |
]. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1212 |
|
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1213 |
hintLines notNil ifTrue:[ |
2016 | 1214 |
outStream nextPutLine:'<h2><a name="HINTS" href="#I_HINTS">Hints:</A></h2>'. |
1215 |
outStream nextPutLine:'<BR>'. |
|
1216 |
||
1217 |
outStream nextPutLine:'<pre>'. |
|
1218 |
hintLines := self undentedToFirstLinesIndent:hintLines. |
|
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1219 |
|
2865 | 1220 |
outStream nextPutAllLines:hintLines. |
2016 | 1221 |
outStream nextPutLine:'</pre>'. |
1249 | 1222 |
self generateHorizontalLine. |
540
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1223 |
]. |
c20e12db0340
added optional Warning & Hints sections
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
1224 |
|
478 | 1225 |
"/ |
1226 |
"/ see also |
|
1227 |
"/ |
|
1228 |
refLines notNil ifTrue:[ |
|
2016 | 1229 |
outStream nextPutLine:'<h2><a name="SEEALSO" href="#I_SEEALSO">Related information:</A></h2>'. |
1230 |
self generateRefLines:refLines forClass:aClass. |
|
1249 | 1231 |
self generateHorizontalLine. |
478 | 1232 |
]. |
1233 |
||
1234 |
||
1235 |
"/ |
|
1236 |
"/ inst & classVars |
|
1237 |
"/ to be added |
|
1238 |
||
1239 |
||
1240 |
"/ |
|
1241 |
"/ protocol |
|
1242 |
"/ |
|
2016 | 1243 |
self printOutHTMLProtocolOf:aClass on:outStream. |
478 | 1244 |
|
1245 |
"/ |
|
1246 |
"/ subclasses (only for Object and Autoload) |
|
1247 |
"/ |
|
1248 |
(aClass == Object or:[aClass == Autoload]) ifTrue:[ |
|
2016 | 1249 |
outStream nextPutLine:'<h2><a name="SUBCLASSES" href="#I_SUBCLASSES">Subclasses (direct subclasses only):</A></h2>'. |
1250 |
self generateSubclassInfoForClass:aClass. |
|
1249 | 1251 |
self generateHorizontalLine. |
478 | 1252 |
]. |
1253 |
||
1254 |
"/ |
|
499 | 1255 |
"/ private classes |
1256 |
"/ |
|
2016 | 1257 |
privateClasses notEmptyOrNil ifTrue:[ |
1258 |
outStream nextPutLine:'<h2><a name="PRIVATECLASSES" href="#I_PRIVATECLASSES">Private classes:</A></h2>'. |
|
1259 |
self generatePrivateClassInfoForClass:aClass withPrivateClasses:privateClasses. |
|
1249 | 1260 |
self generateHorizontalLine. |
499 | 1261 |
]. |
1262 |
||
2016 | 1263 |
"/ demonstration, if there are any |
478 | 1264 |
demoLines notNil ifTrue:[ |
2016 | 1265 |
self generateDemo. |
1249 | 1266 |
self generateHorizontalLine. |
478 | 1267 |
]. |
1268 |
||
2016 | 1269 |
"/ examples, if there are any |
478 | 1270 |
examples notNil ifTrue:[ |
1258
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
1271 |
self generateExamples:examples. |
478 | 1272 |
]. |
1273 |
||
1258
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
1274 |
self generateBODYandHTMLEnd. |
478 | 1275 |
|
1276 |
wasLoaded ifFalse:[ |
|
1277 |
aClass unload |
|
1278 |
]. |
|
1279 |
||
2016 | 1280 |
^ outStream contents |
478 | 1281 |
|
1282 |
" |
|
1283 |
self htmlDocOf:Object |
|
1284 |
self htmlDocOf:Array |
|
1285 |
self htmlDocOf:Filename |
|
1286 |
self htmlDocOf:Block |
|
1287 |
" |
|
1288 |
||
1896
ed785b09f5b1
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
1435
diff
changeset
|
1289 |
"Created: / 24-04-1996 / 15:01:59 / cg" |
2865 | 1290 |
"Modified: / 27-07-2012 / 09:29:45 / cg" |
478 | 1291 |
! |
1292 |
||
1293 |
htmlDocOf:aClass backRef:backRef |
|
632 | 1294 |
"generate an HTML document string which contains a classes documentation" |
1295 |
||
478 | 1296 |
^ self htmlDocOf:aClass back:nil backRef:backRef |
1297 |
||
632 | 1298 |
"Created: / 24.4.1996 / 15:03:25 / cg" |
1299 |
"Modified: / 30.10.1997 / 13:23:12 / cg" |
|
478 | 1300 |
! |
1301 |
||
1302 |
htmlDocOfImplementorsOf:selector |
|
632 | 1303 |
"generate an HTML document string which contains HREFS |
1304 |
to all implementors of a particular selector" |
|
1305 |
||
727
1729dca2ab7a
sort HTML-page of implemented selectors by className.
Claus Gittinger <cg@exept.de>
parents:
650
diff
changeset
|
1306 |
|sel s classes| |
478 | 1307 |
|
1249 | 1308 |
sel := self withSpecialHTMLCharactersEscaped:selector. |
478 | 1309 |
|
1249 | 1310 |
outStream := s := '' writeStream. |
478 | 1311 |
|
1249 | 1312 |
self generateHTMLHeadWithTitle:('Implementations of: ' , sel). |
1258
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
1313 |
self generateBODYStart. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
1314 |
|
1249 | 1315 |
self generateUpArrowButtonForTop. |
1316 |
self generateHorizontalLine. |
|
1317 |
self generateH1:sel. |
|
478 | 1318 |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1319 |
s nextPutLine:'<dl>'. |
478 | 1320 |
|
727
1729dca2ab7a
sort HTML-page of implemented selectors by className.
Claus Gittinger <cg@exept.de>
parents:
650
diff
changeset
|
1321 |
classes := IdentitySet new. |
1729dca2ab7a
sort HTML-page of implemented selectors by className.
Claus Gittinger <cg@exept.de>
parents:
650
diff
changeset
|
1322 |
|
478 | 1323 |
sel := selector asSymbol. |
1249 | 1324 |
Smalltalk allClassesAndMetaclassesDo:[:cls | |
499 | 1325 |
cls isPrivate ifFalse:[ |
1138
aa7687ec256f
implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
1326 |
(cls includesSelector:sel) ifTrue:[ |
727
1729dca2ab7a
sort HTML-page of implemented selectors by className.
Claus Gittinger <cg@exept.de>
parents:
650
diff
changeset
|
1327 |
classes add:cls |
499 | 1328 |
] |
478 | 1329 |
] |
1330 |
]. |
|
1331 |
||
1249 | 1332 |
(classes asOrderedCollection sort:[:a :b | a name < b name]) |
1333 |
do:[:cls | |
|
1334 |
self |
|
1335 |
printOutHTMLMethodProtocol:(cls compiledMethodAt:sel) |
|
1336 |
on:s |
|
1337 |
showClassName:true |
|
1338 |
classRef:true. |
|
1339 |
s nextPutLine:'<p>'. |
|
1340 |
]. |
|
727
1729dca2ab7a
sort HTML-page of implemented selectors by className.
Claus Gittinger <cg@exept.de>
parents:
650
diff
changeset
|
1341 |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1342 |
s nextPutLine:'</dl>'. |
1258
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
1343 |
self generateBODYandHTMLEnd. |
478 | 1344 |
|
1345 |
^ s contents |
|
1346 |
||
632 | 1347 |
"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
|
1348 |
"Modified: / 30.10.1998 / 22:15:30 / cg" |
478 | 1349 |
! |
1350 |
||
1435 | 1351 |
htmlDocOfImplementorsOfAnyMatching:selectorPattern |
1352 |
"generate an HTML document string which contains HREFS |
|
1353 |
to all implementors of a particular selector" |
|
1354 |
||
1355 |
|s sel classes| |
|
1356 |
||
1357 |
outStream := s := '' writeStream. |
|
1358 |
||
1359 |
sel := self withSpecialHTMLCharactersEscaped:selectorPattern. |
|
1360 |
self generateHTMLHeadWithTitle:('Implementations of: ' , sel). |
|
1361 |
self generateBODYStart. |
|
1362 |
||
1363 |
self generateUpArrowButtonForTop. |
|
1364 |
self generateHorizontalLine. |
|
1365 |
||
1366 |
self generateH1:sel. |
|
1367 |
||
1368 |
s nextPutLine:'<dl>'. |
|
1369 |
||
1370 |
classes := IdentitySet new. |
|
1371 |
||
1372 |
Smalltalk allClassesAndMetaclassesDo:[:cls | |
|
1373 |
cls isPrivate ifFalse:[ |
|
1374 |
(cls methodDictionary keys contains:[:sel | selectorPattern match:sel]) ifTrue:[ |
|
1375 |
classes add:cls |
|
1376 |
] |
|
1377 |
] |
|
1378 |
]. |
|
1379 |
||
1380 |
(classes asOrderedCollection sort:[:a :b | a name < b name]) |
|
1381 |
do:[:cls | |
|
1382 |
cls methodDictionary keys do:[:eachSel | |
|
1383 |
(selectorPattern match:eachSel) ifTrue:[ |
|
1384 |
self |
|
1385 |
printOutHTMLMethodProtocol:(cls compiledMethodAt:eachSel) |
|
1386 |
on:s |
|
1387 |
showClassName:true |
|
1388 |
classRef:true. |
|
1389 |
s nextPutLine:'<p>'. |
|
1390 |
]. |
|
1391 |
]. |
|
1392 |
]. |
|
1393 |
||
1394 |
s nextPutLine:'</dl>'. |
|
1395 |
self generateBODYandHTMLEnd. |
|
1396 |
||
1397 |
^ s contents |
|
3643 | 1398 |
! |
1399 |
||
1400 |
htmlOfflineDocOf:aClass |
|
1401 |
"generate an HTML document string which contains a class's documentation for offline reading. |
|
1402 |
Offline reading means that the links to other classes are created as file links, |
|
1403 |
(as opposed to action links, which only work with the builtin doc reader)." |
|
1404 |
||
1405 |
generateDocumentForOfflineReading := true. |
|
1406 |
^ self |
|
1407 |
htmlDocOf:aClass back:nil backRef:nil |
|
1408 |
imagePath:(self pathToTopOfDocumentation , '/icons') |
|
1409 |
||
1410 |
" |
|
1411 |
self htmlOfflineDocOf:PostscriptPrinterStream |
|
1412 |
" |
|
1251 | 1413 |
! ! |
1414 |
||
1280 | 1415 |
!HTMLDocGenerator methodsFor:'document generation-helpers'! |
1251 | 1416 |
|
2016 | 1417 |
extractAndRemoveSpecial:pattern from:docu |
1418 |
"given a collection of docu lines (from documentation methods comment), |
|
1419 |
extract things like [see also:], [author:] etc. |
|
1420 |
If found, remove the lines from the string collection, |
|
1421 |
and return the extracted ones. Otherwise return nil. |
|
1422 |
Attention: docu is sideeffectively changed (lines removed)" |
|
1423 |
||
1424 |
|srchIdx idx lines l| |
|
1425 |
||
1426 |
srchIdx := docu findFirst:[:l | l asLowercase withoutSeparators = pattern]. |
|
1427 |
srchIdx ~~ 0 ifTrue:[ |
|
1428 |
lines := OrderedCollection new. |
|
1429 |
||
1430 |
idx := srchIdx+1. |
|
1431 |
[idx <= docu size] whileTrue:[ |
|
1432 |
l := docu at:idx. |
|
1433 |
(l isNil or:[l withoutSeparators size == 0]) ifTrue:[ |
|
1434 |
idx := docu size + 1. |
|
1435 |
] ifFalse:[ |
|
1436 |
l withoutSeparators = '\' ifTrue:[ |
|
1437 |
l := '' |
|
1438 |
]. |
|
1439 |
lines add:l |
|
1440 |
]. |
|
1441 |
idx := idx + 1. |
|
1442 |
]. |
|
1443 |
||
1444 |
docu removeFromIndex:srchIdx toIndex:srchIdx+lines size |
|
1445 |
]. |
|
1446 |
^ lines |
|
1447 |
||
1448 |
"Created: 25.4.1996 / 14:16:01 / cg" |
|
1449 |
"Modified: 11.1.1997 / 13:03:38 / cg" |
|
1450 |
! |
|
1451 |
||
1452 |
extractAndRemoveSpecialLinesFromDocumentation:docu |
|
1453 |
"Extract things like [see also:], [author:] etc. from docu |
|
1454 |
If found, remove the lines from the string collection, |
|
1455 |
and leave them in corresponding instVars. |
|
1456 |
Attention: docu is sideeffectively changed (lines removed)" |
|
1457 |
||
1458 |
"/ |
|
1459 |
"/ search for a [see also:] section |
|
1460 |
"/ |
|
1461 |
refLines := self extractAndRemoveSpecial:'[see also:]' from:docu. |
|
1462 |
refLines notNil ifTrue:[ |
|
1463 |
"/ care for the special tuple format |
|
1464 |
refLines := refLines collect:[:l | |
|
1465 |
|t| |
|
1466 |
||
1467 |
((t := l withoutSeparators) startsWith:'(') ifTrue:[ |
|
1468 |
t |
|
1469 |
] ifFalse:[ |
|
1470 |
t := l asCollectionOfWords. |
|
1471 |
(t size == 1 |
|
1472 |
and:[ (t first includes:$:) not ]) ifTrue:[ |
|
1473 |
t first |
|
1474 |
] ifFalse:[ |
|
1475 |
t |
|
1476 |
] |
|
1477 |
] |
|
1478 |
]. |
|
1479 |
]. |
|
1480 |
||
1481 |
||
1482 |
"/ |
|
1483 |
"/ search for a [start with:] section |
|
1484 |
"/ |
|
1485 |
demoLines := self extractAndRemoveSpecial:'[start with:]' from:docu. |
|
1486 |
||
1487 |
"/ |
|
1488 |
"/ search for a [author:] section |
|
1489 |
"/ |
|
1490 |
authorLines := self extractAndRemoveSpecial:'[author:]' from:docu. |
|
1491 |
authorLines isNil ifTrue:[ |
|
1492 |
authorLines := self extractAndRemoveSpecial:'[authors:]' from:docu. |
|
1493 |
]. |
|
1494 |
||
1495 |
"/ |
|
1496 |
"/ search for a [warning:] section |
|
1497 |
"/ |
|
1498 |
warnLines := self extractAndRemoveSpecial:'[warning:]' from:docu. |
|
1499 |
warnLines notNil ifTrue:[ |
|
1500 |
warnLines := warnLines asStringCollection. |
|
1501 |
]. |
|
1502 |
||
1503 |
"/ |
|
1504 |
"/ search for a [hints:] section |
|
1505 |
"/ |
|
1506 |
hintLines := self extractAndRemoveSpecial:'[hints:]' from:docu. |
|
1507 |
hintLines isNil ifTrue:[ |
|
1508 |
hintLines := self extractAndRemoveSpecial:'[hint:]' from:docu. |
|
1509 |
]. |
|
1510 |
hintLines notNil ifTrue:[ |
|
1511 |
hintLines := hintLines asStringCollection. |
|
1512 |
]. |
|
1513 |
! |
|
1514 |
||
1515 |
extractDocumentationFromClass:aClass |
|
1516 |
|documentationMethod docu| |
|
1517 |
||
1518 |
documentationMethod := aClass theMetaclass compiledMethodAt:#documentation. |
|
1519 |
documentationMethod notNil ifTrue:[ |
|
1520 |
docu := documentationMethod comment. |
|
1521 |
] ifFalse:[ |
|
1522 |
"try comment" |
|
1523 |
docu := aClass theNonMetaclass comment. |
|
1524 |
]. |
|
1525 |
docu isEmptyOrNil ifTrue:[ ^ nil ]. |
|
1526 |
||
1527 |
docu := self withSpecialHTMLCharactersEscaped:docu. |
|
1528 |
docu := docu asStringCollection. |
|
1529 |
||
1530 |
self extractAndRemoveSpecialLinesFromDocumentation:docu. |
|
1531 |
||
1532 |
docu notEmpty ifTrue:[ |
|
1533 |
"/ |
|
1534 |
"/ strip off empty lines |
|
1535 |
"/ |
|
1536 |
[docu notEmpty and:[ docu first size == 0]] whileTrue:[ |
|
1537 |
docu removeFirst |
|
1538 |
]. |
|
1539 |
[docu notEmpty and:[ docu last size == 0]] whileTrue:[ |
|
1540 |
docu removeLast |
|
1541 |
]. |
|
1542 |
]. |
|
1543 |
||
1544 |
docu notEmpty ifTrue:[ |
|
1545 |
docu := self undentedToFirstLinesIndent:docu. |
|
1546 |
]. |
|
1547 |
docu := docu asString. |
|
1548 |
^ docu |
|
1549 |
! |
|
1550 |
||
1551 |
extractExamplesFromClass:aClass |
|
4484 | 1552 |
|m examples lines makePre isHtml| |
2016 | 1553 |
|
1554 |
m := aClass theMetaclass compiledMethodAt:#examples. |
|
1555 |
m isNil ifTrue:[ ^ nil]. |
|
1556 |
||
1557 |
examples := m comment. |
|
1558 |
examples isEmptyOrNil ifTrue:[ ^ nil]. |
|
1559 |
||
4484 | 1560 |
makePre := isHtml := false. |
1561 |
lines := examples asStringCollection. |
|
1562 |
(lines first withoutSeparators = '<pre>') ifTrue:[ |
|
1563 |
makePre := true. |
|
1564 |
lines removeFirst. |
|
1565 |
(lines last withoutSeparators = '</pre>') ifTrue:[ |
|
1566 |
lines removeLast. |
|
1567 |
]. |
|
1568 |
examples := lines asString. |
|
1569 |
] ifFalse:[ |
|
1570 |
(lines first withoutSeparators = '<html>') ifTrue:[ |
|
1571 |
(lines last withoutSeparators = '</html>') ifTrue:[ |
|
1572 |
lines removeLast. |
|
1573 |
]. |
|
1574 |
^ lines |
|
1575 |
]. |
|
1576 |
]. |
|
1577 |
||
2016 | 1578 |
examples := self withSpecialHTMLCharactersEscaped:examples. |
1579 |
examples := examples asStringCollection. |
|
1580 |
||
1581 |
"/ |
|
1582 |
"/ strip off empty lines |
|
1583 |
"/ |
|
3625 | 1584 |
[examples notEmpty and:[examples first isEmptyOrNil]] whileTrue:[ |
2252
cd22e5433333
changed: #extractExamplesFromClass:
Stefan Vogel <sv@exept.de>
parents:
2205
diff
changeset
|
1585 |
examples removeFirst. |
2016 | 1586 |
]. |
3625 | 1587 |
[examples notEmpty and:[examples last isEmptyOrNil]] whileTrue:[ |
2252
cd22e5433333
changed: #extractExamplesFromClass:
Stefan Vogel <sv@exept.de>
parents:
2205
diff
changeset
|
1588 |
examples removeLast. |
2016 | 1589 |
]. |
1590 |
||
1591 |
examples isEmpty ifTrue:[ ^ nil]. |
|
4484 | 1592 |
makePre ifTrue:[ |
1593 |
examples addFirst:'<pre>'. |
|
1594 |
examples addLast:'</pre>'. |
|
1595 |
^ examples |
|
1596 |
] ifFalse:[ |
|
1597 |
^ self undentedToFirstLinesIndent:examples. |
|
1598 |
]. |
|
2016 | 1599 |
! |
1600 |
||
1601 |
extractProtocolCategoriesFrom:aClass |
|
4247 | 1602 |
classProtocolCategories := aClass theMetaclass methodCategories asSortedCollection. |
2016 | 1603 |
classProtocolCategories notEmpty ifTrue:[ |
1604 |
classProtocolCategories := classProtocolCategories asSortedCollection. |
|
1605 |
classProtocolCategories remove:'documentation' ifAbsent:nil. |
|
1606 |
]. |
|
4247 | 1607 |
instanceProtocolCategories := aClass theNonMetaclass methodCategories asSortedCollection. |
2016 | 1608 |
instanceProtocolCategories notEmpty ifTrue:[ |
1609 |
instanceProtocolCategories := instanceProtocolCategories asSortedCollection. |
|
1610 |
]. |
|
4247 | 1611 |
|
1612 |
"Modified: / 05-07-2017 / 10:51:25 / cg" |
|
2016 | 1613 |
! |
1614 |
||
3625 | 1615 |
htmlForMethod:arg |
1616 |
^ self class htmlForMethod:arg |
|
1973 | 1617 |
! |
1618 |
||
1251 | 1619 |
htmlRevisionDocOf:aClass to:s |
1620 |
"extract a classes versionInfo and return an HTML document string |
|
1621 |
for that." |
|
1622 |
||
1623 |
|revInfo pckgInfo text path| |
|
1624 |
||
1625 |
revInfo := aClass revisionInfo. |
|
1626 |
pckgInfo := aClass packageSourceCodeInfo. |
|
1627 |
||
1628 |
s nextPutLine:'<dl><dt><a name="VERSION"><b>Version:</b></A>'. |
|
1629 |
||
1630 |
(revInfo isNil and:[pckgInfo isNil]) ifTrue:[ |
|
1631 |
s nextPutLine:'<dd>no revision info'. |
|
1632 |
] ifFalse:[ |
|
1633 |
||
1634 |
revInfo isNil ifTrue:[revInfo := IdentityDictionary new]. |
|
1635 |
pckgInfo isNil ifTrue:[pckgInfo := IdentityDictionary new]. |
|
1636 |
||
1637 |
s nextPutLine:'<dd>rev: <b>'. |
|
1638 |
||
1639 |
"/ fetch the revision-info; prefer revisionInfo |
|
1640 |
text := revInfo at:#revision ifAbsent:(pckgInfo at:#revision ifAbsent:'?'). |
|
1641 |
s nextPutLine:text. |
|
1642 |
||
1643 |
"/ fetch the date & time; prefer revisionInfo |
|
1644 |
text := revInfo at:#date ifAbsent:(pckgInfo at:#date ifAbsent:'?'). |
|
1645 |
s nextPutAll:'</b> date: <b>' , text. |
|
1646 |
text := revInfo at:#time ifAbsent:(pckgInfo at:#time ifAbsent:'?'). |
|
1647 |
s nextPutLine:' ', text , '</b>'. |
|
1648 |
||
1649 |
text := revInfo at:#user ifAbsent:(pckgInfo at:#user ifAbsent:'?'). |
|
1650 |
s nextPutLine:'<dd>user: <b>' , text , '</b>'. |
|
1651 |
||
1652 |
text := revInfo at:#fileName ifAbsent:(pckgInfo at:#fileNamer ifAbsent:'?'). |
|
1653 |
s nextPutAll:'<dd>file: <b>' , text. |
|
1654 |
||
1655 |
text := revInfo at:#directory ifAbsent:(pckgInfo at:#directory ifAbsent:nil). |
|
1656 |
text isNil ifTrue:[ |
|
1657 |
path := revInfo at:#repositoryPathName ifAbsent:(pckgInfo at:#repositoryPathName ifAbsent:nil). |
|
1658 |
path notNil ifTrue:[ |
|
1659 |
SourceCodeManager notNil ifTrue:[ |
|
1346
8657706d79ba
generation of relative-path in CVS fixed
Claus Gittinger <cg@exept.de>
parents:
1344
diff
changeset
|
1660 |
text := SourceCodeManager directoryFromContainerPath:path forClass:aClass. |
1251 | 1661 |
]. |
1662 |
text isNil ifTrue:[text := '?']. |
|
1663 |
] ifFalse:[ |
|
1664 |
text := '?' |
|
1665 |
] |
|
1666 |
]. |
|
1667 |
s nextPutLine:'</b> directory: <b>' , text , '</b>'. |
|
1668 |
||
1669 |
text := revInfo at:#module ifAbsent:(pckgInfo at:#module 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 moduleFromContainerPath:path forClass:aClass. |
1251 | 1675 |
]. |
1676 |
text isNil ifTrue:[text := '?']. |
|
1677 |
] ifFalse:[ |
|
1678 |
text := '?' |
|
1679 |
] |
|
1680 |
]. |
|
1681 |
s nextPutAll:'<dd>module: <b>' , text. |
|
1682 |
||
1683 |
text := revInfo at:#library ifAbsent:(pckgInfo at:#library ifAbsent:'*none*'). |
|
1684 |
s nextPutLine:'</b> stc-classLibrary: <b>' , text , '</b>'. |
|
1685 |
]. |
|
1686 |
||
1687 |
"Created: / 8.1.1997 / 13:43:28 / cg" |
|
1688 |
"Modified: / 30.10.1997 / 13:24:39 / cg" |
|
478 | 1689 |
! |
1690 |
||
1691 |
printOutHTMLCategoryProtocol:aCategory of:aClass on:aStream |
|
632 | 1692 |
"append documentation on each method in a particular methodCategory |
1693 |
of the given class in HTML onto aStream." |
|
1694 |
||
523 | 1695 |
|any dict selectors methods shortName| |
1696 |
||
1697 |
shortName := aClass nameWithoutPrefix. |
|
478 | 1698 |
|
1699 |
dict := aClass methodDictionary. |
|
1700 |
||
1701 |
dict notNil ifTrue:[ |
|
1702 |
any := false. |
|
1703 |
dict do:[:aMethod | |
|
1704 |
(aCategory = aMethod category) ifTrue:[ |
|
1705 |
any := true |
|
1706 |
] |
|
1707 |
]. |
|
1708 |
||
1709 |
any ifTrue:[ |
|
523 | 1710 |
aStream nextPutLine:'<a name="' , shortName , '_category_' , aCategory , |
1711 |
'" href="#I_' , shortName , '_category_' , aCategory , |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1712 |
'"><b>' , aCategory , '</b></A>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1713 |
aStream nextPutLine:'<dl>'. |
478 | 1714 |
|
1715 |
selectors := dict keys asArray. |
|
1716 |
methods := dict values. |
|
1717 |
selectors sortWith:methods. |
|
1718 |
methods do:[:aMethod | |
|
1719 |
(aCategory = aMethod category) ifTrue:[ |
|
1216
b854fdc89d2a
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
1178
diff
changeset
|
1720 |
Error catch:[ |
478 | 1721 |
self printOutHTMLMethodProtocol:aMethod on:aStream. |
1722 |
]. |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1723 |
aStream nextPutLine:'<p>'. |
478 | 1724 |
] |
1725 |
]. |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1726 |
aStream nextPutLine:'</dl>'. |
478 | 1727 |
] |
1728 |
] |
|
1729 |
||
1730 |
" |
|
1731 |
self printOutHTMLProtocolOf:Float on:Stdout |
|
1732 |
" |
|
1733 |
||
632 | 1734 |
"Created: / 22.4.1996 / 20:03:30 / cg" |
1735 |
"Modified: / 5.6.1996 / 13:41:27 / stefan" |
|
1736 |
"Modified: / 30.10.1997 / 13:27:58 / cg" |
|
478 | 1737 |
! |
1738 |
||
1739 |
printOutHTMLMethodProtocol:aMethod on:aStream |
|
4263 | 1740 |
"given the source in aString, print the method's message specification |
478 | 1741 |
and any method comments - without source; used to generate documentation |
1742 |
pages" |
|
1743 |
||
907
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1744 |
^ self |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1745 |
printOutHTMLMethodProtocol:aMethod |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1746 |
on:aStream |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1747 |
showClassName:false |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1748 |
classRef:false |
478 | 1749 |
|
4263 | 1750 |
"Modified: / 22-04-1996 / 18:01:56 / cg" |
1751 |
"Created: / 22-04-1996 / 20:03:30 / cg" |
|
1752 |
"Modified (comment): / 21-11-2017 / 13:01:48 / cg" |
|
478 | 1753 |
! |
1754 |
||
1755 |
printOutHTMLMethodProtocol:aMethod on:aStream showClassName:showClassName classRef:withClassRef |
|
4263 | 1756 |
"given the source in aString, print the method's message specification |
478 | 1757 |
and any method comments - without source; used to generate documentation |
1758 |
pages" |
|
1759 |
||
1344 | 1760 |
|p| |
1761 |
||
1762 |
"/ p := imagePath. |
|
1763 |
"/ p isNil ifTrue:[ |
|
1764 |
"/ p := self pathToTopOfDocumentation , '/icons' |
|
1765 |
"/ ]. |
|
1766 |
p := self pathToTopOfDocumentation , '/pictures'. |
|
907
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1767 |
^ self |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1768 |
printOutHTMLMethodProtocol:aMethod |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1769 |
on:aStream |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1770 |
showClassName:showClassName |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1771 |
classRef:withClassRef |
1344 | 1772 |
picturePath:p |
4263 | 1773 |
|
1774 |
"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
|
1775 |
! |
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1776 |
|
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1777 |
printOutHTMLMethodProtocol:aMethod on:aStream showClassName:showClassName classRef:withClassRef picturePath:picturePath |
3625 | 1778 |
"given the source in aString, print the method's message specification |
1779 |
and any method comments - without source. |
|
1780 |
used to generate documentation pages" |
|
907
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1781 |
|
1973 | 1782 |
|comment cls sel who methodSpecLine |
478 | 1783 |
firstIndent firstNonEmpty isSubres isObsolete smallOrEmpty |
3625 | 1784 |
ballColor anchorName parseTree expr obsoleteInfo |
1785 |
exampleComments isInheritedComment| |
|
478 | 1786 |
|
1787 |
who := aMethod who. |
|
505
d8d7556d05ee
use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1788 |
cls := who methodClass. |
d8d7556d05ee
use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1789 |
sel := who methodSelector. |
1973 | 1790 |
|
1791 |
methodSpecLine := self htmlForMethod:aMethod. |
|
478 | 1792 |
|
632 | 1793 |
"/ use string-asSymbol (instead of the obvious symbol itself) |
1794 |
"/ in the checks below, to avoid tricking myself, |
|
1795 |
"/ when the documentation on this method is generated |
|
1796 |
"/ (otherwise, I'll say that this method is both |
|
1797 |
"/ a subres and and obsolete method ...) |
|
1798 |
||
4250 | 1799 |
isSubres := aMethod isSubclassResponsibility. |
478 | 1800 |
|
1973 | 1801 |
isObsolete := aMethod isObsolete. |
1802 |
"/ the above checks for the obsolete-resource flag; |
|
1803 |
"/ there is still achance for obsoleteMethodWarning to be sent, without the resource flag being present. |
|
1804 |
isObsolete ifFalse:[ |
|
4200 | 1805 |
(aMethod sendsAnySelector:#(#'obsoleteMethodWarning' #'obsoleteMethodWarning:' #'obsoleteMethodWarning:from:')) ifTrue:[ |
1973 | 1806 |
(sel startsWith:'obsoleteMethodWarning') ifFalse:[ |
1807 |
true "cls ~~ Object" ifTrue:[ |
|
1808 |
isObsolete := true. |
|
1809 |
ParseTreeSearcher notNil ifTrue:[ |
|
1810 |
parseTree := cls parseTreeFor:sel. |
|
1811 |
parseTree notNil ifTrue: [ |
|
1812 |
expr := ParseTreeSearcher treeMatching:'`@e1 obsoleteMethodWarning:`@e2' in: parseTree. |
|
1813 |
expr isNil ifTrue:[ |
|
1814 |
expr := ParseTreeSearcher treeMatching:'`@e1 obsoleteMethodWarning:`@e2 from:`@e3' in: parseTree. |
|
1815 |
]. |
|
1816 |
expr notNil ifTrue:[ |
|
1817 |
|arg1| |
|
1818 |
||
1819 |
arg1 := expr arguments first. |
|
1820 |
arg1 isLiteral ifTrue:[ |
|
1821 |
arg1 value isString ifTrue:[ |
|
1822 |
obsoleteInfo := arg1 value. |
|
1823 |
]. |
|
1400 | 1824 |
]. |
1825 |
]. |
|
1826 |
]. |
|
1827 |
]. |
|
1828 |
]. |
|
1973 | 1829 |
] |
1830 |
]. |
|
478 | 1831 |
]. |
1832 |
||
1833 |
smallOrEmpty := ''. |
|
1834 |
aMethod isPrivate ifTrue:[ |
|
642
077371c28483
oops - missing trailing dQuotes - html output failed on netscape
dq
parents:
637
diff
changeset
|
1835 |
methodSpecLine := '<i>private</i> ' , methodSpecLine. |
478 | 1836 |
"/ smallOrEmpty := '-small'. |
1837 |
] ifFalse:[ |
|
1838 |
aMethod isProtected ifTrue:[ |
|
642
077371c28483
oops - missing trailing dQuotes - html output failed on netscape
dq
parents:
637
diff
changeset
|
1839 |
methodSpecLine := '<i>protected</i> ' , methodSpecLine. |
478 | 1840 |
"/ smallOrEmpty := '-small'. |
1841 |
] ifFalse:[ |
|
1842 |
aMethod isIgnored ifTrue:[ |
|
642
077371c28483
oops - missing trailing dQuotes - html output failed on netscape
dq
parents:
637
diff
changeset
|
1843 |
methodSpecLine := '[ ' , methodSpecLine , ' ] (<i>invisible</i>)'. |
478 | 1844 |
"/ smallOrEmpty := '-small'. |
1845 |
] |
|
1846 |
] |
|
1847 |
]. |
|
4051 | 1848 |
aMethod isExtension ifTrue:[ |
1849 |
methodSpecLine := methodSpecLine,(' <br>( <i>an extension from the %1 package</i> )' bindWith:aMethod package). |
|
1850 |
]. |
|
478 | 1851 |
|
632 | 1852 |
aStream nextPutLine:'<DT>'. |
478 | 1853 |
|
1854 |
||
1855 |
cls isMeta ifTrue:[ |
|
1856 |
ballColor := 'yellow' |
|
1857 |
] ifFalse:[ |
|
1858 |
ballColor := 'red' |
|
1859 |
]. |
|
1860 |
||
907
1a6b647d1b43
picture & icon path (for HTTP server)
Claus Gittinger <cg@exept.de>
parents:
817
diff
changeset
|
1861 |
aStream nextPutLine:'<IMG src="' , picturePath , '/' , ballColor , '-ball' , smallOrEmpty , '.gif" alt="o " width=6 height=6>'. |
1335 | 1862 |
aStream nextPutAll:' '. |
478 | 1863 |
|
1249 | 1864 |
sel := self withSpecialHTMLCharactersEscaped:sel. |
1865 |
anchorName := cls name , '_' , sel. |
|
478 | 1866 |
|
1867 |
withClassRef ifTrue:[ |
|
1250 | 1868 |
aStream nextPutAll:(self |
1869 |
anchorForHTMLDocAction: |
|
1870 |
('htmlDocOf:', cls theNonMetaclass name ) |
|
1871 |
info: |
|
1872 |
('Show documentation of ' , cls theNonMetaclass name ) |
|
1873 |
text: |
|
1874 |
cls name |
|
1875 |
name:anchorName). |
|
1876 |
aStream nextPutLine:' ' , methodSpecLine. |
|
478 | 1877 |
] ifFalse:[ |
1878 |
showClassName ifTrue:[ |
|
1879 |
methodSpecLine := cls name , ' ' , methodSpecLine |
|
1880 |
]. |
|
1881 |
||
1249 | 1882 |
aStream nextPutLine:'<a name="' , anchorName , '" ' , |
642
077371c28483
oops - missing trailing dQuotes - html output failed on netscape
dq
parents:
637
diff
changeset
|
1883 |
"/ 'href="' , cls name , '_' , sel , '"' , |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1884 |
'>' , methodSpecLine , '</a>'. |
3625 | 1885 |
self generateJavaScriptCallInfo ifTrue:[ |
1886 |
|jsMethodSpecLine| |
|
1887 |
aStream nextPutLine:'<br>JS: ' , (HTMLDocGeneratorForJavaScript htmlForMethod:aMethod). |
|
1888 |
]. |
|
478 | 1889 |
]. |
632 | 1890 |
aStream nextPutLine:'<DD>'. |
478 | 1891 |
|
3625 | 1892 |
isInheritedComment := false. |
1893 |
comment := self methodCommentOf:aMethod. |
|
1894 |
||
1895 |
"/ filter history lines |
|
1896 |
((comment startsWith:'Created: ') |
|
1897 |
or:[ (comment startsWith:'Modified: ') ]) ifTrue:[ |
|
1898 |
comment := nil. |
|
1899 |
]. |
|
1900 |
||
1901 |
comment isEmptyOrNil ifTrue:[ |
|
1902 |
|m| |
|
1903 |
||
1904 |
m := aMethod mclass superclass lookupMethodFor:aMethod selector. |
|
1905 |
m notNil ifTrue:[ |
|
1906 |
(comment := self methodCommentOf:m) notEmptyOrNil ifTrue:[ |
|
1907 |
isInheritedComment := true. |
|
1908 |
((comment startsWith:'Created: ') |
|
1909 |
or:[ (comment startsWith:'Modified: ') ]) ifTrue:[ |
|
1910 |
comment := nil. |
|
1911 |
]. |
|
1912 |
]. |
|
1913 |
]. |
|
1914 |
]. |
|
1915 |
comment notNil ifTrue:[ |
|
1249 | 1916 |
comment := self withSpecialHTMLCharactersEscaped:comment. |
478 | 1917 |
|
1918 |
comment notEmpty ifTrue:[ |
|
1919 |
comment := comment asStringCollection. |
|
1920 |
firstIndent := comment first leftIndent. |
|
1921 |
firstIndent > 0 ifTrue:[ |
|
1922 |
comment := comment collect:[:line | |
|
1923 |
line leftIndent >= firstIndent ifTrue:[ |
|
1924 |
line copyFrom:firstIndent. |
|
1925 |
] ifFalse:[ |
|
1926 |
line |
|
1927 |
] |
|
1928 |
]. |
|
1929 |
]. |
|
1930 |
firstNonEmpty := comment findFirst:[:line | line notEmpty]. |
|
1931 |
firstNonEmpty > 1 ifTrue:[ |
|
1932 |
comment := comment copyFrom:firstNonEmpty |
|
1933 |
]. |
|
1934 |
comment := comment asString. |
|
3625 | 1935 |
|
1936 |
isInheritedComment ifTrue:[ |
|
1937 |
comment := '<I>(comment from inherited method)</I><BR>' , comment. |
|
1938 |
]. |
|
1939 |
"/ make argument names italic in the comment |
|
4495 | 1940 |
aMethod argumentCount > 0 ifTrue:[ |
3625 | 1941 |
(aMethod methodArgNames ? #()) do:[:each | |
1942 |
comment := comment copyReplaceString:each withString:'<I>',each,'</I>' |
|
1943 |
]. |
|
1944 |
comment := comment copyReplaceString:'<I><I>' withString:'<I>'. |
|
1945 |
comment := comment copyReplaceString:'</I></I>' withString:'</I>'. |
|
1946 |
]. |
|
478 | 1947 |
]. |
1948 |
||
1949 |
comment asStringCollection do:[:line | |
|
1178 | 1950 |
aStream |
1951 |
"/ nextPutAll:'<I>'; |
|
1952 |
nextPutAll:line; |
|
1953 |
"/ nextPutAll:'</I>'; |
|
1954 |
nextPutLine:'<BR>'. |
|
478 | 1955 |
]. |
1956 |
]. |
|
1957 |
||
1958 |
isSubres ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1959 |
aStream nextPutLine:'<BR>'. |
4484 | 1960 |
aStream nextPutLine:'<I>** This method must be redefined in concrete classes (subclassResponsibility) **</I>'. |
478 | 1961 |
]. |
1962 |
isObsolete ifTrue:[ |
|
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1963 |
aStream nextPutLine:'<BR>'. |
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
1964 |
aStream nextPutLine:'<I>** This is an obsolete interface - do not use it (it may vanish in future versions) **</I>'. |
1400 | 1965 |
obsoleteInfo notNil ifTrue:[ |
1966 |
aStream nextPutLine:'<BR>'. |
|
1967 |
aStream nextPutLine:'<I>** ' , obsoleteInfo , ' **</I>'. |
|
1968 |
]. |
|
478 | 1969 |
]. |
1970 |
||
3625 | 1971 |
(isSubres | isObsolete) ifFalse:[ |
4326 | 1972 |
[ |
1973 |
exampleComments := self methodExampleCommentsOf:aMethod. |
|
1974 |
] valueWithTimeout:10 seconds. |
|
1975 |
||
3625 | 1976 |
exampleComments notEmptyOrNil ifTrue:[ |
1977 |
exampleComments do:[:each | |
|
1978 |
|exampleCode| |
|
1979 |
||
1980 |
exampleCode := self undentedToFirstLinesIndent:each asStringCollection. |
|
4404 | 1981 |
[exampleCode size ~~ 0 and:[(exampleCode first ? '') withoutSeparators isEmpty]] |
3625 | 1982 |
whileTrue:[ exampleCode removeFirst]. |
4404 | 1983 |
[exampleCode size ~~ 0 and:[(exampleCode last ? '') withoutSeparators isEmpty]] |
3625 | 1984 |
whileTrue:[ exampleCode removeLast]. |
1985 |
||
1986 |
exampleCode notEmpty ifTrue:[ |
|
4328 | 1987 |
"/ outStream nextPutLine:'<blockquote>'. |
1988 |
outStream nextPutLine:'<p>usage example(s):'. |
|
4318 | 1989 |
"/ outStream nextPutLine:'usage example(s):<br>'. |
3625 | 1990 |
self generateExampleStart. |
1991 |
exampleCode do:[:eachLine | |
|
1992 |
outStream nextPutLine:eachLine |
|
1993 |
]. |
|
1994 |
self generateExampleEnd. |
|
4328 | 1995 |
"/ outStream nextPutLine:'</blockquote>'. |
3625 | 1996 |
]. |
1997 |
]. |
|
1998 |
]. |
|
1999 |
]. |
|
2000 |
||
2001 |
" |
|
2002 |
self basicNew |
|
2003 |
printOutHTMLMethodProtocol:(Array compiledMethodAt:#addAllNonNilElementsTo:) |
|
2004 |
on:Transcript |
|
2005 |
showClassName:true classRef:true picturePath:'pics' |
|
2006 |
" |
|
2007 |
||
1973 | 2008 |
"Created: / 22-04-1996 / 20:03:30 / cg" |
4250 | 2009 |
"Modified: / 16-07-2017 / 11:28:18 / cg" |
4404 | 2010 |
"Modified: / 01-03-2019 / 15:52:32 / Claus Gittinger" |
478 | 2011 |
! |
2012 |
||
2013 |
printOutHTMLProtocolOf:aClass on:aStream |
|
632 | 2014 |
"append documentation of the given class in HTML onto aStream." |
2015 |
||
478 | 2016 |
|collectionOfCategories any| |
2017 |
||
2018 |
"/ self printOutDefinitionOn:aPrintStream. |
|
2019 |
||
4247 | 2020 |
collectionOfCategories := aClass class methodCategories asSortedCollection. |
478 | 2021 |
any := false. |
523 | 2022 |
|
4404 | 2023 |
collectionOfCategories size ~~ 0 ifTrue:[ |
523 | 2024 |
collectionOfCategories := collectionOfCategories asOrderedCollection. |
2025 |
collectionOfCategories remove:'documentation' ifAbsent:[]. |
|
4404 | 2026 |
collectionOfCategories size ~~ 0 ifTrue:[ |
523 | 2027 |
collectionOfCategories sort. |
642
077371c28483
oops - missing trailing dQuotes - html output failed on netscape
dq
parents:
637
diff
changeset
|
2028 |
aStream nextPutLine:'<h2><a name="CLASSPROTOCOL" href="#I_CLASSPROTOCOL">Class protocol:</a></h2>'. |
523 | 2029 |
collectionOfCategories do:[:aCategory | |
478 | 2030 |
self printOutHTMLCategoryProtocol:aCategory of:aClass class on:aStream. |
2031 |
any := true. |
|
523 | 2032 |
]. |
478 | 2033 |
"/ any ifFalse:[ |
2034 |
"/ aStream nextPutAll:'no new protocol' |
|
2035 |
"/ ]. |
|
1249 | 2036 |
self generateHorizontalLine. |
523 | 2037 |
] |
478 | 2038 |
]. |
2039 |
||
2040 |
||
4247 | 2041 |
collectionOfCategories := aClass methodCategories asSortedCollection. |
478 | 2042 |
any := false. |
4404 | 2043 |
collectionOfCategories size ~~ 0 ifTrue:[ |
478 | 2044 |
collectionOfCategories := collectionOfCategories asOrderedCollection sort. |
511
ef2631a2cc1c
use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents:
505
diff
changeset
|
2045 |
aStream nextPutLine:'<h2><a name="INSTANCEPROTOCOL" href="#I_INSTANCEPROTOCOL">Instance protocol:</A></h2>'. |
478 | 2046 |
collectionOfCategories do:[:aCategory | |
2047 |
self printOutHTMLCategoryProtocol:aCategory of:aClass on:aStream |
|
2048 |
]. |
|
2049 |
"/ any ifFalse:[ |
|
2050 |
"/ aStream nextPutAll:'no new protocol' |
|
2051 |
"/ ]. |
|
1249 | 2052 |
self generateHorizontalLine. |
478 | 2053 |
] |
2054 |
||
2055 |
" |
|
2056 |
self printOutHTMLProtocolOf:Float on:Stdout |
|
2057 |
" |
|
2058 |
||
4247 | 2059 |
"Created: / 22-04-1996 / 20:03:30 / cg" |
2060 |
"Modified: / 05-07-2017 / 10:51:39 / cg" |
|
4404 | 2061 |
"Modified: / 01-03-2019 / 15:53:20 / Claus Gittinger" |
2016 | 2062 |
! |
2063 |
||
2064 |
undentedToFirstLinesIndent:someText |
|
2065 |
|undentedText firstIndent firstNonEmpty| |
|
2066 |
||
2049 | 2067 |
undentedText := someText. |
2068 |
||
4404 | 2069 |
someText size ~~ 0 ifTrue:[ |
2049 | 2070 |
firstIndent := someText first withTabsExpanded leftIndent. |
2071 |
firstIndent > 0 ifTrue:[ |
|
2072 |
undentedText := someText collect:[:line | |
|
2073 |
|l| |
|
2074 |
||
2075 |
l := line withTabsExpanded. |
|
2076 |
l leftIndent >= firstIndent ifTrue:[ |
|
2077 |
l copyFrom:firstIndent + 1. |
|
2078 |
] ifFalse:[ |
|
2079 |
l |
|
2080 |
] |
|
2081 |
]. |
|
2082 |
]. |
|
2016 | 2083 |
]. |
2084 |
||
2085 |
firstNonEmpty := undentedText findFirst:[:line | line notEmpty]. |
|
2086 |
firstNonEmpty > 1 ifTrue:[ |
|
2087 |
undentedText := undentedText copyFrom:firstNonEmpty |
|
2088 |
]. |
|
2089 |
^ undentedText |
|
4404 | 2090 |
|
2091 |
"Modified: / 01-03-2019 / 15:53:11 / Claus Gittinger" |
|
2016 | 2092 |
! ! |
2093 |
||
2094 |
!HTMLDocGenerator methodsFor:'document generation-lists'! |
|
2095 |
||
2096 |
htmlClassCategoryList |
|
2097 |
"generate a formatted list of all available class categories as |
|
2098 |
an HTML string. Each category will be a hyperlink to another |
|
2099 |
autogenerated page, containing the classes per category. |
|
2100 |
The generated page is supposed to be given to an HTML reader |
|
2101 |
with home being set to ../doc/online/xxx/classDoc |
|
2102 |
(i.e. the images are to be found one-up in the doc hierarchy)" |
|
2103 |
||
2104 |
|categories s prefixList prefix prefixStack prev| |
|
2105 |
||
2106 |
categories := Smalltalk allClassCategories asOrderedCollection sort. |
|
2107 |
||
2108 |
outStream := s := '' writeStream. |
|
2109 |
||
2110 |
self generateHTMLHeadWithTitle:'Class Categories:'. |
|
2111 |
||
2112 |
self generateBODYStart. |
|
2113 |
||
2114 |
self generateUpArrowButtonForTop. |
|
2115 |
self generateHorizontalLine. |
|
2116 |
self generateH1:'Class Categories:'. |
|
2117 |
s nextPutLine:'<ul>'. |
|
2118 |
||
2119 |
prefixList := Set new. |
|
2120 |
||
2121 |
categories keysAndValuesDo:[:index :element | |
|
2122 |
|prev common| |
|
2123 |
||
2124 |
index ~~ 1 ifTrue:[ |
|
2125 |
prev := categories at:(index - 1). |
|
2126 |
common := (Array with:prev with:element) longestCommonPrefix. |
|
2127 |
(common endsWith:'-') ifTrue:[ |
|
3232
de4bd4dcb49f
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
2865
diff
changeset
|
2128 |
prefixList add:(common copyButLast:1) |
2016 | 2129 |
] ifFalse:[ |
2130 |
(common includes:$-) ifTrue:[ |
|
2131 |
prefixList add:(common copyTo:(common lastIndexOf:$-)-1). |
|
2132 |
] ifFalse:[ |
|
2133 |
"/ common = prev ifTrue:[ |
|
2134 |
"/ prefixList add:common |
|
2135 |
"/ ] |
|
2136 |
] |
|
2137 |
] |
|
2138 |
] |
|
2139 |
]. |
|
2140 |
||
2141 |
prefix := ''. prefixStack := OrderedCollection new. |
|
2142 |
prev := ''. |
|
2143 |
||
2144 |
categories := categories select:[:nm | nm ~= 'obsolete']. |
|
2145 |
||
2146 |
categories do:[:nm | |
|
2147 |
|longest| |
|
2148 |
||
2149 |
"/ longest prefix .... |
|
2150 |
longest := prefixList inject:'' into:[:maxPrefix :prefix | |
|
2151 |
|prefixWithDash| |
|
2152 |
||
2153 |
prefixWithDash := prefix , '-'. |
|
2154 |
nm = prefix ifTrue:[ |
|
2155 |
maxPrefix |
|
2156 |
] ifFalse:[ |
|
2157 |
(nm startsWith:prefixWithDash) |
|
2158 |
ifTrue:[ |
|
2159 |
prefixWithDash size > maxPrefix size |
|
2160 |
ifTrue:[ |
|
2161 |
prefixWithDash |
|
2162 |
] ifFalse:[ |
|
2163 |
maxPrefix |
|
2164 |
] |
|
2165 |
] ifFalse:[ |
|
2166 |
maxPrefix |
|
2167 |
] |
|
2168 |
] |
|
2169 |
]. |
|
2170 |
||
4404 | 2171 |
longest size ~~ 0 ifTrue:[ |
2016 | 2172 |
longest = prefix ifTrue:[ |
2173 |
"/ no change |
|
2174 |
] ifFalse:[ |
|
2175 |
(longest startsWith:prefix) ifTrue:[ |
|
2176 |
prefixStack addLast:longest. |
|
2177 |
longest ~= prev ifTrue:[ |
|
2178 |
prefixStack size == 1 ifTrue:[ |
|
2179 |
s nextPutLine:'<p>'. |
|
2180 |
]. |
|
2181 |
s nextPutLine:'<li>' , (longest copyFrom:prefix size + 1). |
|
2182 |
]. |
|
2183 |
s nextPutLine:'<ul>'. |
|
2184 |
prefix := longest. |
|
2185 |
] ifFalse:[ |
|
2186 |
s nextPutLine:'</ul>'. |
|
2187 |
prefixStack notEmpty ifTrue:[ |
|
2188 |
prefixStack removeLast. |
|
2189 |
]. |
|
2190 |
||
2191 |
[prefixStack notEmpty |
|
2192 |
and:[(longest startsWith:prefixStack last) not]] whileTrue:[ |
|
2193 |
s nextPutLine:'</ul>'. |
|
2194 |
prefixStack removeLast. |
|
2195 |
]. |
|
2196 |
||
2197 |
prefixStack notEmpty ifTrue:[ |
|
2198 |
prefix := prefixStack last. |
|
2199 |
] ifFalse:[ |
|
2200 |
prefixStack addLast:longest. |
|
2201 |
prefix := longest. |
|
2202 |
longest ~= prev ifTrue:[ |
|
2203 |
prefixStack size == 1 ifTrue:[ |
|
2204 |
s nextPutLine:'<p>'. |
|
2205 |
]. |
|
2206 |
s nextPutLine:'<li>' , longest. |
|
2207 |
]. |
|
2208 |
s nextPutLine:'<ul>'. |
|
2209 |
] |
|
2210 |
]. |
|
2211 |
] |
|
2212 |
] ifFalse:[ |
|
4404 | 2213 |
[prefixStack size ~~ 0] whileTrue:[ |
2016 | 2214 |
s nextPutLine:'</ul>'. |
2215 |
prefixStack removeLast. |
|
2216 |
]. |
|
2217 |
prefixStack size == 0 ifTrue:[ |
|
2218 |
s nextPutLine:'<p>'. |
|
2219 |
]. |
|
2220 |
prefix := ''. |
|
2221 |
]. |
|
2222 |
||
2223 |
s nextPutAll:'<li>'. |
|
3644 | 2224 |
self generateDocumentForOfflineReading ifTrue:[ |
2225 |
s nextPutLine:(self |
|
2226 |
anchorFor: |
|
2227 |
((nm copyReplaceAll:$ with:$_) , '/index.html' ) |
|
2228 |
info: |
|
2229 |
('Classes in ' , nm) |
|
2230 |
text: |
|
2231 |
(nm copyFrom:prefix size + 1) |
|
2232 |
name:nil). |
|
2233 |
] ifFalse:[ |
|
2234 |
s nextPutLine:(self |
|
2016 | 2235 |
anchorForHTMLDocAction: |
2236 |
('htmlClassesListOfCategory:''', nm |
|
2237 |
, ''' backTo:''htmlClassCategoryList''') |
|
2238 |
info: |
|
2239 |
('Classes in ' , nm) |
|
2240 |
text: |
|
2241 |
(nm copyFrom:prefix size + 1)). |
|
3644 | 2242 |
]. |
2016 | 2243 |
|
2244 |
prev := nm. |
|
2245 |
]. |
|
2246 |
||
2247 |
s nextPutAll:' |
|
2248 |
</ul> |
|
2249 |
'. |
|
2250 |
self generateBODYandHTMLEnd. |
|
2251 |
||
2252 |
^ s contents |
|
2253 |
||
2254 |
" |
|
2255 |
HTMLDocGenerator new htmlClassCategoryList |
|
2256 |
" |
|
2257 |
||
4404 | 2258 |
"Created: / 22-04-1996 / 20:03:30 / cg" |
2259 |
"Modified: / 30-10-1997 / 13:16:08 / cg" |
|
2260 |
"Modified: / 01-03-2019 / 15:52:54 / Claus Gittinger" |
|
2016 | 2261 |
! |
2262 |
||
2263 |
htmlClassListPrefix:prefix |
|
2264 |
"generate an HTML document string which contains HREFS for a list |
|
2265 |
of classes which start with some prefix (typically, the first |
|
2266 |
character is given)" |
|
2267 |
||
2268 |
|classes| |
|
2269 |
||
2270 |
classes := Smalltalk allClasses |
|
2271 |
select:[:cls | |
|
2272 |
cls isPrivate not |
|
2273 |
and:[(cls isRealNameSpace not) |
|
2274 |
and:[cls name startsWith:prefix]] |
|
2275 |
]. |
|
2276 |
||
2277 |
^ self |
|
2278 |
htmlClasses:classes |
|
2279 |
title:('Classes starting with ''' , prefix asString , ''':'). |
|
2280 |
||
2281 |
"Created: / 22-04-1996 / 20:03:31 / cg" |
|
2282 |
"Modified: / 10-11-2006 / 17:11:16 / cg" |
|
2283 |
! |
|
2284 |
||
2285 |
htmlClasses:classes title:title |
|
2286 |
"generate an HTML document string which contains HREFS for a given list |
|
2287 |
of classes" |
|
2288 |
||
2289 |
^ self |
|
2290 |
htmlClasses:classes |
|
2291 |
title:title |
|
2292 |
backTo:nil |
|
2293 |
||
2294 |
"Modified: / 30.10.1997 / 13:21:40 / cg" |
|
2295 |
! |
|
2296 |
||
2297 |
htmlClasses:classes title:title backTo:backRef |
|
2298 |
"generate an HTML document string which contains HREFS for a given list |
|
2299 |
of classes. If backref is nonNil, a back-button to that |
|
2300 |
HREF is added at the top. |
|
2301 |
The generated page is supposed to be given to an HTML reader |
|
2302 |
with home being set to ../doc/online/xxx/classDoc |
|
2303 |
(i.e. the images are to be found one-up in the doc hierarchy)" |
|
2304 |
||
2305 |
|classNames s| |
|
2306 |
||
2307 |
classNames := (classes collect:[:cls | cls name]) asOrderedCollection sort. |
|
2308 |
||
2309 |
outStream := s := '' writeStream. |
|
2310 |
||
2311 |
self generateHTMLHeadWithTitle:title. |
|
2312 |
s nextPutLine:'<body>'. |
|
2313 |
backRef notNil ifTrue:[ |
|
2314 |
backRef ~~ #none ifTrue:[ |
|
2315 |
self |
|
2316 |
generateUpArrowButtonWithReference:(self pathToLanguageTopOfDocumentation , '/TOP.html') |
|
2317 |
command:backRef |
|
2318 |
imagePath:nil |
|
2319 |
altLabel:'back'. |
|
2320 |
] |
|
2321 |
] ifFalse:[ |
|
2322 |
self |
|
2323 |
generateUpArrowButtonWithReference:(self pathToLanguageTopOfDocumentation , '/TOP.html') |
|
2324 |
command:nil |
|
2325 |
imagePath:nil |
|
2326 |
altLabel:'top'. |
|
2327 |
]. |
|
2328 |
backRef ~~ #none ifTrue:[ |
|
2329 |
self generateHorizontalLine. |
|
2330 |
]. |
|
2331 |
self generateH1:title. |
|
2332 |
s nextPutLine:'<ul>'. |
|
2333 |
||
2334 |
classNames do:[:className | |
|
2335 |
s nextPutAll:'<li>'. |
|
2336 |
self generateClassDocReferenceFor:className. |
|
2337 |
s cr. |
|
2338 |
]. |
|
2339 |
||
2340 |
s nextPutAll:' |
|
2341 |
</ul> |
|
2342 |
'. |
|
2343 |
self generateBODYandHTMLEnd. |
|
2344 |
||
2345 |
^ s contents |
|
2346 |
||
2347 |
"Created: / 23.4.1996 / 15:31:55 / cg" |
|
2348 |
"Modified: / 30.10.1997 / 13:21:32 / cg" |
|
2349 |
! |
|
2350 |
||
2351 |
htmlClassesListOfCategory:category |
|
2352 |
"generate an HTML document string which contains HREFS for a list |
|
2353 |
of classes which are contained in a particular category." |
|
2354 |
||
2355 |
^ self |
|
2356 |
htmlClassesListOfCategory:category |
|
2357 |
backTo:nil |
|
2358 |
||
2359 |
"Modified: / 30.10.1997 / 13:21:23 / cg" |
|
2360 |
! |
|
2361 |
||
2362 |
htmlClassesListOfCategory:category backTo:backRef |
|
2363 |
"generate an HTML document string which contains HREFS for a list |
|
2364 |
of classes which are contained in a particular category." |
|
2365 |
||
2366 |
|classes| |
|
2367 |
||
2368 |
classes := Smalltalk allClasses |
|
2369 |
select:[:cls | cls isPrivate not |
|
2370 |
and:[(cls isRealNameSpace not) |
|
2371 |
and:[cls category = category]] |
|
2372 |
]. |
|
2373 |
||
2374 |
^ self |
|
2375 |
htmlClasses:classes |
|
2376 |
title:('Classes in: ' , category) |
|
2377 |
backTo:backRef |
|
2378 |
||
2379 |
"Created: / 23-04-1996 / 15:39:39 / cg" |
|
2380 |
"Modified: / 10-11-2006 / 17:11:23 / cg" |
|
2381 |
! |
|
2382 |
||
2383 |
htmlClassesMatching:aMatchPattern backTo:backRef |
|
2384 |
"generate an HTML document string which contains HREFS |
|
2385 |
for a list of classes whose name matches a given matchPattern." |
|
2386 |
||
2387 |
|classes cls| |
|
2388 |
||
2389 |
classes := Smalltalk allClasses |
|
2390 |
select:[:cls | cls isPrivate not |
|
2391 |
and:[(cls isRealNameSpace not) |
|
2392 |
and:[aMatchPattern match:cls name]] |
|
2393 |
]. |
|
2394 |
||
2395 |
^ self |
|
2396 |
htmlClasses:classes |
|
2397 |
title:('Classes matching: ' , aMatchPattern) |
|
2398 |
backTo:backRef |
|
2399 |
||
2400 |
" |
|
2401 |
self htmlClassesMatching:'Tgen::*' backTo:nil |
|
2402 |
" |
|
2403 |
||
2404 |
"Modified: / 10-11-2006 / 17:11:30 / cg" |
|
2405 |
! |
|
2406 |
||
4106 | 2407 |
htmlKWOCListFor:aKWIC |
2408 |
"generate a formatted list of all keywords in context from class documentation |
|
2409 |
as an HTML string. |
|
2410 |
Each keword will be a hyperlinked to another |
|
2411 |
autogenerated page, containing the classes documentation. |
|
2412 |
The generated page is supposed to be given to an HTML reader |
|
2413 |
with home being set to ../doc/online/xxx/classDoc |
|
2414 |
(i.e. the images are to be found one-up in the doc hierarchy)" |
|
2415 |
||
4108 | 2416 |
|prevWord caseMapping| |
4106 | 2417 |
|
2418 |
outStream := '' writeStream. |
|
2419 |
||
2420 |
self generateHTMLHeadWithTitle:'Keyword Index:'. |
|
2421 |
self generateBODYStart. |
|
2422 |
self generateUpArrowButtonForTop. |
|
2423 |
self generateHorizontalLine. |
|
2424 |
||
2425 |
self generateH1:'Keywords:'. |
|
2426 |
outStream nextPutLine:'<dl>'. |
|
2427 |
prevWord := nil. |
|
4108 | 2428 |
|
2429 |
caseMapping := Dictionary new. |
|
2430 |
aKWIC entriesDo:[:word :left :right :class| |
|
2431 |
|lcWord wordAlready| |
|
2432 |
||
2433 |
lcWord := word asLowercase. |
|
2434 |
lcWord ~= word ifTrue:[ |
|
2435 |
wordAlready := caseMapping at:lcWord ifAbsent:[nil]. |
|
2436 |
wordAlready isNil ifTrue:[ |
|
2437 |
caseMapping at:lcWord put:word |
|
2438 |
]. |
|
2439 |
]. |
|
2440 |
]. |
|
2441 |
||
4127 | 2442 |
aKWIC matchSorter:[:a :b | a key < b key]. |
4108 | 2443 |
|
4127 | 2444 |
aKWIC entriesDo:[:word :left :right :classOrMethod| |
4106 | 2445 |
|ref lcWord ctx| |
2446 |
||
4109 | 2447 |
ctx := (HTMLUtilities escapeCharacterEntities:(left contractAtBeginningTo:25)) |
4124 | 2448 |
, ' <b>',(HTMLUtilities escapeCharacterEntities:word),'</b> ' |
4109 | 2449 |
,(HTMLUtilities escapeCharacterEntities:(right contractAtEndTo:25)). |
4106 | 2450 |
|
2451 |
lcWord := word asLowercase. |
|
2452 |
lcWord ~= prevWord ifTrue:[ |
|
2453 |
prevWord notNil ifTrue:[ |
|
2454 |
outStream nextPutLine:'</ul></dd>'. |
|
2455 |
]. |
|
4108 | 2456 |
"/ outStream nextPutLine:'<dt>',(HTMLUtilities escapeCharacterEntities:(caseMapping at:lcWord ifAbsent:[word])),'</dt>'. |
2457 |
outStream nextPutLine:'<dt>',(HTMLUtilities escapeCharacterEntities:word),'</dt>'. |
|
4106 | 2458 |
outStream nextPutLine:'<dd><ul><li>'. |
4127 | 2459 |
classOrMethod isBehavior ifTrue:[ |
2460 |
self generateClassDocReferenceFor:classOrMethod name. |
|
2461 |
] ifFalse:[ |
|
2462 |
self generateMethodDocReferenceFor:classOrMethod selector inClass:classOrMethod mclass name text:classOrMethod selector autoloading:nil. |
|
2463 |
]. |
|
4108 | 2464 |
outStream nextPutAll:'<tab indent=300>'. |
4106 | 2465 |
outStream nextPutLine:ctx. |
2466 |
outStream nextPutLine:'</li>'. |
|
2467 |
prevWord := lcWord. |
|
2468 |
] ifFalse:[ |
|
2469 |
outStream nextPutLine:'</li><li>'. |
|
4127 | 2470 |
classOrMethod isBehavior ifTrue:[ |
2471 |
self generateClassDocReferenceFor:classOrMethod name. |
|
2472 |
] ifFalse:[ |
|
2473 |
self generateMethodDocReferenceFor:classOrMethod selector inClass:classOrMethod mclass name text:classOrMethod selector autoloading:nil. |
|
2474 |
]. |
|
4108 | 2475 |
outStream nextPutAll:'<tab indent=300>'. |
4106 | 2476 |
outStream nextPutLine:ctx. |
2477 |
outStream nextPutLine:'</li>'. |
|
2478 |
]. |
|
2479 |
]. |
|
2480 |
outStream nextPutLine:'</ul></dd>'. |
|
2481 |
outStream nextPutLine:'</dl>'. |
|
2482 |
||
2483 |
self generateBODYandHTMLEnd. |
|
2484 |
^ outStream contents |
|
2485 |
! |
|
2486 |
||
2017 | 2487 |
htmlPackageDocOf:packageID |
2488 |
|classes| |
|
2489 |
||
2490 |
classes := Smalltalk allClassesInPackage:packageID. |
|
2491 |
classes := classes reject:[:cls | cls isPrivate]. |
|
2492 |
^ self htmlClasses: classes title:'Classes in package ',packageID backTo:nil |
|
2493 |
! |
|
2494 |
||
2018 | 2495 |
htmlPackageList |
4122 | 2496 |
"generate an HTML string for a list of all packages in the system" |
2497 |
||
2498 |
^ self |
|
2499 |
htmlPackageListFor:(Smalltalk allPackageIDs) |
|
2500 |
withDocumentation:true "/ false |
|
2501 |
||
2502 |
" |
|
2503 |
self new |
|
2504 |
generateDocumentForOfflineReading:true; |
|
2505 |
htmlPackageList. |
|
2506 |
" |
|
2507 |
! |
|
2508 |
||
2509 |
htmlPackageListFor:packageNames withDocumentation:withDocumentation |
|
2510 |
"generate an HTML string for a given list of packages" |
|
2018 | 2511 |
|
2512 |
|s| |
|
2513 |
||
2514 |
s := outStream := '' writeStream. |
|
2515 |
||
2516 |
self generateHTMLHeadWithTitle:'Package Index'. |
|
2517 |
self generateBODYStart. |
|
2518 |
||
2519 |
self generateUpArrowButtonForTop. |
|
2520 |
self generateHorizontalLine. |
|
2521 |
self generateH1:'Package Index'. |
|
2522 |
s nextPutLine:'<ul>'. |
|
2523 |
||
4122 | 2524 |
packageNames |
2018 | 2525 |
do:[:p | |
2526 |
|pckgString| |
|
2527 |
||
3644 | 2528 |
(p startsWith:'__') ifFalse:[ |
2529 |
s nextPutAll:'<li>'. |
|
2530 |
pckgString := self withSpecialHTMLCharactersEscaped:p. |
|
2531 |
self generateDocumentForOfflineReading ifTrue:[ |
|
2532 |
s nextPutLine:(self |
|
2533 |
anchorFor: |
|
2534 |
((p copyReplaceAll:$: with:$/) , '/index.html' ) |
|
2535 |
info: |
|
2536 |
('Classes in Package: ' , pckgString) |
|
2537 |
text: |
|
2538 |
pckgString |
|
2539 |
name:nil). |
|
2540 |
] ifFalse:[ |
|
2541 |
s nextPutLine:(self |
|
2542 |
anchorForHTMLDocAction: |
|
2543 |
('htmlPackageDocOf:''' , pckgString , '''' ) |
|
2544 |
info: |
|
2545 |
('Classes in Package: ' , pckgString) |
|
2546 |
text: |
|
2547 |
pckgString). |
|
2548 |
]. |
|
2549 |
]. |
|
2018 | 2550 |
]. |
2551 |
||
2552 |
s nextPutLine:'</ul>'. |
|
2553 |
self generateBODYandHTMLEnd. |
|
2554 |
||
2555 |
^ s contents |
|
3644 | 2556 |
|
2557 |
" |
|
2558 |
self new |
|
2559 |
generateDocumentForOfflineReading:true; |
|
2560 |
htmlPackageList. |
|
2561 |
" |
|
2018 | 2562 |
! |
2563 |
||
2016 | 2564 |
htmlSelectorList |
2565 |
"generate an HTML string for all selectors (for which methods exist) |
|
2566 |
in the system" |
|
2567 |
||
2568 |
|selectors| |
|
2569 |
||
2570 |
selectors := IdentitySet new. |
|
2571 |
Smalltalk allClassesAndMetaclassesDo:[:cls | |
|
2572 |
selectors addAll:cls selectors. |
|
2573 |
]. |
|
2574 |
selectors := selectors asOrderedCollection sort. |
|
2575 |
||
2576 |
^ self |
|
2577 |
htmlSelectors:selectors |
|
2578 |
title:('All Selectors:'). |
|
2579 |
||
2580 |
" |
|
2581 |
self htmlSelectorList |
|
2582 |
" |
|
2583 |
||
2584 |
"Created: / 22.4.1996 / 20:03:31 / cg" |
|
2585 |
"Modified: / 5.6.1996 / 12:27:09 / stefan" |
|
2586 |
"Modified: / 30.10.1997 / 13:25:19 / cg" |
|
2587 |
! |
|
2588 |
||
2589 |
htmlSelectorListMatching:pattern |
|
2590 |
"generate an HTML string for all selectors which match a pattern |
|
2591 |
(and for which methods exist) in the system" |
|
2592 |
||
2593 |
|selectors| |
|
2594 |
||
2595 |
selectors := IdentitySet new. |
|
2596 |
Smalltalk allClassesAndMetaclassesDo:[:cls | |
|
4211 | 2597 |
cls selectorsDo:[:sel | |
2016 | 2598 |
(pattern match:sel) ifTrue:[ |
2599 |
selectors add:sel. |
|
2600 |
] |
|
2601 |
] |
|
2602 |
]. |
|
2603 |
selectors := selectors asOrderedCollection sort. |
|
2604 |
||
2605 |
^ self |
|
2606 |
htmlSelectors:selectors |
|
2607 |
title:('Selectors matching ''' , pattern , ''':'). |
|
2608 |
||
2609 |
" |
|
2610 |
self htmlSelectorListMatching:'*do*' |
|
2611 |
" |
|
2612 |
||
4211 | 2613 |
"Created: / 22-04-1996 / 20:03:31 / cg" |
2614 |
"Modified: / 05-06-1996 / 12:29:27 / stefan" |
|
2615 |
"Modified: / 10-02-2017 / 10:32:37 / cg" |
|
2016 | 2616 |
! |
2617 |
||
2618 |
htmlSelectorListPrefix:prefix |
|
2619 |
"generate an HTML string for all selectors whose names starts with |
|
2620 |
a prefix (and for which methods exist) in the system" |
|
2621 |
||
2622 |
|selectors| |
|
2623 |
||
2624 |
selectors := IdentitySet new. |
|
2625 |
Smalltalk allClassesAndMetaclassesDo:[:cls | |
|
4211 | 2626 |
cls selectorsDo:[:sel | |
2016 | 2627 |
(sel startsWith:prefix) ifTrue:[ |
2628 |
selectors add:sel. |
|
2629 |
] |
|
2630 |
] |
|
2631 |
]. |
|
2632 |
selectors := selectors asOrderedCollection sort. |
|
2633 |
||
2634 |
^ self |
|
2635 |
htmlSelectors:selectors |
|
2636 |
title:('Selectors starting with ''' , prefix asString , ''':'). |
|
2637 |
||
2638 |
" |
|
2639 |
self htmlSelectorListPrefix:'a' |
|
2640 |
" |
|
2641 |
||
4211 | 2642 |
"Created: / 22-04-1996 / 20:03:31 / cg" |
2643 |
"Modified: / 05-06-1996 / 12:31:13 / stefan" |
|
2644 |
"Modified: / 10-02-2017 / 10:32:31 / cg" |
|
2016 | 2645 |
! |
2646 |
||
2647 |
htmlSelectors:selectors title:title |
|
2648 |
"generate an HTML string for a given list of selectors" |
|
2649 |
||
2650 |
|s| |
|
2651 |
||
2652 |
s := outStream := '' writeStream. |
|
2653 |
||
2654 |
self generateHTMLHeadWithTitle:title. |
|
2655 |
self generateBODYStart. |
|
2656 |
||
2657 |
self generateUpArrowButtonForTop. |
|
2658 |
self generateHorizontalLine. |
|
2659 |
self generateH1:title. |
|
2660 |
s nextPutLine:'<ul>'. |
|
2661 |
||
2662 |
selectors do:[:sel | |
|
2663 |
|selString| |
|
2664 |
||
2665 |
selString := self withSpecialHTMLCharactersEscaped:sel. |
|
2666 |
s nextPutAll:'<li>'. |
|
2667 |
s nextPutLine:(self |
|
2668 |
anchorForHTMLDocAction: |
|
2669 |
('htmlDocOfImplementorsOf:''' , selString , '''' ) |
|
2670 |
info: |
|
2671 |
('Implementors of: ' , selString) |
|
2672 |
text: |
|
2673 |
selString). |
|
2674 |
]. |
|
2675 |
||
2676 |
s nextPutLine:'</ul>'. |
|
2677 |
self generateBODYandHTMLEnd. |
|
2678 |
||
2679 |
^ s contents |
|
2680 |
||
2681 |
"Created: / 22.4.1996 / 20:03:31 / cg" |
|
2682 |
"Modified: / 30.10.1997 / 13:26:34 / cg" |
|
478 | 2683 |
! ! |
2684 |
||
1265 | 2685 |
!HTMLDocGenerator methodsFor:'format conversion-man pages'! |
575 | 2686 |
|
2687 |
manPageFor:aCommand |
|
632 | 2688 |
"generate a (unix-) man page for a given command & convert the output to html" |
575 | 2689 |
|
2690 |
^ self |
|
2691 |
manPageFor:aCommand |
|
2692 |
inSection:nil |
|
2693 |
||
632 | 2694 |
"Modified: / 30.10.1997 / 13:29:31 / cg" |
575 | 2695 |
! |
2696 |
||
2697 |
manPageFor:aCommand inSection:sectionOrNil |
|
632 | 2698 |
"generate a (unix-) man page for some entry in a section |
575 | 2699 |
& convert the output to html" |
2700 |
||
2701 |
|manCmd| |
|
2702 |
||
2703 |
sectionOrNil isNil ifTrue:[ |
|
2704 |
manCmd := 'man ' , aCommand |
|
2705 |
] ifFalse:[ |
|
2706 |
manCmd := 'man ' , sectionOrNil printString , ' ' , aCommand |
|
2707 |
]. |
|
2708 |
^ self |
|
2709 |
manPageFor:aCommand |
|
2710 |
manCommand:manCmd. |
|
2711 |
||
632 | 2712 |
"Created: / 9.9.1996 / 17:45:08 / cg" |
2713 |
"Modified: / 30.10.1997 / 13:29:44 / cg" |
|
575 | 2714 |
! |
2715 |
||
2716 |
manPageFor:aCommand manCommand:manCommand |
|
577 | 2717 |
"convert man-command output to html. |
632 | 2718 |
Only the body of the text (without head../head and body../body) is generated" |
575 | 2719 |
|
1249 | 2720 |
|manPageStream text| |
575 | 2721 |
|
1249 | 2722 |
manPageStream := PipeStream readingFrom:manCommand. |
2723 |
manPageStream notNil ifTrue:[ |
|
2724 |
[ |
|
2725 |
text := self manPageFromStream:manPageStream. |
|
2726 |
] ensure:[ |
|
4117 | 2727 |
manPageStream abortAndClose. |
1249 | 2728 |
] |
575 | 2729 |
]. |
2730 |
||
1249 | 2731 |
text isEmptyOrNil ifTrue:[ |
2732 |
^ self noManPageForCommand:aCommand usingManCommand:manCommand. |
|
575 | 2733 |
]. |
2734 |
||
1249 | 2735 |
^ '<pre> |
2736 |
' , text , ' |
|
575 | 2737 |
</pre> |
2738 |
' |
|
2739 |
||
2740 |
" |
|
2741 |
self manPageFor:'cvs' |
|
2742 |
" |
|
2743 |
||
632 | 2744 |
"Modified: / 28.6.1996 / 21:28:47 / stefan" |
2745 |
"Created: / 9.9.1996 / 17:43:16 / cg" |
|
2746 |
"Modified: / 30.10.1997 / 13:30:22 / cg" |
|
575 | 2747 |
! |
2748 |
||
2749 |
manPageForFile:aFilename |
|
2750 |
"convert a .man file to html" |
|
2751 |
||
2752 |
^ self |
|
2753 |
manPageFor:aFilename asFilename name |
|
2754 |
manCommand:('nroff -man ' , aFilename asFilename pathName). |
|
2755 |
||
2756 |
" |
|
2757 |
self manPageForFile:'../../stc/stc.1' |
|
2758 |
" |
|
2759 |
" |
|
2760 |
HTMLDocumentView openFullOnText:(self manPageForFile:'../../stc/stc.1') |
|
2761 |
" |
|
2762 |
||
2763 |
"Modified: 4.4.1997 / 10:44:05 / cg" |
|
1249 | 2764 |
! |
2765 |
||
2766 |
manPageFromStream:manPageStream |
|
2767 |
"convert man-command output to html. |
|
2768 |
Only the body of the text (without head../head and body../body) is generated. |
|
2769 |
This method looks for |
|
2770 |
char-backspace-char -> bold |
|
2771 |
char-backspace-underline -> italic" |
|
2772 |
||
2773 |
|state ch keep| |
|
2774 |
||
2775 |
outStream := '' writeStream. |
|
2776 |
state := nil. |
|
2777 |
keep := nil. |
|
2778 |
[manPageStream atEnd] whileFalse:[ |
|
2779 |
ch := manPageStream next. |
|
2780 |
||
2781 |
ch notNil ifTrue:[ |
|
4197 | 2782 |
state isNil ifTrue:[ |
1249 | 2783 |
ch == Character backspace ifTrue:[ |
2784 |
state := #back |
|
2785 |
] ifFalse:[ |
|
2786 |
keep notNil ifTrue:[ |
|
2787 |
self nextPutAllEscaped:keep. |
|
2788 |
]. |
|
2789 |
keep := ch |
|
2790 |
] |
|
2791 |
] ifFalse:[ |
|
2792 |
state == #back ifTrue:[ |
|
2793 |
ch == keep ifTrue:[ |
|
2794 |
self nextPutBold:ch. |
|
2795 |
] ifFalse:[ |
|
2796 |
ch == $_ ifTrue:[ |
|
2797 |
keep notNil ifTrue:[ |
|
2798 |
self nextPutItalic:keep. |
|
2799 |
]. |
|
2800 |
] ifFalse:[ |
|
2801 |
keep == $_ ifTrue:[ |
|
2802 |
self nextPutItalic:ch. |
|
2803 |
] ifFalse:[ |
|
2804 |
keep notNil ifTrue:[ |
|
2805 |
self nextPutAllEscaped:keep. |
|
2806 |
self nextPutAllEscaped:ch. |
|
2807 |
]. |
|
2808 |
]. |
|
2809 |
]. |
|
2810 |
]. |
|
2811 |
state := keep := nil. |
|
2812 |
] |
|
2813 |
] |
|
2814 |
] |
|
2815 |
]. |
|
2816 |
||
2817 |
keep notNil ifTrue:[ |
|
2818 |
self nextPutAllEscaped:keep. |
|
2819 |
]. |
|
2820 |
^ outStream contents. |
|
2821 |
||
2822 |
" |
|
2823 |
HTMLDocGenerator new manPageFor:'cvs' |
|
2824 |
" |
|
2825 |
! |
|
2826 |
||
2827 |
noManPageForCommand:aCommand usingManCommand:manCommand |
|
2828 |
^ ' |
|
1923
57fbb3e512e3
generate valid HTML 4.01 transitional
Stefan Vogel <sv@exept.de>
parents:
1896
diff
changeset
|
2829 |
No manual page for "<code><b>' , aCommand , '</b></code>" available. |
1249 | 2830 |
<BR> |
1923
57fbb3e512e3
generate valid HTML 4.01 transitional
Stefan Vogel <sv@exept.de>
parents:
1896
diff
changeset
|
2831 |
(The failed command was: "<code>' , manCommand , '"</code>.) |
1249 | 2832 |
'. |
575 | 2833 |
! ! |
2834 |
||
1249 | 2835 |
!HTMLDocGenerator methodsFor:'helpers'! |
2836 |
||
1257
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2837 |
anchorFor:href info:infoMessageOrNil text:text name:nameOrNil |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2838 |
|infoPart namePart| |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2839 |
|
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2840 |
infoPart := namePart := ''. |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2841 |
|
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2842 |
infoMessageOrNil notNil ifTrue:[ |
1332
8838fb9735b0
added an onMouseOver to generate info (does not work yet ?)
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
2843 |
infoPart := self infoParameterFor:infoMessageOrNil. |
1257
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2844 |
]. |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2845 |
nameOrNil notNil ifTrue:[ |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2846 |
namePart := 'NAME="' , nameOrNil , '" '. |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2847 |
]. |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2848 |
^ '<A HREF="' , href , '" ' |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2849 |
, namePart |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2850 |
, infoPart |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2851 |
, '>' , text |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2852 |
,'</A>'. |
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 |
" |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2855 |
self new anchorFor:'foo' info:'bla' text:'text' name:nil |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2856 |
" |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2857 |
! |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2858 |
|
1249 | 2859 |
anchorForHTMLAction:actionString info:infoMessageOrNil text:text |
1250 | 2860 |
^ self |
2861 |
anchorForHTMLAction:actionString |
|
2862 |
info:infoMessageOrNil |
|
2863 |
text:text |
|
2864 |
name:nil |
|
1249 | 2865 |
|
1250 | 2866 |
" |
2867 |
self new anchorForHTMLAction:'foo' info:'bla' text:'text' |
|
2868 |
" |
|
2869 |
! |
|
2870 |
||
2871 |
anchorForHTMLAction:actionString info:infoMessageOrNil text:text name:nameOrNil |
|
2872 |
|infoPart namePart| |
|
2873 |
||
2874 |
infoPart := namePart := ''. |
|
2875 |
||
1249 | 2876 |
infoMessageOrNil notNil ifTrue:[ |
1332
8838fb9735b0
added an onMouseOver to generate info (does not work yet ?)
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
2877 |
infoPart := self infoParameterFor:infoMessageOrNil. |
1249 | 2878 |
]. |
1250 | 2879 |
nameOrNil notNil ifTrue:[ |
1923
57fbb3e512e3
generate valid HTML 4.01 transitional
Stefan Vogel <sv@exept.de>
parents:
1896
diff
changeset
|
2880 |
namePart := 'name="' , nameOrNil , '" '. |
1250 | 2881 |
]. |
1923
57fbb3e512e3
generate valid HTML 4.01 transitional
Stefan Vogel <sv@exept.de>
parents:
1896
diff
changeset
|
2882 |
^ '<a href="' , self pathToTopOfDocumentation , '/misc/onlyInSTX2.html" ' |
1250 | 2883 |
, namePart |
1249 | 2884 |
, infoPart |
1250 | 2885 |
, 'ACTION="html:' |
1249 | 2886 |
, actionString |
2887 |
, '">' , text |
|
1923
57fbb3e512e3
generate valid HTML 4.01 transitional
Stefan Vogel <sv@exept.de>
parents:
1896
diff
changeset
|
2888 |
,'</a>'. |
1249 | 2889 |
|
2890 |
" |
|
2891 |
self new anchorForHTMLAction:'foo' info:'bla' text:'text' |
|
2892 |
" |
|
2893 |
! |
|
2894 |
||
2895 |
anchorForHTMLDocAction:actionString info:infoMessageOrNil text:text |
|
2896 |
^ self |
|
1250 | 2897 |
anchorForHTMLDocAction:actionString |
2898 |
info:infoMessageOrNil |
|
2899 |
text:text |
|
2900 |
name:nil |
|
1249 | 2901 |
|
2902 |
" |
|
2903 |
self new anchorForHTMLDocAction:'foo' info:'bla' text:'text' |
|
2904 |
" |
|
2905 |
! |
|
2906 |
||
1250 | 2907 |
anchorForHTMLDocAction:actionString info:infoMessageOrNil text:text name:anchorName |
2908 |
^ self |
|
4450 | 2909 |
anchorForHTMLAction:(self className , ' ' , actionString) |
1250 | 2910 |
info:infoMessageOrNil |
2911 |
text:text |
|
2912 |
name:anchorName |
|
2913 |
||
2914 |
" |
|
2915 |
self new anchorForHTMLDocAction:'foo' info:'bla' text:'text' name:'baz' |
|
2916 |
" |
|
4450 | 2917 |
|
2918 |
"Modified: / 28-06-2019 / 09:01:11 / Claus Gittinger" |
|
1250 | 2919 |
! |
2920 |
||
1249 | 2921 |
anchorForHTMLDocAction:actionString text:text |
2922 |
^ self anchorForHTMLDocAction:actionString info:nil text:text |
|
2923 |
||
2924 |
" |
|
2925 |
self new anchorForHTMLDocAction:'foo' text:'text' |
|
2926 |
" |
|
2927 |
! |
|
478 | 2928 |
|
3643 | 2929 |
findPathToTopOfDocumentation |
2930 |
<resource: #obsolete> |
|
2931 |
^ self class findPathToTopOfDocumentation |
|
2932 |
! |
|
2933 |
||
1258
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2934 |
generateBODYEnd |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2935 |
generateBodyOnly == true ifFalse:[ |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2936 |
outStream nextPutLine:'</body>'. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2937 |
] |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2938 |
! |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2939 |
|
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2940 |
generateBODYStart |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2941 |
generateBodyOnly == true ifFalse:[ |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2942 |
outStream nextPutLine:'<body>'. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2943 |
] |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2944 |
! |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2945 |
|
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2946 |
generateBODYandHTMLEnd |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2947 |
self generateBODYEnd. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2948 |
self generateHTMLEnd. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2949 |
! |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2950 |
|
1328 | 2951 |
generateBackButton |
2952 |
|backHRef backLabel| |
|
2953 |
||
2954 |
backRef isNil ifTrue:[ |
|
2955 |
backHRef := self pathToLanguageTopOfDocumentation , '/TOP.html'. |
|
2956 |
backLabel := 'top'. |
|
2957 |
] ifFalse:[ |
|
2958 |
backHRef := backRef. |
|
2959 |
backLabel := 'back'. |
|
2960 |
]. |
|
2961 |
backCmd notNil ifTrue:[ |
|
2962 |
self |
|
2963 |
generateUpArrowButtonWithReference:backHRef |
|
2964 |
command:backCmd |
|
2965 |
imagePath:imagePath |
|
2966 |
altLabel:backLabel. |
|
2967 |
self generateHorizontalLine. |
|
2968 |
] ifFalse:[ |
|
2969 |
backHRef ~~ #none ifTrue:[ |
|
2970 |
self |
|
2971 |
generateUpArrowButtonWithReference:backHRef |
|
2972 |
command:nil |
|
2973 |
imagePath:imagePath |
|
2974 |
altLabel:backLabel. |
|
2975 |
self generateHorizontalLine. |
|
2976 |
] |
|
2977 |
]. |
|
2978 |
! |
|
2979 |
||
1250 | 2980 |
generateClassDocReferenceFor:className |
1258
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2981 |
self generateClassDocReferenceFor:className text:className |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2982 |
! |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2983 |
|
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
2984 |
generateClassDocReferenceFor:className text:text |
1337
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
2985 |
self generateClassDocReferenceFor:className text:text autoloading:nil |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
2986 |
! |
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
2987 |
|
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
2988 |
generateClassDocReferenceFor:className text:text autoloading:autoloadedClass |
2017 | 2989 |
"generates a link to a classes documentation" |
2990 |
||
1337
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
2991 |
|href serviceLinkName action| |
1257
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
2992 |
|
3643 | 2993 |
self generatingForSTXBrowser ifTrue:[ |
4450 | 2994 |
action := self className , ' htmlDocOf:' , className. |
3643 | 2995 |
autoloadedClass notNil ifTrue:[ |
2996 |
action := autoloadedClass , ' autoload,', action. |
|
2997 |
]. |
|
2998 |
||
2999 |
href := self |
|
3000 |
anchorForHTMLAction:action |
|
3001 |
info:('Show documentation of ' , className ) |
|
3002 |
text:text. |
|
3003 |
] ifFalse:[ |
|
2017 | 3004 |
"/ page is generated for a real http service; |
3005 |
"/ generate a link to the services classDocOf page, |
|
3006 |
"/ Assumes that the server has a classDoc service running. |
|
1310 | 3007 |
httpRequestOrNil notNil ifTrue:[ |
3008 |
serviceLinkName := httpRequestOrNil serviceLinkName. |
|
3009 |
]. |
|
1257
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3010 |
href := self |
2002 | 3011 |
anchorFor:(serviceLinkName, '/classDocOf,', (HTMLUtilities escape:className) ) |
1257
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3012 |
info:('Show documentation of ' , className ) |
1258
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3013 |
text:text |
1257
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3014 |
name:nil |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3015 |
]. |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3016 |
|
1337
5d537c9b1326
references (related information)
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
3017 |
outStream nextPutAll:href. |
4450 | 3018 |
|
3019 |
"Modified: / 28-06-2019 / 09:01:15 / Claus Gittinger" |
|
1250 | 3020 |
! |
3021 |
||
1249 | 3022 |
generateH1:headerLine |
3023 |
outStream nextPutLine:'<h1>'. |
|
3024 |
outStream nextPutLine:headerLine. |
|
3025 |
outStream nextPutLine:'</h1>'. |
|
3026 |
! |
|
3027 |
||
1258
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3028 |
generateHTMLEnd |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3029 |
generateBodyOnly == true ifFalse:[ |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3030 |
outStream nextPutLine:'</html>' |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3031 |
] |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3032 |
! |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3033 |
|
1249 | 3034 |
generateHTMLHeadWithTitle:title |
3643 | 3035 |
|generatedByComment| |
3036 |
||
4450 | 3037 |
generatedByComment := ('<!!-- generated by ' , self className , ' ' , thisContext sender selector , ' -->'). |
3643 | 3038 |
|
1258
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3039 |
generateBodyOnly == true ifFalse:[ |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3040 |
outStream |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3041 |
nextPutLine:'<!!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">'; |
3643 | 3042 |
nextPutLine:generatedByComment; |
1258
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3043 |
cr; |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3044 |
nextPutLine:'<html>'; |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3045 |
nextPutLine:'<head>'; |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3046 |
nextPutLine:'<title>'; |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3047 |
nextPutLine:title; |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3048 |
nextPutLine:'</title>'; |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3049 |
nextPutLine:'</head>'; |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3050 |
cr. |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3051 |
] ifTrue:[ |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3052 |
outStream |
3643 | 3053 |
nextPutLine:generatedByComment |
1258
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3054 |
]. |
4450 | 3055 |
|
3056 |
"Modified: / 28-06-2019 / 09:01:25 / Claus Gittinger" |
|
1249 | 3057 |
! |
3058 |
||
3059 |
generateHorizontalLine |
|
3060 |
outStream nextPutLine:'<hr>'. |
|
3061 |
! |
|
3062 |
||
4127 | 3063 |
generateMethodDocReferenceFor:selector inClass:className text:text autoloading:autoloadedClass |
3064 |
"generates a link to a classes documentation" |
|
3065 |
||
3066 |
|href serviceLinkName action| |
|
3067 |
||
3068 |
self generatingForSTXBrowser ifTrue:[ |
|
4450 | 3069 |
action := self className , ' htmlDocOf:' , className. |
4127 | 3070 |
autoloadedClass notNil ifTrue:[ |
3071 |
action := autoloadedClass , ' autoload,', action. |
|
3072 |
]. |
|
3073 |
||
3074 |
href := self |
|
3075 |
anchorForHTMLAction:action |
|
3076 |
info:('Show documentation of ' , className ) |
|
3077 |
text:text. |
|
3078 |
] ifFalse:[ |
|
3079 |
"/ page is generated for a real http service; |
|
3080 |
"/ generate a link to the services classDocOf page, |
|
3081 |
"/ Assumes that the server has a classDoc service running. |
|
3082 |
httpRequestOrNil notNil ifTrue:[ |
|
3083 |
serviceLinkName := httpRequestOrNil serviceLinkName. |
|
3084 |
]. |
|
3085 |
href := self |
|
3086 |
anchorFor:(serviceLinkName, '/classDocOf,', (HTMLUtilities escape:className) ) |
|
3087 |
info:('Show documentation of ' , className ) |
|
3088 |
text:text |
|
3089 |
name:nil |
|
3090 |
]. |
|
3091 |
||
3092 |
outStream nextPutAll:href. |
|
4450 | 3093 |
|
3094 |
"Modified: / 28-06-2019 / 09:01:37 / Claus Gittinger" |
|
4127 | 3095 |
! |
3096 |
||
2017 | 3097 |
generatePackageDocReferenceFor:packageID text:text |
3098 |
"generates a link to a package documentation" |
|
3099 |
||
3100 |
|href serviceLinkName action| |
|
3101 |
||
3102 |
self generatingForSTXBrowser ifFalse:[ |
|
3644 | 3103 |
self generateDocumentForOfflineReading ifTrue:[ |
3104 |
href := self |
|
3105 |
anchorFor:(pathToTopOfDocumentation, '/packages/', (HTMLUtilities escape:packageID) ) |
|
3106 |
info:('Show documentation of package ' , packageID ) |
|
3107 |
text:text |
|
3108 |
name:nil |
|
3109 |
] ifFalse:[ |
|
3110 |
"/ page is generated for a real http service; |
|
3111 |
"/ generate a link to the services packageDocOf page, |
|
3112 |
"/ Assumes that the server has a classDoc service running. |
|
3113 |
httpRequestOrNil notNil ifTrue:[ |
|
3114 |
serviceLinkName := httpRequestOrNil serviceLinkName. |
|
3115 |
]. |
|
3116 |
href := self |
|
3117 |
anchorFor:(serviceLinkName, '/classListForPackage,', (HTMLUtilities escape:packageID) ) |
|
3118 |
info:('Show documentation of package ' , packageID ) |
|
3119 |
text:text |
|
3120 |
name:nil |
|
3121 |
] |
|
2017 | 3122 |
] ifTrue:[ |
4450 | 3123 |
action := self className , ' htmlPackageDocOf: #''' , packageID, ''''. |
2017 | 3124 |
href := self |
3125 |
anchorForHTMLAction:action |
|
3126 |
info:('Show documentation of package ' , packageID ) |
|
3127 |
text:text. |
|
3128 |
]. |
|
3129 |
||
3130 |
outStream nextPutAll:href. |
|
4450 | 3131 |
|
3132 |
"Modified: / 28-06-2019 / 09:01:41 / Claus Gittinger" |
|
2017 | 3133 |
! |
3134 |
||
1249 | 3135 |
generateUpArrowButtonForTop |
3644 | 3136 |
|top| |
3137 |
||
3138 |
self generateDocumentForOfflineReading ifTrue:[ |
|
3139 |
top := '../index.html'. |
|
3140 |
] ifFalse:[ |
|
3141 |
top := (self pathToLanguageTopOfDocumentation , '/TOP.html'). |
|
3142 |
]. |
|
3143 |
||
1249 | 3144 |
self |
3644 | 3145 |
generateUpArrowButtonWithReference:top |
1249 | 3146 |
command:nil |
3147 |
imagePath:nil |
|
3148 |
altLabel:'top' |
|
3149 |
! |
|
3150 |
||
3151 |
generateUpArrowButtonWithReference:backHRef command:backCmd imagePath:imagePath altLabel:altLabel |
|
1255 | 3152 |
|p| |
3153 |
||
3999 | 3154 |
self showUpButton ifFalse:[^ self]. |
3155 |
||
1923
57fbb3e512e3
generate valid HTML 4.01 transitional
Stefan Vogel <sv@exept.de>
parents:
1896
diff
changeset
|
3156 |
outStream nextPutAll:'<a class="noprint" href="' , backHRef , '"'. |
1249 | 3157 |
backCmd notNil ifTrue:[ |
4450 | 3158 |
outStream nextPutAll:' action="html:' , self className , ' ' , backCmd , '"'. |
1249 | 3159 |
]. |
1255 | 3160 |
p := imagePath. |
3161 |
p isNil ifTrue:[ |
|
3162 |
p := self pathToTopOfDocumentation , '/icons' |
|
3163 |
]. |
|
1923
57fbb3e512e3
generate valid HTML 4.01 transitional
Stefan Vogel <sv@exept.de>
parents:
1896
diff
changeset
|
3164 |
outStream nextPutLine:'><img src="' , p , '/DocsUpArrow.gif" alt="[' , (altLabel ? 'back') , ']"></a>'. |
4450 | 3165 |
|
3166 |
"Modified: / 28-06-2019 / 09:01:59 / Claus Gittinger" |
|
1249 | 3167 |
! |
3168 |
||
1258
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3169 |
generatingForSTXBrowser |
3643 | 3170 |
self generateDocumentForOfflineReading ifTrue:[^ false]. |
1258
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3171 |
^ httpRequestOrNil isNil |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3172 |
! |
2efcd7c46179
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1257
diff
changeset
|
3173 |
|
1332
8838fb9735b0
added an onMouseOver to generate info (does not work yet ?)
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
3174 |
infoParameterFor:infoMessageOrNil |
8838fb9735b0
added an onMouseOver to generate info (does not work yet ?)
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
3175 |
infoMessageOrNil isNil ifTrue:[^ '']. |
8838fb9735b0
added an onMouseOver to generate info (does not work yet ?)
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
3176 |
|
1333 | 3177 |
^ |
1332
8838fb9735b0
added an onMouseOver to generate info (does not work yet ?)
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
3178 |
'ONMOUSEOVER="window.status=''',infoMessageOrNil,'''; return true" ' , |
1923
57fbb3e512e3
generate valid HTML 4.01 transitional
Stefan Vogel <sv@exept.de>
parents:
1896
diff
changeset
|
3179 |
'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
|
3180 |
! |
8838fb9735b0
added an onMouseOver to generate info (does not work yet ?)
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
3181 |
|
1308
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3182 |
methodCommentOf:aMethod |
3625 | 3183 |
"extract the very first comment from the method" |
3184 |
||
1308
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3185 |
|comment mClass mSel parseTree matcher| |
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3186 |
|
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3187 |
comment := aMethod comment. |
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3188 |
comment notNil ifTrue:[^ comment]. |
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3189 |
|
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3190 |
mClass := aMethod mclass. |
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3191 |
mClass isNil ifTrue:[^ nil]. |
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3192 |
|
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3193 |
mSel := aMethod selector. |
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3194 |
mSel isNil ifTrue:[^ nil]. |
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3195 |
|
4214 | 3196 |
"/ 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
|
3197 |
ParseTreeSearcher notNil ifTrue:[ |
1336 | 3198 |
aMethod messagesSent isEmpty ifTrue:[ |
1351 | 3199 |
parseTree := mClass parseTreeFor:mSel. |
3200 |
parseTree notNil ifTrue: [ |
|
3201 |
(mClass allInstanceVariableNames) do:[:eachVar | |
|
1336 | 3202 |
matcher := ParseTreeSearcher getterMethod:eachVar. |
1979 | 3203 |
(matcher executeTree: parseTree initialAnswer:false) ifTrue:[ |
1336 | 3204 |
^ 'Return the instance variable ' , eachVar, '.'. |
3205 |
]. |
|
1351 | 3206 |
|
1336 | 3207 |
matcher := ParseTreeSearcher setterMethod:eachVar. |
1979 | 3208 |
(matcher executeTree: parseTree initialAnswer:false) ifTrue:[ |
1336 | 3209 |
^ 'Set the instance variable ' , eachVar, '.'. |
3210 |
]. |
|
1308
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3211 |
]. |
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 |
]. |
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3214 |
]. |
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3215 |
|
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3216 |
"/ (mSuperClass := mClass superclass) notNil ifTrue:[ |
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3217 |
"/self halt. |
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3218 |
"/ ]. |
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3219 |
|
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3220 |
^ nil. |
4214 | 3221 |
|
3222 |
"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
|
3223 |
! |
08d6a08eee80
reflection to generate the comment for getters/setters
Claus Gittinger <cg@exept.de>
parents:
1289
diff
changeset
|
3224 |
|
3625 | 3225 |
methodExampleCommentsOf:aMethod |
3226 |
"extract the very last comment from the method" |
|
3227 |
||
3228 |
|comments partOfSelector| |
|
3229 |
||
3230 |
comments := aMethod parserClass methodCommentsFromSource:aMethod source. |
|
3231 |
comments size <= 1 ifTrue:[^ nil]. |
|
3232 |
||
3233 |
"/ look for comments which make up valid source code in the method's language |
|
3234 |
||
3235 |
partOfSelector := aMethod selector. |
|
3236 |
(partOfSelector includes:$:) ifTrue:[ |
|
3237 |
partOfSelector := partOfSelector copyTo:(partOfSelector indexOf:$:) |
|
3238 |
]. |
|
3239 |
comments := (comments from:2) |
|
3240 |
select:[:each | |
|
3241 |
(each includesString:partOfSelector) |
|
3242 |
and:[ |
|
3243 |
|rslt| |
|
3244 |
||
4481 | 3245 |
rslt := [ aMethod parserClass parseExpression:each onError:#Error] on:Error do:#Error. |
3625 | 3246 |
rslt ~~ #Error. |
3247 |
]. |
|
3248 |
]. |
|
3249 |
^ comments. |
|
3250 |
! |
|
3251 |
||
1249 | 3252 |
nextPutAllEscaped:aStringOrCharacter |
3253 |
outStream nextPutAll:(self withSpecialHTMLCharactersEscaped:aStringOrCharacter) |
|
3254 |
! |
|
3255 |
||
3256 |
nextPutBold:aStringOrCharacter |
|
3257 |
outStream nextPutAll:'<b>'. |
|
3258 |
self nextPutAllEscaped:aStringOrCharacter. |
|
3259 |
outStream nextPutAll:'</b>'. |
|
3260 |
! |
|
3261 |
||
3262 |
nextPutItalic:aStringOrCharacter |
|
3263 |
outStream nextPutAll:'<i>'. |
|
3264 |
self nextPutAllEscaped:aStringOrCharacter. |
|
3265 |
outStream nextPutAll:'</i>'. |
|
3266 |
! |
|
3267 |
||
1974 | 3268 |
shownSubclassesOf:aClass |
3269 |
|subs| |
|
3270 |
||
3271 |
subs := aClass subclasses. |
|
3272 |
subs := subs select:[:cls | |def| |
|
2205
6a7e8629edd5
changed: #shownSubclassesOf:
Claus Gittinger <cg@exept.de>
parents:
2178
diff
changeset
|
3273 |
def := cls projectDefinitionClass. |
1974 | 3274 |
def isNil or:[def showClassDocumentationOf:cls]]. |
3275 |
subs := subs asOrderedCollection sort:[:a :b | a name < b name]. |
|
3276 |
^ subs |
|
3277 |
||
3278 |
"Created: / 05-11-2007 / 17:22:27 / cg" |
|
3279 |
! |
|
3280 |
||
1249 | 3281 |
withSpecialHTMLCharactersEscaped:aStringOrCharacter |
3915 | 3282 |
|string| |
3283 |
||
3284 |
string := aStringOrCharacter isString ifTrue:[aStringOrCharacter] ifFalse:[aStringOrCharacter asString]. |
|
3285 |
^ HTMLUtilities escapeCharacterEntities:string |
|
1249 | 3286 |
|
3287 |
" |
|
3288 |
self new withSpecialHTMLCharactersEscaped:'foo>' |
|
3289 |
self new withSpecialHTMLCharactersEscaped:$< |
|
3290 |
self new withSpecialHTMLCharactersEscaped:$A |
|
3291 |
" |
|
2327
99495bed5445
changed: #withSpecialHTMLCharactersEscaped:
Claus Gittinger <cg@exept.de>
parents:
2252
diff
changeset
|
3292 |
|
99495bed5445
changed: #withSpecialHTMLCharactersEscaped:
Claus Gittinger <cg@exept.de>
parents:
2252
diff
changeset
|
3293 |
"Modified: / 13-04-2011 / 23:11:16 / cg" |
478 | 3294 |
! ! |
3295 |
||
1255 | 3296 |
!HTMLDocGenerator methodsFor:'pathnames'! |
3297 |
||
1257
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3298 |
pathToDocumentationFile:relativeHref |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3299 |
|top| |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3300 |
|
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3301 |
top := self pathToLanguageTopOfDocumentation. |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3302 |
(top asFilename construct:relativeHref) exists ifTrue:[ |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3303 |
"unix format: used as URL" |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3304 |
^ top , '/' , relativeHref |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3305 |
]. |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3306 |
^ self pathToEnglishTopOfDocumentation , '/' , relativeHref |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3307 |
! |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3308 |
|
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3309 |
pathToEnglishTopOfDocumentation |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3310 |
"/ always unix-name convention (used as an URL) |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3311 |
^ self pathToTopOfDocumentation , '/english' |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3312 |
! |
af5c892477b7
classDocGeneration for webServer
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
3313 |
|
1255 | 3314 |
pathToLanguageTopOfDocumentation |
3315 |
|languageSpecificDocDirectory fn| |
|
3316 |
||
3317 |
pathToLanguageTopOfDocumentation isNil ifTrue:[ |
|
3318 |
pathToLanguageTopOfDocumentation := self pathToTopOfDocumentation. |
|
3319 |
languageSpecificDocDirectory := self class languageSpecificDocDirectory. |
|
3320 |
fn := pathToLanguageTopOfDocumentation asFilename construct:languageSpecificDocDirectory. |
|
3321 |
(fn exists and:[fn isDirectory]) ifTrue:[ |
|
3322 |
"/ always unix-name convention (used as an URL) |
|
3323 |
pathToLanguageTopOfDocumentation := pathToLanguageTopOfDocumentation , '/' , languageSpecificDocDirectory. |
|
3324 |
]. |
|
3325 |
]. |
|
3326 |
^ pathToLanguageTopOfDocumentation |
|
3327 |
! |
|
3328 |
||
3329 |
pathToTopOfDocumentation |
|
3330 |
pathToTopOfDocumentation isNil ifTrue:[ |
|
3643 | 3331 |
pathToTopOfDocumentation := self class findPathToTopOfDocumentation |
1255 | 3332 |
]. |
3333 |
^ pathToTopOfDocumentation |
|
3334 |
! ! |
|
3335 |
||
498 | 3336 |
!HTMLDocGenerator class methodsFor:'documentation'! |
478 | 3337 |
|
3338 |
version |
|
3915 | 3339 |
^ '$Header$' |
2178
af7b05dfeaae
changed: #languageSpecificDocDirectory
Claus Gittinger <cg@exept.de>
parents:
2055
diff
changeset
|
3340 |
! |
af7b05dfeaae
changed: #languageSpecificDocDirectory
Claus Gittinger <cg@exept.de>
parents:
2055
diff
changeset
|
3341 |
|
af7b05dfeaae
changed: #languageSpecificDocDirectory
Claus Gittinger <cg@exept.de>
parents:
2055
diff
changeset
|
3342 |
version_CVS |
3915 | 3343 |
^ '$Header$' |
478 | 3344 |
! ! |
3232
de4bd4dcb49f
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
2865
diff
changeset
|
3345 |