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