Groesbeek, view of the 'National Liberation Museum 1944-1945' in Groesbeek. © Ton Kersten
Posts tagged as blog

Working on We-Blog

2011-10-07 (107) by Ton Kersten, tagged as blog

At the moment I'm working on We-Blog. I added an 'alt' tag to pages. The defined text will be shown on 'mouse-over' when you hover over the page link.

This is part of We-Blog 0.8. This release is not stable yet, but the current code is already on GitHub.

Blaze blogger emoticons

2011-07-15 (103) by Ton Kersten, tagged as blog

In my original Markdown setup I had some smilies, or emoticons, defined that could be used in the posts. As Python Markdown lacks that I decided to hack it into BlazeBlogger. The only reason being that I can hack Perl and I can't hack Python.

In the .blaze/config I now have an option called smilies that points to the top of the directory containing all smiley images. If this option is not defined the smiley conversion is skipped.

The option looks like this:

smilies=/images/smilies

and the code hacked into blaze-make.pl is:

sub convert_smilies {
    #
    # Change the smiley ascii's to picts
    #
    my $text  = shift;
    my $smurl = $conf->{blog}->{smilies} || return $text;
    $smurl = '<img class="smiley" alt="smiley" src="' . $smurl;

    my %smilies = (
        ':-\)',  'regular_smile.gif',   ':-\D',  'teeth_smile.gif',
        ':-\O',  'omg_smile.gif',       ':-\P',  'tongue_smile.gif',
        ';-\)',  'wink_smile.gif',      ':-\(',  'sad_smile.gif',
        ':-\S',  'confused_smile.gif',  ':-\|',  'what_smile.gif',
        ':\'\(', 'cry_smile.gif',       ':-\$',  'red_smile.gif',
        '\(H\)', 'shades_smile.gif',    ':-\@',  'angry_smile.gif',
        '\(A\)', 'angel_smile.gif',     '\(6\)', 'devil_smile.gif',
        ':-\#',  '47_47.gif',           '8o\|',  '48_48.gif',
        '8-\|',  '49_49.gif',           '\^o\)', '50_50.gif',
        ':-\*',  '51_51.gif',           '\+o\(', '52_52.gif',
        ':\^\)', '71_71.gif',           '\*-\)', '72_72.gif',
        '\<:o\)','74_74.gif',           '8-\)',  '75_75.gif',
        '\|-\)', '77_77.gif',           '\(C\)', 'coffee.gif',
        '\(Y\)', 'thumbs_up.gif',       '\(N\)', 'thumbs_down.gif',
        '\(B\)', 'beer_mug.gif',        '\(D\)', 'martini.gif',
        '\(X\)', 'girl.gif',            '\(Z\)', 'guy.gif',
        '\(\{\)','guy_hug.gif',         '\(\}\)','girl_hug.gif',
        '\:-\[', 'bat.gif',             '\(^\)', 'cake.gif',
        '\(L\)', 'heart.gif',           '\(U\)', 'broken_heart.gif',
        '\(K\)', 'kiss.gif',            '\(G\)', 'present.gif',
        '\(F\)', 'rose.gif',            '\(W\)', 'wilted_rose.gif',
        '\(P\)', 'camera.gif',          '\(\~\)','film.gif',
        '\(\@\)','cat.gif',             '\(\&\)','dog.gif',
        '\(T\)', 'phone.gif',           '\(I\)', 'lightbulb.gif',
        '\(8\)', 'note.gif',            '\(S\)', 'moon.gif',
        '\(\*\)','star.gif',            '\(E\)', 'envelope.gif',
        '\(O\)', 'clock.gif',           '\(sn\)','53_53.gif',
    );

    my $tag;
    foreach $tag (keys %smilies)
    {
        $text =~ s!$tag!$smurl/$smilies{$tag}\" />!g;
    }

    return $text;
}

and add it to the functions generate_posts and read_entry.

This list is already rather long, and I do think it's not a very good idea to make it longer. It will seriously impact the performance.

Ditched MarkDown.pl

2011-07-15 (102) by Ton Kersten, tagged as blog

After using John Grubers original Markdown for a couple of years now, I finally ditched it. I kept wanting things that where not in the Perl version and after a while I lost the fun to code them myself. So I started looking around and I found some alternatives, like rdiscount, libupskirt and a lot more. But I also wanted syntax highlighting, without JavaScript if possible.

