HTML::WikiConverter is a Perl module for converting HTML to wiki markup for a variety of different wiki engines. Currently, it supports many dialects:
I'd really like to add support for TWiki, but the way it handles bold italics (and possibly other nested elements) is very disappointing.
It's very easy to use HTML::WikiConverter. Grab a copy from your favorite CPAN mirror and then run something like this:
#!/usr/bin/perl -w use HTML::WikiConverter; my $wc = new HTML::WikiConverter( dialect => 'MediaWiki' ); print $wc->html2wiki($html);
Alternatively, you might want to try HTML::WikiConverter's command
line interface; it's a program called html2wiki
and it's
stored in bin/html2wiki.
Unfortunately, I haven't managed to implement every feature of each supported dialect. My initial goal was simply to create a converter for MediaWiki (I am a Wikipediholic, after all :-), but then PhpWiki's Reini Urban suggested that I be more ambitious and provide the dialect interface. And so far I've been really happy with the progress.
Of course there are always bugs. Luckily, CPAN comes to the rescue again with its bug tracking service for module authors.
But where would we be without bugs? My Pacman frog sure wouldn't be happy without 'em! Do you know what a Pacman frog is? Or how about an Otago skink? Aplysia californica? Why, these are some of my favorite animals!
Animal | Region | Physical traits | Food |
---|---|---|---|
Pacman frog | Gran Chaco (Argentina) | Half mouth, half stomach (quite literally!) | Crickets, fish, etc. |
Otago skink | Otago (New Zealand) | Black, yellow, and green camouflage | Insects, fruits, small lizards |
Aplysia california | California | Deep red-colored sea hare | Red and brown seaweed |
Many dialects allow embedded images, either from local or remote stores.
Wikis also support lists, even extensively nested ones. Some rely on leading characters to determine nest levels, while others rely on spaces or (egad!) tabs.
Some wikis support definition lists, though they're often used inappropriately (as in MediaWiki, which uses them for indentation).