1 |
|
2 |
#$H2H::themepath = '/home/local/h2h/H2H/'; |
3 |
require H2H; |
4 |
#require $H2H::themepath.'default/theme.ph'; |
5 |
|
6 |
my %O; |
7 |
($O{y}, $O{m}, $O{path}) = @ARGV; |
8 |
|
9 |
unless ($O{y}) { |
10 |
(undef, undef, undef, undef, $O{m}, $O{y}) = localtime; $O{m}++; |
11 |
$rev = 1; |
12 |
} |
13 |
$O{y} += 1900 if $O{y} < 1000; |
14 |
$O{m} = substr('0'.$O{m}, -2); |
15 |
$O{path} = $O{path} || '/home/wakaba/public_html/d/'.$O{y}.'/'; |
16 |
## H2H Source directory |
17 |
|
18 |
my $basepath = $O{path}; |
19 |
#$hnffiles = 'd'.$O{y}.$O{m}.'??.hnf'; |
20 |
my $hnffiles = qr/^d$O{y}$O{m}(?:[0-9][0-9])\.hnf$/; |
21 |
my $output_filename = '/home/wakaba/public_html/d/d'.$O{y}.$O{m}.'.ja.html'; |
22 |
my $output_filename2 = '/home/wakaba/public_html/d/current.ja.html'; |
23 |
|
24 |
#open A, '| dir /B '.$basepath.$hnffiles.' > .filelist.txt'; close A; |
25 |
#open D, '.filelist.txt'; @FILELIST = <D>; close D; |
26 |
opendir DIR, $basepath; |
27 |
my @FILELIST = (grep(/$hnffiles/, readdir(DIR))); |
28 |
close DIR; |
29 |
|
30 |
if ($rev) {@FILELIST = sort {$b cmp $a} @FILELIST} |
31 |
else {@FILELIST = sort {$a cmp $b} @FILELIST} |
32 |
|
33 |
my $output; |
34 |
|
35 |
my %boptions = ( |
36 |
directory => 'H2H/V100/Theme/', theme => 'Fuyubi', |
37 |
theme09_directory => 'H2H/V090/', |
38 |
theme09 => 'default', |
39 |
title => '冬様もすなる☆日記というもの', |
40 |
year => $O{y}, month => $O{m}+0, |
41 |
); |
42 |
for $fn (@FILELIST) { |
43 |
my %options = (%boptions); |
44 |
$fn =~ tr/\x0D\x0A//d; |
45 |
if ($fn =~ /(\d{4})(\d\d)(\d\d)/) { |
46 |
($options{year},$options{month},$options{day}) = ($1,$2+0,$3+0)} |
47 |
elsif ($fn =~ /^(.+)\.hnf$/) {$options{prefix} = $1} |
48 |
if (-e $basepath.'.title'){open T,$basepath.'.title';$options{title}=''; |
49 |
while(<T>) {$options{title} .= $_} close T} |
50 |
$options{noheader} = 1; $options{nofooter} = 1; |
51 |
open HNF, '<', $basepath.$fn; |
52 |
$output .= H2H->toHTML(\%options, <HNF>); |
53 |
close HNF; |
54 |
} |
55 |
|
56 |
if ($output) { |
57 |
use Jcode; |
58 |
#require 'jcode.pl'; |
59 |
$boptions{version} = 'H2H/1.0'; |
60 |
$output = H2H->header(\%boptions).$output. |
61 |
H2H->footer(\%boptions); |
62 |
#my $s = &H2H::Page::start($title).$output.&H2H::Page::end($title); |
63 |
#jcode::convert(\$output, 'jis', 'euc'); |
64 |
my $data = Jcode->new ($output, 'euc')->jis; |
65 |
open HTML, '>', $output_filename; binmode HTML; |
66 |
print HTML $data; |
67 |
close HTML; |
68 |
open HTML, '>', $output_filename2; binmode HTML; |
69 |
print HTML $data; |
70 |
close HTML; |
71 |
system 'chmod', 'go+r', $output_filename; |
72 |
system 'chmod', 'go+r', $output_filename2; |
73 |
} |
74 |
|
75 |
1; |