<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type"></head><body ><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt;"><div>Update fy on progress...<br></div><div><br></div><div><br></div><div>I now iterate down the Class tree for a CustomHelp class and write their contents to a stream as well.<br></div><div><br></div><div>The iteration step looks like this (code improvements most welcome):<br></div><div>I create an OrderedDictionary of the classes to traverse and then add a ReadWriteStream populated from a method call as the value in the Dictionary for each one.<br></div><div><br></div><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div><div>toFile: aCustomHelp<br></div><div>"write the pages of  aCustomHelp class and its subclasses to a .org file"<br></div><div><br></div><div>| oc d filename|<br></div><div><br></div><div>d := OrderedDictionary new.<br></div><div>oc := (aCustomHelp allSubclasses).<br></div><div>oc  addFirst: aCustomHelp.<br></div><div>oc do:[:each |     d add:(each -> nil)  ].<br></div><div><br></div><div>d keysDo: [:key | |ios|<br></div><div>      ios := self toStream: key.   <----ReadWriteStream for a class populated here<br></div><div>      d at: key put: ios.].<br></div><div><br></div><div>filename := ((aCustomHelp  name  asString), '.org').<br></div><div>StandardFileStream forceNewFileNamed: filename do: [ :file |   <----the various ReadWriteStreams are aggregated to a StandardFileStream and written to file<br></div><div>            d keysAndValuesDo:[:key :value |<br></div><div>                    file nextPutAll: value contents ]].<br></div><div><br></div><div><br></div><div>"do I need to close the StandardFileStream? " <br></div></div></blockquote><div><br></div><div>The "toStream:" method is just the previous method minus the file write.<br></div><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div><div>toStream: aCustomHelp<br></div><div><br></div><div>|ios recurse  break newline |<br></div><div>"write CustomHelp to a stream and return the stream"<br></div><div>newline := (Character cr asString).<br></div><div>break:= newline, newline.<br></div><div><br></div><div>ios := String streamContents:[:stream|<br></div><div>      stream nextPutAll: ( '*   ', aCustomHelp name asString , newline).<br></div><div>      recurse := [:help |<br></div><div>                        help pages do:[:each | | v  |<br></div><div>                        each asString first isUppercase<br></div><div>                        ifTrue:[<br></div><div>                              stream nextPutAll: ( '*  '  , each, break).<br></div><div>                              recurse value: (Smalltalk at: each)]<br></div><div>                        ifFalse:[<br></div><div>                              v := help perform: each.<br></div><div>                              stream nextPutAll: ( break, '** ' ,  (v title) , (Character cr asString), break , (v contents)  ,break).<br></div><div>]]].<br></div><div><br></div><div><br></div><div>recurse value: aCustomHelp<br></div><div>].<br></div><div>^ ios<br></div></div></blockquote><div><br></div><div>I am guessing there is a more efficient way to do this using just one stream, but if streams are cheap, why not.<br></div><div><br></div><div><br></div><div>Next up is to adjust the output formatting to reflect the nesting level of the classes.<br></div><div><br></div><div>cheers,<br></div><div><br></div><div><br></div><div><br></div></div><br></body></html>