HTML to Kwiki Markup Conversion

I use Kwiki for lecture notes, homework and other Web pages I need to teach my class. Here's an example: the lectures for my programming language design class.

Today I needed to convert some old pages (embedded in PHP) for use on the wiki. I did one by hand and thought that I ought to write a Perl program to convert the HTML to Kwiki mark-up. Then I got smart and realized someone must have already done it--I was right. David Iberri has a HTML to Kwiki module for Perl that with a little scaffolding did the job nicely:


# use a '-' to get stdin
while() {
    $html .= $_;

use HTML::WikiConverter;
my $wc = new HTML::WikiConverter( dialect => 'Kwiki' );
print $wc->html2wiki( $html );

Now a shell loop, wget or curl, and this little script makes quick work of the conversion.

Please leave comments using the sidebar.

Last modified: Thu Oct 10 12:47:18 2019.