[ANN] Gutenberg: a pretty printer for Smalltalk

Damien Cassou damien.cassou at laposte.net
Mon Jul 17 04:48:39 UTC 2006


Here is an example of an automatic formatting:



1 renderCategoriesOn: html 

2     html fieldSet legend: 'Choose one or more categories';

3  

4         with: [html

5                 unorderedList: [self allCategories

6                         do: [:category | html

7                                 listItem: [html checkbox

8                                         value: (self belongsToCategory: category);

9                                

10                                         onTrue: [self addCategory: category]

11                                         onFalse: [self removeCategory: category];

12                                        

13                                         with: [html text: category asString]]]

14                         separatedBy: [html break]]]



Here are my opinion:

- use spaces instead of tabs (I don't know if this is wanted)
- on line 2, #legend: can be put in the following line
- the line 3 should not be empty
- on line 4, #with: should be aligned with #legend:
- the #do: on line 6 should be under (self allCategories) and not under 
#unorderedList:
- the same for #listItem: on line 7, and the three messages applied to 
(html checkbox) on lines 8, 10-11, 13.
- #separatedBy: should stay under the #do: if you move it (but it is ok 
currently)

These is just my taste. Others might have different opinions.

Here is how I found have formatted it manually which is a bit different 
from what you did + points before:

renderCategoriesOn: html 

  html fieldSet

    legend: 'Choose one or more categories';

    with:   [html unorderedList: [

                 self allCategories

                      do: [:category |

                            html listItem: [

                                html checkbox

                                    value: (self belongsToCategory: category);

                                    onTrue: [self addCategory: category] onFalse: [self removeCategory: category];

                                    with: [html text: category asString]]]

                                    separatedBy: [html break]]]



Hope it can helps you

Bye
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20060717/08571af6/attachment.htm


More information about the Squeak-dev mailing list