On Feb 12, 2013, at 10:21 AM, Alain Busser <[email protected]> wrote:
> I'm afraid I can't help much but if you define a method for the Stream object > you can have a shorter code, avoiding all these "<p>" everywhere. > > Something like > > paragraphe: unString > self nextPutAll: '<p>'. > self nextPutAll: unString. > self nextPutAll: '</p>'. > > > Afterwards you would just list things like paragraphe: 'class name : ',self > name asString; so that one entry would take one line of code instead of four. > > But maybe I am violating some principles for good programming? Now this is indeed much nicer :) > > And it doesn't show why SmalltalkDoc is not understood by your class... > > On Tue, Feb 12, 2013 at 4:25 AM, Hayatou Oumarou <[email protected]> wrote: > When I define a message smalltalkDoc in the class "Class" it does not have > problems there. But when I try to define a subclass "SmalltalkDoc" of > "Class" and put the message smalltalkDoc in this class, by evaluating for > example the expression "LinkedList smalltalkDoc." I have a message context : > "LinkedList class(Object)>>doesNotUnderstand: #smalltalkDoc." > > How can I fix this? > > here the message. > > smalltalkDoc > "Genere un fichier HTML avec les Informations d'une classe" > |stream nom| > nom:=self asString,'SmalltalkDoc.html'. > stream := FileStream forceNewFileNamed: nom. > stream > nextPutAll: '<html> <head> <title>A little Smalltalk Doc</title> </head> > <body> '; > nextPutAll: '</p>'; > nextPutAll: 'class name : '; > nextPutAll: self name asString; > nextPutAll: '</p>'; > nextPutAll: '<p></p>'; > nextPutAll: 'superclass name : '; > nextPutAll: self superclass name asString; > nextPutAll: '<p></p>'; > nextPutAll: '<p></p>'; > nextPutAll: 'trait Composition : '; > nextPutAll: self traitCompositionString asString; > nextPutAll: '<p></p>'; > nextPutAll: '<p></p>'; > nextPutAll: 'class trait Composition : '; > nextPutAll: self class traitCompositionString asString; > nextPutAll: '</p>'; > nextPutAll: '<p>'; > nextPutAll: 'category : ' ; > nextPutAll: self category asString; > nextPutAll: '</p>'; > nextPutAll: '<p>'; > nextPutAll: 'instances Variable Names : '; > nextPutAll: self instVarNames asString; > nextPutAll: '</p>'; > nextPutAll: '<p>'; > nextPutAll: 'pool Dictionary Names : '; > nextPutAll: self poolDictionaryNames asString; > nextPutAll: '</p>'; > nextPutAll: '<p>'; > nextPutAll: 'class instances Variable Names : '; > nextPutAll: self class instVarNames asString; > nextPutAll: '</p>'; > nextPutAll: '<p>'; > nextPutAll: 'type of class : '; > nextPutAll: self typeOfClass asString; > nextPutAll: '</p>'; > nextPutAll: '<p>'; > nextPutAll: 'class Comment : '; > nextPutAll: self organization classComment asString asString; > nextPutAll: '</p>'; > nextPutAll: '<p>'; > nextPutAll: 'comment Stamp : ' ; > nextPutAll: self organization commentStamp asString; > nextPutAll: '</p>'; > nextPutAll: '<p>'; > nextPutAll: 'class Variables Names : '; > nextPutAll: self classVarNames asString ; > nextPutAll: '<p>'; > nextPutAll: 'selectors : '; > nextPutAll: self class selectors asString ; > nextPutAll: '</p>'; > nextPutAll: '</p>'; > nextPutAll: '</body> </html>'. > stream close. > > > > ------------------------------------ > Hayatou >
