#$H2H::themepath = '/home/local/h2h/H2H/'; require H2H; #require $H2H::themepath.'default/theme.ph'; my %O; ($O{y}, $O{m}, $O{path}) = @ARGV; unless ($O{y}) { (undef, undef, undef, undef, $O{m}, $O{y}) = localtime; $O{m}++; $rev = 1; } $O{y} += 1900 if $O{y} < 1000; $O{m} = substr('0'.$O{m}, -2); $O{path} = $O{path} || '/home/wakaba/pub/kkd/'.$O{y}.'/'; ## H2H Source directory my $basepath = $O{path}; #$hnffiles = 'd'.$O{y}.$O{m}.'??.hnf'; my $hnffiles = qr/^d$O{y}$O{m}(?:[0-9][0-9])\.hnf$/; my $output_filename = '/home/wakaba/pub/kkd/d'.$O{y}.$O{m}.'.ja.html'; my $output_filename2 = '/home/wakaba/pub/kkd/current.ja.html'; #open A, '| dir /B '.$basepath.$hnffiles.' > .filelist.txt'; close A; #open D, '.filelist.txt'; @FILELIST = ; close D; opendir DIR, $basepath; my @FILELIST = (grep(/$hnffiles/, readdir(DIR))); close DIR; if ($rev) {@FILELIST = sort {$b cmp $a} @FILELIST} else {@FILELIST = sort {$a cmp $b} @FILELIST} my $output; my %boptions = ( directory => 'H2H/V100/Theme/', theme => 'Fuyubi', theme09_directory => 'H2H/V090/', theme09 => 'default', title => 'フログに対抗するために書いてる日記!', year => $O{y}, month => $O{m}+0, ); for $fn (@FILELIST) { my %options = (%boptions); $fn =~ tr/\x0D\x0A//d; if ($fn =~ /(\d{4})(\d\d)(\d\d)/) { ($options{year},$options{month},$options{day}) = ($1,$2+0,$3+0)} elsif ($fn =~ /^(.+)\.hnf$/) {$options{prefix} = $1} if (-e $basepath.'.title'){open T,$basepath.'.title';$options{title}=''; while() {$options{title} .= $_} close T} $options{noheader} = 1; $options{nofooter} = 1; open HNF, '<', $basepath.$fn; $output .= H2H->toHTML(\%options, ); close HNF; } if ($output) { use Jcode; #require 'jcode.pl'; $boptions{version} = 'H2H/1.0'; $output = H2H->header(\%boptions).$output. H2H->footer(\%boptions); #my $s = &H2H::Page::start($title).$output.&H2H::Page::end($title); #jcode::convert(\$output, 'jis', 'euc'); my $data = Jcode->new ($output, 'euc')->jis; open HTML, '>', $output_filename; binmode HTML; print HTML $data; close HTML; open HTML, '>', $output_filename2; binmode HTML; print HTML $data; close HTML; system 'chmod', 'go+r', $output_filename; system 'chmod', 'go+r', $output_filename2; } 1;