Digging around I found Markdown in Python in combination with Pygments. I just tweaked a little Python script to run markdown from the command line and configured blaze to use it.

This is the blaze config line

processor=md -x codehilite -x footnotes -x tables %in% > %out%

and the little python script.

#!/usr/bin/env python26

import logging
from markdown import COMMAND_LINE_LOGGING_LEVEL
from markdown import commandline

logger = logging.getLogger('MARKDOWN')
logger.setLevel(COMMAND_LINE_LOGGING_LEVEL)
logger.addHandler(logging.StreamHandler())

if __name__ == '__main__':
    commandline.run()

To bad I don't code more Python, people say it's fun. Maybe something for the holidays.

At this moment this seems to be a keeper.

My patched version of MarkDown is still in the download section. Feel free to take a copy home!

Switching to a static blog

2011-06-22 (98) by Ton Kersten, tagged as blog

I have been running WordPress for some time now, and I rather liked it. The only thing I didn't like was the fact that I had to use PHP and a lot of strange software that was almost impossible to keep up to date.

Before I started using WordPress I used NanoBlogger and I liked that because it generates static websites. And I am a big fan of that. But: NanoBlogger is very, very slow and I didn't like that, as you can imagine.

But I want my static pages back and I want to use my patched version of MarkDown and I want to create my posts with vim.

I also want to be able to change the blog system the way I want it to work and with Nanoblogger that is really out of the question. The source code of NB is (mildly said) a mess. If you change a little thing everything else breaks.

As you can see, I have a lot of wishes and no answers..... Until I ran into BlazeBlogger, which is lightning fast and generates static html. And the very nice thing is that the source code is in Perl and everyone with little knowledge of Perl can read and adapt it. And that is what I did, I changed some things to make it more the way I like it. And, as OpenSource should be, I mailed the changes to Jaromir.

So, what you see now is generated with BlazeBlogger and some extra stuff.

Comments are enabled as well, through Disqus.

Updated the Geek Code

2009-06-05 (23) by Ton Kersten, tagged as blog

It was a long time ago that I created a Geek Code Block for myself. As I aged this block aged with we, so it was about time I updated it.

Take a look at the about to see the new code. I also added a decoded verion for those who do not like to decode stuff.

Changed the top photo

2009-05-10 (18) by Ton Kersten, tagged as blog

At the top of this site I used a photo I found on Flickr and that was made by Toverberg. It was a nice panorama.

However it was a very nice photo I thought it would be better to use one I made myself. So today I was out there with a friend of mine (Niels) taking pictures for his camping. When selecting these pictures I was triggered by the one now shown at the top of this page. It shows the "Dutch National Liberation Museum 1944-1945" in our beautiful village. The white part in the middle resembles a parachute and inside it is "The Dome of Honour", with the "Roll of Honour" and was built in 1987. This is in memory of the dropping of thousands of American paratroopers on the landing zones alongside the Wylerbaan and in Klein Amerika on 17 September 1944, as well as the great Rhineland Offensive.

At the right of the Dome of Honour is the main building. This is largely build with portacabins from the former Neeltje Jans flood barrier construction site in Zealand. These were moved here in 1987.

W3C Compliant

2009-04-14 (13) by Ton Kersten, tagged as blog

I did take a lot of care to make this site W3C compliant, but a little bug entered the code. This spoiled it and W3C give me 48 errors. Of course that's too much. A little debugging session showed the problem and now I'm W3C again.

Have a look at the W3C Validation Service

Markdown patched

2009-04-14 (12) by Ton Kersten, tagged as blog

As you might know, this site is created with Nanoblogger and Markdown. This setup works nice and almost completely as I want it.

Read more »

Nanoblogger code plugin

2009-04-10 (11) by Ton Kersten, tagged as blog

Miek pointed me to a nice plugin for Nanoblogger called the Code Plugin

Some nice examples:

#include <stdio.h>

int main( int argc, char* argv[] )
{
    /* A Hello world example */
    (void) printf( "Hello, World!\n" );

    return 0;
}

and

#!/bin/bash

# A Hello world example
echo "Hello world"

If you want to cut and paste code examples, just go into vi and give it a

:%s/^[0-9]* //