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 comment