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