pretty printing ala Goldberg
ned at bike-nomad.com
Sun Apr 7 21:46:39 UTC 2002
On Sunday 07 April 2002 01:19 pm, Martin Drautzburg wrote:
> Is there a way to produce pretty printed code (e.g. html) that looks
> like in the Smalltalk-80
> book ? I mean with real arrows for "return" and proportional font ?
> I am aware of Dendelion and the CodeReview stuff.
Why not just use Class>>fileOutAsHtml: etc?
If you convert any characters (like caret -> arrow glyph) you won't be able to
copy all the text as text and paste it into another app. If that doesn't
bother you, just edit HtmlFileStream>>nextPut: to replace $^ with '<img
src="myarrow.png">' or something:
"Put a character on the file, but translate it first. 4/6/96 tk 1/1/98 acg"
char = $< ifTrue: [^ super nextPutAll: '<'].
char = $> ifTrue: [^ super nextPutAll: '>'].
char = $& ifTrue: [^ super nextPutAll: '&'].
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
currently: Stanwood, WA
email: ned at bike-nomad.com
More information about the Squeak-dev