That’s It! I have had enough of my code snippets going awry when posting to the Blogger platform. I typically use Live Writer to blog so I am now going to review the code syntax formatters and declare a winner. Well my preferred formatter anyway. The Live Writer plugins are:
- Code Snippet
- Insert Code
- Source Code
- Source Code (another one)
- WintyCodeArea
Lets take a look at how they format the same bit of code.
Code Snippet
1: public class DynaTable implements EntryPoint {
2:
3: public void onModuleLoad() {
4: // Find the slot for the calendar widget.
5: //
6: RootPanel slot = RootPanel.get("calendar");
7: if (slot != null) {
8: SchoolCalendarWidget calendar = new SchoolCalendarWidget(15);
9: slot.add(calendar);
10:
11: // Find the slot for the days filter widget.
12: //
13: slot = RootPanel.get("days");
14: if (slot != null) {
15: DayFilterWidget filter = new DayFilterWidget(calendar);
16: slot.add(filter);
17: }
18: }
19: }
20: }
Insert Code
1: public class DynaTable implements EntryPoint {
2:
3: public void onModuleLoad() {
4: // Find the slot for the calendar widget.
5: //
6: RootPanel slot = RootPanel.get("calendar");
7: if (slot != null) {
8: SchoolCalendarWidget calendar = new SchoolCalendarWidget(15);
9: slot.add(calendar);
10:
11: // Find the slot for the days filter widget.
12: //
13: slot = RootPanel.get("days");
14: if (slot != null) {
15: DayFilterWidget filter = new DayFilterWidget(calendar);
16: slot.add(filter);
17: }
18: }
19: }
20: }
Source Code (1)
public class DynaTable implements EntryPoint {
public void onModuleLoad() {
// Find the slot for the calendar widget.
//
RootPanel slot = RootPanel.get("calendar");
if (slot != null) {
SchoolCalendarWidget calendar = new SchoolCalendarWidget(15);
slot.add(calendar);
// Find the slot for the days filter widget.
//
slot = RootPanel.get("days");
if (slot != null) {
DayFilterWidget filter = new DayFilterWidget(calendar);
slot.add(filter);
}
}
}
}
Source Code (2)
public class DynaTable implements EntryPoint {public void onModuleLoad() {// Find the slot for the calendar widget.//RootPanel slot = RootPanel.get("calendar");if (slot != null) {SchoolCalendarWidget calendar = new SchoolCalendarWidget(15);slot.add(calendar);// Find the slot for the days filter widget.//slot = RootPanel.get("days");if (slot != null) {DayFilterWidget filter = new DayFilterWidget(calendar);slot.add(filter);}}}}
Winty Code Area
Didn’t work.
Conclusions
Based on the visuals above and interface in Windows Live Writer. My nomination goes to…. drum roll please… Code Snippet.