|
From: | Markus Fritsche |
Subject: | Re: [Help-smalltalk] CGI enabled STT |
Date: | Sun, 05 Jan 2003 17:54:29 +0100 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3a) Gecko/20021212 |
Bonzini wrote:
printOn: tstream tstream nextPut: $<; nextPutAll: tag. .... tstream nextPutAll: ' />' ]. ! !
You're right. I have adjusted the methods. Regards, Markus -- http://reauktion.de/archer/Object subclass: #HTML instanceVariableNames: 'tag params data stream' classVariableNames: '' poolDictionaries: '' category: 'MFCGI-Utilities'! HTML comment: ' I am a simple evaluate and transform class. My usage is not as simple as it should be! Example: HTML a: {''href''->''http://reauktion.de/archer'' . ''Markus Fritsche ''} evaluates to: Markus Fritsche HTML br: '' '! HTML methodsFor: 'proxiing'! process: aMessage | arg inst | tag := aMessage selector allButLast. aMessage arguments first isString ifTrue: [ arg := aMessage arguments ] ifFalse: [ arg := aMessage arguments first ifNil: [ {nil} ]]. arg do: [ :i | (i isKindOf: Association) ifTrue: [ self params add: i ] ifFalse: [ self data add: i ] ]. self printOn: stream ! doesNotUnderstand: aMessage ^ self process: aMessage ! ! HTML class methodsFor: 'proxiing'! doesNotUnderstand: aMessage | tstream inst | tstream := WriteStream on: String new. inst := self new. inst stream: tstream. inst process: aMessage. ^ tstream contents ! ! HTML methodsFor: 'conversion'! asString ^self printString ! ! HTML methodsFor: 'printing'! printOn: aStream aStream nextPut: $<; nextPutAll: tag. (self params size > 0) ifTrue: [ self params keysAndValuesDo: [ :k :v | aStream nextPut: $ ; nextPutAll: k; nextPutAll: '="'; nextPutAll: v; nextPut: $" ] ]. (data first isNil) ifFalse: [ aStream nextPut: $>. data do: [ :e | aStream nextPutAll: e asString ]. aStream nextPutAll: ''; nextPutAll: tag; nextPut: $>. ] ifTrue: [ aStream nextPutAll: ' />' ] ! ! HTML class methodsFor: 'instance-creation'! new ^super new initialize ! ! HTML methodsFor: 'initialize-release'! initialize params := Dictionary new. data := OrderedCollection new ! ! HTML methodsFor: 'accessing'! stream: aStream stream := aStream ! stream ^stream ! tag: aString tag := aString ! tag ^tag ! data: anObject data := anObject ! data ^ data ! params ^params ! params: anObject params := anObject ! !
[Prev in Thread] | Current Thread | [Next in Thread] |