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:
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.
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.
Just type make and all of the right things happen.OUTPUTS=article.html
all: $(OUTPUTS)
%.html: %.kwiki
kwik $< > $@
Re:Hearing
schwern on 2003-08-31T08:27:18
Kwiki as a format for writing journal entries and the like. Manually writing HTML causes bad breath and herpes.Re:Hearing
pudge on 2003-08-31T15:10:53
I know nothing about the Kwiki format, but I *do* know that you don't need to use HTML on Slash for most things. Select the "Plain Old Text" format and you don't need to use P and BR tags. To HREF-ize a URL just use <URL:http://use.perl.org/> to get http://use.perl.org/. To do code blocks, use the ECODE tag. There are other shortcuts here and there.