#!/usr/bin/perl
##
## code2html.cgi -- Standalone CGI for Code plugin of FreeStyleWiki
##
BEGIN {
if(exists $ENV{MOD_PERL}){
# カレントディレクトリの変更
chdir($ENV{FSWIKI_HOME});
}
}
use lib ('.');
use CGI;
use plugin::code::Code;
my $cgi = CGI->new();
my $self = {};
$self->{cgi} = $cgi;
if ( $cgi->request_method() eq "GET" ) {
inputHTML();
} else {
resultHTML();
}
sub inputHTML {
print << "__EOD__";
Content-type: text/html
Codeプラグインのテスト
FreeStyleWiki の codeプラグインを利用した単体CGI
FreeStyleWikiのcodeプラグインを呼び出して整形結果を表示します。
__EOD__
}
sub resultHTML() {
#--- header ---
print << "__EOD__";
Content-type: text/html
Code Format
__EOD__
#--- body ---
my $type = $cgi->param("type");
my $tab = $cgi->param("tab");
my $line = $cgi->param("line");
my $source = $cgi->param("source");
my $code = plugin::code::Code->new($cgi);
print $code->block($cgi,$source,$type,$tab,$line);
#--- footer ---
print << "__EOD__";
__EOD__
}