Archive for the ‘Blogs about blogging’ Category

Literate Haskell Blogging

February 5th, 2008 by olsner

An unfortunate thing with this markdown framework I’ve been using is that it requires me to indent code blocks by four spaces (or a tab). Editing such text in a web browser really sucks, so I’ve been thinking about how to hack in literate haskell support into markdown. Well, turns out, it wasn’t that hard after all.

After some real simple modification to the markdown+geshi patch referenced in my previous blog post I now have literate haskell support! The modification literally took less time than writing this post ;-) Find my new patch attached at the bottom of the page.

So – the testing! (This should render as normal text.)

> and "this" {-should-} -- be rendered as haskell

Now some normal text in between the haskell blocks, before we give haskell highlighting a run for its money.

> and . more . haskell $ [1,2,3]
> main = print.take`id`20$fix$(.)<$>(:)<*>((.((:[]).))(=<<).(*).(*2))$1 -- print an interesting sequence

End of test.

Anyway, here’s the patch for markdown.php (you’ll also need to cut-n-paste the highlight_helper.php file from Dougal Stanton’s blog).

WordPress, take 1

January 21st, 2008 by olsner

This was way easier than blosxom, which after almost a whole day’s customization still looks like this. And that’s only after stealing dons‘ stylesheet and template. Plenty of stuff that doesn’t really work without hacking it in, or finding a plugin, or the right template (if it’s still around – the main blosxom page has plenty of broken links, esp. when it comes to plugins and “flavours”).

The whole WordPress installation took perhaps 10-15 minutes, and that’s including setting up the database, running the setup wizard, adding a new non-admin account in wordpress and installing markdown, wp-syntax and the Syntax Highlighting with Markdown in Wordpress changes as recommended by conal.

And here’s some haskell code!

-- Test some haskell code
 
fib = 1:1:zipWith (+) fib (tail fib)

And now back in the blog text!

-- And a final line of haskell
main = mapM_ print . take 20 $ fib

I guess this pretty much proves that Wordpress is easier to use and more mature than blosxom. This may well become my long-in-planning programming and haskell blog!

There’s a little bit of a problem though. The second run of code lines above becomes highlighted as plain text – this is because the first code block is marked {{lang:haskell}} while the second one isn’t. What I’d like here is for them to keep the same language as the previous code block, which would be nice for any literal-haskell-ish blog posts I might post later on. And I really don’t want to have to write {{lang:haskell}} every other line of blog post. I could of course let haskell be the default rather than text, but what if I want to blog about some other language? Hmm… Let’s see if I get around to hacking markdown/highlighting any time soon.