Tuesday, October 10, 2006

converting html to wiki


I am used to writing html documents, but now it seems that everything is done with wikis.  So I needed to figure out how to convert html documents to use wiki markup.


The HTML::WikiConverter perl module makes this conversion very easy.  This simple program outputs text with wiki tags from an html file:




#!/usr/bin/perl -w
use HTML::WikiConverter;
my $wc = new HTML::WikiConverter( dialect => 'MoinMoin' );
# Or fetch it from a file
print $wc->html2wiki( file => "file.html" );