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