Skip to content

Instantly share code, notes, and snippets.

@weirdpercent
Last active October 8, 2018 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save weirdpercent/5940046 to your computer and use it in GitHub Desktop.
Save weirdpercent/5940046 to your computer and use it in GitHub Desktop.
Perl script to convert HTML to Dokuwiki markup using the HTML::WikiConverter module
#!/usr/bin/perl -w
# Perl script to convert HTML files to DokuWiki Markup.
# Requires HTML::WikiConverter Perl module
use HTML::WikiConverter;
print "HTML to DokuWiki markup converter\n";
my $argcnt = $#ARGV + 1;
if ($argcnt == 2) {
print "Converting...";
my $infile = "$ARGV[0]";
my $outfile= "$ARGV[1]";
use Shell qw(html2wiki);
$ENV{'WCDIALECT'} = 'DokuWiki';
html2wiki ("$infile > $outfile");
open FILE, ">$outfile" or die $!;
while (<FILE>) {
printf $_;
}
close FILE;
print "done.\nYour DokuWiki article is now available in $outfile.\n";
}
else {
print "Usage: html2doku input.html output.txt\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment