安裝參考:http://cpan.uwinnipeg.ca/htdocs/HTML-WikiConverter/INSTALL.html
完整安裝:
% perl -MCPAN -e 'install Bundle::HTMLWikiConverter'
部份安裝:
cd /usr/ports/lang/perl5.8; make install clean
perl -MCPAN -e 'install HTML::WikiConverter'
perl -MCPAN -e 'install HTML::WikiConverter::MediaWiki'
轉換程式參考 http://en.wikipedia.org/wiki/Help:WordToWiki
mkdir convert_wiki; cd convert_wiki
vim convert.pl <- 貼入程式
#!/usr/bin/perl
# html2mw - HTML to MediaWiki converter
use HTML::WikiConverter;
my $b;
while (<>) { $b .= $_; }
my $w = new HTML::WikiConverter( dialect => 'MediaWiki' );
my $p = $w->html2wiki($b);
# Substitutions to get rid of nasty things we don't need
$p =~ s/
//g;
$p =~ s/\ \;//g;
print $p;
vim wiki_page.html <- 貼入要轉wiki的html
test
test
perl convert.pl wiki_page.html
就出現轉換的結果。
=test=
==test==
沒有留言:
張貼留言