pretty printing ala Goldberg

Richard A. O'Keefe ok at cs.otago.ac.nz
Mon Apr 8 04:20:19 UTC 2002


Ned Konz <ned at bike-nomad.com> suggested:
	nextPut: char
		"Put a character on the file, but translate it first. 4/6/96 tk 1/1/98 acg"
		char = $< ifTrue: [^ super nextPutAll: '&lt;'].
		char = $> ifTrue: [^ super nextPutAll: '&gt;'].
		char = $& ifTrue: [^ super nextPutAll: '&amp;'].
		char = $^ ifTrue: [ ^ super nextPutAll: '<img src="uparrow.gif" alt="^">' ].
		char = $_ ifTrue: [ ^ super nextPutAll: '<img src="leftarrow.gif" alt="_">' 
	].
		char asciiValue = 13 "return" 
			ifTrue: [self command: 'br'].
		char = $	"tab" 
			ifTrue: [self verbatim: TabThing. ^super nextPut: char].
		^ super nextPut: char

How soon they forget.
If anyone cares to search the archives they will find that I provided
Squeak patches to generate
    &larr;	(left arrow)
    &uarr;	(up arrow)
which is standard HTML 4 and works nicely in some browsers,
without any need for GIF.




More information about the Squeak-dev mailing list