handle nameSpaces
authorpenk
Tue, 30 Sep 2003 10:26:44 +0200
changeset 1328 7bee978ad3bb
parent 1327 88045876c6ae
child 1329 91aaace92f86
handle nameSpaces
HTMLDocGenerator.st
--- a/HTMLDocGenerator.st	Thu Sep 25 19:18:26 2003 +0200
+++ b/HTMLDocGenerator.st	Tue Sep 30 10:26:44 2003 +0200
@@ -17,7 +17,7 @@
 Object subclass:#HTMLDocGenerator
 	instanceVariableNames:'outStream pathToTopOfDocumentation
 		pathToLanguageTopOfDocumentation httpRequestOrNil
-		generateBodyOnly'
+		generateBodyOnly backRef backCmd imagePath'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'System-Documentation'
@@ -764,7 +764,7 @@
         imagePath:(self pathToTopOfDocumentation , '/icons')
 !
 
-htmlDocOf:aClass back:backCmd backRef:backRef imagePath:imagePath
+htmlDocOf:aClass back:backCmdArg backRef:backRefArg imagePath:imagePathArg
     "generate a nice HTML page from a class, with a back-reference
      to a command or document.
 
@@ -789,14 +789,36 @@
     "
         
     |supers s indent m docu examples firstIndent firstNonEmpty
-     collectionOfCategories collectionOfClassCategories subs refLines demoLines warnLines hintLines
-     backHRef backLabel authorLines first wasLoaded didLoadBin
+     collectionOfCategories collectionOfClassCategories subs refLines demoLines warnLines hintLines authorLines first wasLoaded didLoadBin
      privateClasses owner className metaClass shortName shortMetaName|
 
+    backRef := backRefArg.
+    backCmd := backCmdArg.
+    imagePath := imagePathArg.
+
     aClass isNil ifTrue:[
         ^ ''  "/ just in case ...
     ].
 
+    outStream := s := '' writeStream.
+    className := aClass name.
+    shortName := aClass nameWithoutPrefix.
+    metaClass := aClass class.
+    shortMetaName := metaClass nameWithoutPrefix.
+
+    self generateHTMLHeadWithTitle:('Class: ' , className).
+    self generateBODYStart.
+    self generateBackButton.
+
+    aClass isNameSpace ifTrue:[
+        s nextPutLine:'<h1>'.
+        s nextPutAll:'NameSpace: ';
+          nextPutLine:(shortName).
+        s nextPutLine:'</h1>'.
+        self generateBODYandHTMLEnd.
+        ^ s contents.
+    ].
+
     (wasLoaded := aClass isLoaded) ifFalse:[
         "/ load it - but not a binary
         didLoadBin := Smalltalk loadBinaries.
@@ -814,10 +836,6 @@
 
     owner := aClass owningClass.
     privateClasses := aClass privateClassesSorted.
-    className := aClass name.
-    shortName := aClass nameWithoutPrefix.
-    metaClass := aClass class.
-    shortMetaName := metaClass nameWithoutPrefix.
 
     "/
     "/ extract documentation or comment, if there is any
@@ -975,36 +993,6 @@
                     asOrderedCollection sort:[:a :b | a name < b name].
     ].
 
-    outStream := s := '' writeStream.
-
-    self generateHTMLHeadWithTitle:('Class: ' , className).
-    self generateBODYStart.
-
-    backRef isNil ifTrue:[
-        backHRef := self pathToLanguageTopOfDocumentation , '/TOP.html'.
-        backLabel := 'top'.
-    ] ifFalse:[
-        backHRef := backRef.
-        backLabel := 'back'.
-    ].
-    backCmd notNil ifTrue:[
-        self
-            generateUpArrowButtonWithReference:backHRef 
-            command:backCmd 
-            imagePath:imagePath 
-            altLabel:backLabel.
-        self generateHorizontalLine.
-    ] ifFalse:[
-        backHRef ~~ #none ifTrue:[
-            self
-                generateUpArrowButtonWithReference:backHRef 
-                command:nil 
-                imagePath:imagePath 
-                altLabel:backLabel.
-            self generateHorizontalLine.
-        ]
-    ].
-
     s nextPutLine:'<h1>'.
     s nextPutAll:'Class: ';
       nextPutAll:'<a INFO="Open a Browser on ' , shortName , '" type="example" action="Smalltalk browseInClass:' , className , '">';
@@ -2132,6 +2120,35 @@
     self generateHTMLEnd.
 !
 
+generateBackButton
+    |backHRef backLabel|
+
+    backRef isNil ifTrue:[
+        backHRef := self pathToLanguageTopOfDocumentation , '/TOP.html'.
+        backLabel := 'top'.
+    ] ifFalse:[
+        backHRef := backRef.
+        backLabel := 'back'.
+    ].
+    backCmd notNil ifTrue:[
+        self
+            generateUpArrowButtonWithReference:backHRef 
+            command:backCmd 
+            imagePath:imagePath 
+            altLabel:backLabel.
+        self generateHorizontalLine.
+    ] ifFalse:[
+        backHRef ~~ #none ifTrue:[
+            self
+                generateUpArrowButtonWithReference:backHRef 
+                command:nil 
+                imagePath:imagePath 
+                altLabel:backLabel.
+            self generateHorizontalLine.
+        ]
+    ].
+!
+
 generateClassDocReferenceFor:className
     self generateClassDocReferenceFor:className text:className
 !
@@ -2372,5 +2389,5 @@
 !HTMLDocGenerator class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/HTMLDocGenerator.st,v 1.60 2003-09-22 18:12:48 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/HTMLDocGenerator.st,v 1.61 2003-09-30 08:26:44 penk Exp $'
 ! !