Skip to content

blog syntax highlighting

September 28, 2009
tags:

First the bad news. At some point last week all code previously posted here suddenly had all its comments converted into upper case :(

Now the good news. While looking into why WordPress syntax highlighter was suddenly doing this I re-tested to see if Perl had been added and lo and behold it had!

This is how a previous code looked using “ruby”:

# sourcecode lang="ruby" 
{
    package Anonyject;
    use MooseX::SingletonMethod;
}

my @dingfirsts;
for my $line ( 1..10 ) {
    push @dingfirsts, Anonyject->new->add_singleton_methods(
        ding => sub { 'ding' x $line },
        dong => sub { 'dong' x $line },
        line => sub { $line },
    )
}

for (@dingfirsts) {
    say "First ", $_->ding, " on line ", $_->line;
}

Now Perl works!:

# sourcecode lang="perl"
{
    package Anonyject;
    use MooseX::SingletonMethod;
}

my @dingfirsts;
for my $line ( 1..10 ) {
    push @dingfirsts, Anonyject->new->add_singleton_methods(
        ding => sub { 'ding' x $line },
        dong => sub { 'dong' x $line },
        line => sub { $line },
    )
}

for (@dingfirsts) {
    say "First ", $_->ding, " on line ", $_->line;
}

WordPress must have updated this plugin last week. Hopefully they'll fix the comment issue soon ;-)

Anyway the Perl code is so much nicer. The Ruby sigil variables were in bold which wasn't nice on the eye. I'll be updating all my previous posts to now use Perl highlighting very shortly.

/I3az/

3 Comments leave one →
  1. September 29, 2009 3:56 am

    Nice to hear that. Now we just need a gist plugin!

    • September 29, 2009 3:24 pm

      Yes looking forward to when WordPress add the Gist plugin to their hosted accounts (hey… they may have sneaked it in… I didn’t check!).

      BTW… I like the font & colours used in the Github/Gist syntax highlighting so much I manually setup the same settings with Textmate on my Mac ;-)

      /I3az/

Trackbacks

  1. Simple as text « transfixed but not dead!

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

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: