/[suikacvs]/markup/h2h/implementation/classic/h2h-diary.pl
Suika

Contents of /markup/h2h/implementation/classic/h2h-diary.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3.2.1 - (hide annotations) (download)
Sun Jan 29 12:38:51 2012 UTC (12 years, 10 months ago) by wakaba
Branch: norakuro-d
Changes since 1.3: +10 -4 lines
File MIME type: text/plain
Norakuro Diary customization

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.3.2.1 $O{path} = $O{path} || '/home/wakaba/pub/kkd/'.$O{y}.'/';
16 wakaba 1.2 ## 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.3.2.1 my $output_filename = '/home/wakaba/pub/kkd/d'.$O{y}.$O{m}.'.ja.html';
22     my $output_filename2 = '/home/wakaba/pub/kkd/current.ja.html';
23 wakaba 1.1
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 wakaba 1.2 theme09_directory => 'H2H/V090/',
38 wakaba 1.1 theme09 => 'default',
39 wakaba 1.3.2.1 title => 'フログに対抗するために書いてる日記!',
40 wakaba 1.1 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 wakaba 1.3 open HNF, '<', $basepath.$fn;
52 wakaba 1.1 $output .= H2H->toHTML(\%options, <HNF>);
53     close HNF;
54     }
55    
56     if ($output) {
57 wakaba 1.2 use Jcode;
58     #require 'jcode.pl';
59 wakaba 1.1 $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 wakaba 1.2 #jcode::convert(\$output, 'jis', 'euc');
64 wakaba 1.3.2.1 my $data = Jcode->new ($output, 'euc')->jis;
65 wakaba 1.3 open HTML, '>', $output_filename; binmode HTML;
66 wakaba 1.3.2.1 print HTML $data;
67     close HTML;
68     open HTML, '>', $output_filename2; binmode HTML;
69     print HTML $data;
70 wakaba 1.1 close HTML;
71 wakaba 1.3 system 'chmod', 'go+r', $output_filename;
72 wakaba 1.3.2.1 system 'chmod', 'go+r', $output_filename2;
73 wakaba 1.1 }
74    
75     1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24