HTMLDocGenerator.st
changeset 907 1a6b647d1b43
parent 817 d139c73bedf2
child 917 c77bb2d56e05
--- a/HTMLDocGenerator.st	Fri Feb 18 15:38:52 2000 +0100
+++ b/HTMLDocGenerator.st	Thu Mar 02 15:03:29 2000 +0100
@@ -430,6 +430,38 @@
      these parts are displayed in courier and will be made executable.
      everything else is plain documentation text.
     "
+
+    ^ self
+        htmlDocOf:aClass 
+        back:backCmd 
+        backRef:backRef 
+        imagePath:'../icons'
+
+!
+
+htmlDocOf:aClass back:backCmd backRef:backRef imagePath:imagePath
+    "generate a nice HTML page from a class, with a back-reference
+     to a command or document.
+
+     Extract sections from the classes documentation method,
+     where the following lines start a special subsection:
+        [see also:]   - references to other classes and/or documents
+        [start with:] - one-liners to start a demonstration
+        [author:]     - author(s) of this class
+        [warning:]    - usage warnings if any
+        [hints:]      - usage hints if any
+     Each section ends with an empty line - however, for formatting,
+     a line consisting of a single backslash character will be converted
+     to an empty line.
+
+     Also extract examples from the classes example method,
+     where executable examples are made from sections enclosed in:
+        [exBegin]
+        ...
+        [exEnd]
+     these parts are displayed in courier and will be made executable.
+     everything else is plain documentation text.
+    "
         
     |supers s indent m docu examples firstIndent firstNonEmpty
      collectionOfCategories collectionOfClassCategories 
@@ -634,11 +666,11 @@
         backHRef := backRef
     ].
     backCmd notNil ifTrue:[
-        s nextPutAll:'<a NOPRINT HREF="' , backHRef , '" action="html:' , self name , ' ' , backCmd , '"> <IMG NOPRINT SRC="../icons/DocsUpArrow.gif" ALT="[back]"></A>'.
+        s nextPutAll:'<a NOPRINT HREF="' , backHRef , '" action="html:' , self name , ' ' , backCmd , '"> <IMG NOPRINT SRC="' , imagePath , '/DocsUpArrow.gif" ALT="[back]"></A>'.
         s nextPutLine:'<hr>'.
     ] ifFalse:[
         backHRef ~~ #none ifTrue:[
-            s nextPutAll:'<a NOPRINT HREF="' , backHRef , '"> <IMG NOPRINT SRC="../icons/DocsUpArrow.gif" ALT="[back]"></A>';cr.
+            s nextPutAll:'<a NOPRINT HREF="' , backHRef , '"> <IMG NOPRINT SRC="' , imagePath , '/DocsUpArrow.gif" ALT="[back]"></A>';cr.
             s nextPutLine:'<hr>'.
         ]
     ].
@@ -1320,7 +1352,11 @@
      and any method comments - without source; used to generate documentation
      pages"
 
-    ^ self printOutHTMLMethodProtocol:aMethod on:aStream showClassName:false classRef:false
+    ^ self 
+        printOutHTMLMethodProtocol:aMethod 
+        on:aStream 
+        showClassName:false 
+        classRef:false
 
     "Modified: 22.4.1996 / 18:01:56 / cg"
     "Created: 22.4.1996 / 20:03:30 / cg"
@@ -1331,6 +1367,21 @@
      and any method comments - without source; used to generate documentation
      pages"
 
+    ^ self
+        printOutHTMLMethodProtocol:aMethod 
+        on:aStream 
+        showClassName:showClassName 
+        classRef:withClassRef 
+        picturePath:'pictures'
+
+
+!
+
+printOutHTMLMethodProtocol:aMethod on:aStream showClassName:showClassName classRef:withClassRef picturePath:picturePath
+    "given the source in aString, print the methods message specification
+     and any method comments - without source; used to generate documentation
+     pages"
+
     |comment cls sel partStream args argStream who methodSpecLine first
      firstIndent firstNonEmpty isSubres isObsolete smallOrEmpty
      ballColor|
@@ -1399,7 +1450,7 @@
         ballColor := 'red'
     ].
 
-    aStream nextPutLine:'<IMG src="pictures/' , ballColor , '-ball' , smallOrEmpty , '.gif" alt="o " width=6 height=6>'.
+    aStream nextPutLine:'<IMG src="' , picturePath , '/' , ballColor , '-ball' , smallOrEmpty , '.gif" alt="o " width=6 height=6>'.
 
     sel := (sel copy
                         replChar:$< withString:'&lt;')
@@ -1720,5 +1771,5 @@
 !HTMLDocGenerator class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/HTMLDocGenerator.st,v 1.31 1999-08-25 13:24:53 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/HTMLDocGenerator.st,v 1.32 2000-03-02 14:03:29 cg Exp $'
 ! !