<!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>Hi Levente<br></div><div><br></div><div> <br>>Using #, works, but it is quite suboptimal. It'll result in the creation <br>>of many intermediate objects and will result in quadratic runtime. <br> <br>>An easy way to avoid that would be to write directly into the file stream, <br>>but Squeak's file streams are not write-buffered, so I advise against <br>>that. <br>>Instead, you should create an in-memory stream, and write data into that <br>>stream. Once done, write the contents of the stream into the file. <br> <br>>For example: <br> ><br>>| contents | <br>>contents := String streamContents: [ :stream | <br>>    <write stuff to the stream here with #nextPut:, #nextPutAll:, etc> ]. <br>>FileStream newFileNamed: <file name here> do: [ :file | <br>>    file nextPutAll: contents ] <br>  <br>>Levente</div><div><br></div><div><br></div><div>Thank you for the pointers.<br></div><div><br></div><div>Here is a stab at it with your recommendations:<br></div><div><br></div><div><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div>toTestFile: aCustomHelp<br></div><div><br></div><div>|ios filename recurse  break newline |<br></div><div><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>recurse value: aCustomHelp<br></div><div>].<br></div><div><br></div><div><br></div><div>filename := ((aCustomHelp  name  asString), '.org').<br></div><div>StandardFileStream forceNewFileNamed: filename do: [ :file |<br></div><div>        file nextPutAll: ios ].<br></div></blockquote><br></div><div><br></div><div>then:<br></div><div><br></div><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div>DocCustomHelpToOrg  toTestFile: PostgresV3Help.<br></div></blockquote><div><br></div><div>The output is beautiful org mode content, but only for that superclass.<br></div><div><br></div><div>The Help System treats subclasses of a CustomHelp class as 'books'.<br></div><div><br></div><div>I am going to try to figure out how to do that next. <br></div><div>maybe a new method that calls this method.<br></div><div><br></div><div>anyhoo, thank you to all who responded, Much appreciated!<br></div><div><br></div><div><br></div><div>P.S.  I am thinking a HelpTerseGuideNot  with all the subjects in the terse guide expanded with examples of really cool code that is all over the mailing lists will be a nice feature. These examples here will definitely be on that book.<br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><br></body></html>