The Artima Developer Community
Sponsored Link

Agile Buzz Forum
[ANN] DiscussMethods

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
[ANN] DiscussMethods Posted: Oct 23, 2004 12:43 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: [ANN] DiscussMethods
Feed Title: Michael Lucas-Smith
Feed URL: http://www.michaellucassmith.com/site.atom
Feed Description: Smalltalk and my misinterpretations of life
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Michael Lucas-Smith

Advertisement

With Travis Griggs, I've just made a new goodie called DiscussMethods. The basic idea is to be able to post code snippits in to our blogs from Smalltalk while keeping the syntax colouring that we get in our development environment.

There is a goodie called RBCodeHighlighting which provides on-the-fly colouring of methods as you edit them. It's great, it parses the method as you code and uses the parse tree to apply colouring to the Core.Text object in the widget.

Using the Core.Text object, we then extract that styling information in to some basic HTML, then put some CSS over the top of it to make it look colourful. Here's the result:

layoutText
	self pane displayText isEmpty ifTrue: [^self pane nextText: nil].
	self needsLayout ifFalse: [^self].
	self owner == self ifFalse: [^self layoutParent accept: self].
	self pane makeTexts.
	self pane allPartialTexts do: [:text |
		(self canFitOnLine: text) ifFalse: [self layoutParent layoutParent newLine].
		self layoutParent layoutParent lastLine accept: text frame.
		text displayText last = Character cr ifTrue: [self layoutParent layoutParent newLine]].

Naturally, this method should be refactored, but it served as a good colourful example.

Once it's loaded you can right click on a method name in the refactoring browser an dchoose 'Copy as Styled HTML'. The other option available is 'View as Styled HTML in WithSTyle' - this is only live if you have WithStyle loaded. It's more for a preview of what you're about to copy than for anything else.

Read: [ANN] DiscussMethods

Topic: Italian Agile Day! Previous Topic   Next Topic Topic: How my backflip went...

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use