HTML is all very well and good, but frankly, I'm too lazy to mark up my
&,<,> characters all the time by hand, at least within
code. I used the POD formatter pod2html for a couple of early
posts. It's OK, it basically has a concept of "This is a normal text
paragraph, and this is a code paragraph" but for those times that I
want to do anything clever, it's just that little bit more clunky than
markup in HTML.
When I asked what people use on IRC, people suggested HsColour. OK,
that wasn't really the question – I was more about laziness and
practicality than shiny features – but, fair enough, highlighted haskell
code would be nice too.
I had a stupid little formatter I use for fiction writing, which does
basic paragraph formatting and word count, while making a horrible hack
of not screwing up HTML markup (because it, er, "grew organically", and
I didn't get around to using an HTML parser as I would have done if I
were sane).
So I hacked on the Perl (yeah, not haskell, this is a blog on learning
haskell, if I already knew how to write the formatter in it…) doing
the following
- Bringing it into my ‘modulino’ framework (which handles things like
command line options, documentation, logging etc.) - reworking the parsing to be more modular so you can subclass it
easily - using HTML::Parser instead of just hacking at it with
regexps. (The smartquote stuff is still regexps of course) - adding a rule for indented paragraphs, and haskell paras (indented
with the first nonwhitespace character being ">". This uses
HsColour -partial -html