exceptionz

Thoughts on Technology, Methodology and Programming.

Source Formatting for Windows Live Writer

Posted by Marcus Wyatt on 26 August 2006

Everyone know what a pain it is to post source code to a blog and having the source code formatted correctly. Well, Norbert Eder at dotnet-blog created a source formatter plug-in for Windows live writer. It works great and all you need to do is download the plugin and copy it to the plugins-directory of your Windows Live Writer installation.

The plugin supports the following languages:

  • C#
  • Java
  • JavaScript
  • MSH
  • Perl
  • T-SQL
  • Visual Basic

This is how some code appears on my blog: 

[ Initialize() ]
public void Setup()
{
  mock = new Mockery();
  persist = mock.NewMock( typeof( IPersistance ) ) as IPersistance;
  customer = new Customer( 123 );
}
[Cleanup()]
public void Cleanup()
{
  mock.VerifyAllExpectationsHaveBeenMet();
}
 
[ Specification() ]
public void ShouldLoadCustomer()
{
  object[] param = new object[] { 123 };
  Expect.Once.On( persist ).Method( "Load" ).WithAnyArguments().Will( Return.Value( customer ) );
  Customer expectedCustomer = persist.Load( 123 ) as Customer;
  Specify.That(expectedCustomer.Id).Must.Not.Be.Null("The Customer Id must not be null.");
  Specify.That(expectedCustomer.Id).Must.Equal(123, "The customer id's aren't equal");
}

You can find the download for the formatter here.

tags: , ,

Currently listening to: ow 4 – Winamp *** 16. Anthony Pappa – Interflow 4

Advertisements

One Response to “Source Formatting for Windows Live Writer”

  1. Jon Skeet said

    Personally I use my own formatter, which I’ve placed online for anyone interested:
    http://aspspider.net/jskeet/CodeFormatter.aspx

    Some day I’ll open up the code (a modified version of Darren Niemke’s VB.NET code, converted to C#). If anyone interested could take a copy of the stylesheet rather than linking to my own copy, that would be handy 🙂

    Jon

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: