I'm writing some perl.com articles (Yes, Simon, I'm really writing them!) using the Kwiki format, because its so damned comfortable to write in (do ya hear me Slash?). But I hate editing in web pages (such as this one) though Safari makes it a bit nicer by providing some basic emacs functionality.
So Brian Ingerson gave me a little snippet so I could take a kwiki file and spit out HTML. I've made a little command line tool out of it:
#!/usr/bin/perl -w
my $File = shift;
my $FH = *STDIN;
if( defined $File ) {
open(FILE, $File) || die "Can't open $File: $!";
$FH = \*FILE;
}
use CGI::Kwiki;
my $driver = CGI::Kwiki::load_driver();
$driver->load_class('formatter');
{
local $/;
print $driver->formatter->process(<$FH>);
}
I write in article.kwiki and then run kwik article.kwiki > article.html. Ta da.
I've written a little Makefile for my articles.
NAME = article
KWIKI = $(NAME).kwiki
HTML = $(NAME).html
all: htmlify
htmlify: $(KWIKI)
kwik $(KWIKI) > $(HTML)
You don't need a config.yaml, but since I needed a few special formatting rules and had to override CGI::Kwiki::Formatter to do this, I just put a config.yaml in the article directory. Kwiki will read its config file from the directory its run.
What a neat little tool.
If only you could post journals from emacs (Score:1)
Easier than that (Score:2)
Hearing (Score:2)
Not to sound like a grump
Re:Hearing (Score:2)
Re:Hearing (Score:2)