HTMLDocGenerator.st
changeset 4122 c46c90d71fa9
parent 4117 f5366a92d4ac
child 4123 e8f971e8af3f
--- a/HTMLDocGenerator.st	Thu Nov 03 15:45:35 2016 +0100
+++ b/HTMLDocGenerator.st	Fri Nov 04 13:12:36 2016 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1996 by Claus Gittinger
               All Rights Reserved
@@ -48,10 +46,13 @@
 documentation
 "
     Generates HTML documentation for a class.
-    Although this is normally used with the SystemBrowser
-    (classes-generate documentation menu),
-    it may be useful on its own, to programatically generate
-    up-to-date documents from a classes source.
+    
+    This is used with the SystemBrowser (classes-generate documentation menu),
+    and the online documentation (which generates up-to-date documents just-in-time
+    out of the running system).
+    
+    It may also be useful, to programatically generate up-to-date documents 
+    into a folder of self contained html files (eg. for deployment).
 
     This generator extracts the documentation methods source
     (or comment), individual method comments (the first comment in
@@ -393,7 +394,7 @@
     kwic exclusionFilter:[:word | 
                 word size == 1
                 or:[ word conform:#isDigit ]].
-    
+
     Smalltalk allClassesDo:[:eachClass |
         |doc|
         
@@ -402,9 +403,24 @@
             kwic addLine:doc reference:eachClass ignoreCase:true.
         ].    
     ].
+
+    kwic remapKeywordsWith:[:oldKey :knownMappings |
+        |newKey|
+
+        5 to:oldKey size - 1 do:[:len |
+            newKey isNil ifTrue:[
+                (knownMappings includes:(oldKey copyTo:len)) ifTrue:[
+                    newKey := (oldKey copyTo:len).
+                ].
+            ].
+        ].
+        newKey ? oldKey.
+    ].
+
     ^ kwic
 
     "
+     CachedKWIC := nil.
      self generateKWIC
     "
 !
@@ -2362,7 +2378,21 @@
 !
 
 htmlPackageList
-    "generate an HTML string for a given list of selectors"
+    "generate an HTML string for a list of all packages in the system"
+
+    ^ self 
+        htmlPackageListFor:(Smalltalk allPackageIDs) 
+        withDocumentation:true "/ false
+
+    "
+     self new
+        generateDocumentForOfflineReading:true;
+        htmlPackageList.
+    "
+!
+
+htmlPackageListFor:packageNames withDocumentation:withDocumentation
+    "generate an HTML string for a given list of packages"
 
     |s|
 
@@ -2376,7 +2406,7 @@
     self generateH1:'Package Index'.
     s nextPutLine:'<ul>'.
 
-    Smalltalk allPackageIDs
+    packageNames
         do:[:p |
             |pckgString|