pretty printing ala Goldberg
Bert Freudenberg
bert at isg.cs.uni-magdeburg.de
Mon Apr 8 12:51:19 UTC 2002
On Sun, 7 Apr 2002, Ned Konz wrote:
> 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:
>
> HtmlFileStream
>
> nextPut: char
> "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
>
Thats roughly what I did in the SqueakBrowser (http://swiki.gsug.org:8888/browser/).
Though for printing the image might be too low-res. Yes, it is - I just
checked. Looks odd.
-- Bert
More information about the Squeak-dev
mailing list
|