1 |
wakaba |
1.1 |
|
2 |
|
|
require H2H; |
3 |
|
|
|
4 |
|
|
|
5 |
|
|
my $basepath = shift(@main::ARGV); |
6 |
|
|
my $hnffiles = qr/^[\x00-\xFF]+?\.(?:hnf|h2h)$/; |
7 |
|
|
my $output_filename = shift(@main::ARGV); |
8 |
|
|
$basepath =~ tr#\\#/#; |
9 |
|
|
$basepath.= '/' unless substr($basepath,-1) eq '/'; |
10 |
|
|
$H2H::Page::basepath = shift(@main::ARGV); |
11 |
|
|
unless ($output_filename) { |
12 |
|
|
my $path = substr($basepath, 0, length($basepath) - 1); |
13 |
|
|
$output_filename = $path.'.ja.html'; |
14 |
|
|
} |
15 |
|
|
|
16 |
|
|
#open A, '| dir /B '.$basepath.$hnffiles.' > .filelist.txt'; close A; |
17 |
|
|
#open D, '.filelist.txt'; @FILELIST = <D>; close D; |
18 |
|
|
opendir DIR, $basepath; |
19 |
|
|
my @FILELIST = (grep(/$hnffiles/, readdir(DIR))); |
20 |
|
|
close DIR; |
21 |
|
|
|
22 |
|
|
if ($rev) {@FILELIST = sort {$b cmp $a} @FILELIST} |
23 |
|
|
else {@FILELIST = sort {$a cmp $b} @FILELIST} |
24 |
|
|
|
25 |
|
|
my $output; |
26 |
|
|
|
27 |
|
|
my %boptions = ( |
28 |
|
|
directory => 'H2H/V100/Theme/', theme => 'Glossary', |
29 |
|
|
theme09_directory => '/home/local/h2h/H2H/V090/', |
30 |
|
|
theme09 => 'glossary', |
31 |
|
|
title => '用語集', |
32 |
|
|
keyword => '用語, 辞書, 辞典, 字典, 事典', |
33 |
|
|
description => '用語集(謎)であります。', |
34 |
|
|
); |
35 |
|
|
if(-e $basepath.'.title') {open T,$basepath.'.title';$options{title}=''; |
36 |
|
|
while(<T>) {$options{title} .= $_} close T} |
37 |
|
|
if(-e $basepath.'.header'){$options{headerfile} = $basepath.'.header'} |
38 |
|
|
if(-e $basepath.'.footer'){$options{footerfile} = $basepath.'.footer'} |
39 |
|
|
if (-e $basepath.'.rc') {require $basepath.'.rc'; |
40 |
|
|
&H2H::RC::init(\%boptions)} |
41 |
|
|
for $fn (@FILELIST) { |
42 |
|
|
my %options = (%boptions); |
43 |
|
|
$fn =~ tr/\x0D\x0A//d; |
44 |
|
|
if ($fn =~ /^(.+)\.(?:hnf|h2h)$/) {$options{prefix} = $1} |
45 |
|
|
$options{noheader} = 1; $options{nofooter} = 1; |
46 |
|
|
open HNF, $basepath.$fn; |
47 |
|
|
$output .= H2H->toHTML(\%options, <HNF>); |
48 |
|
|
close HNF; |
49 |
|
|
} |
50 |
|
|
|
51 |
|
|
if ($output) { |
52 |
|
|
require '/home/suika/lib/jcode.pl'; |
53 |
|
|
$boptions{version} = 'H2H/1.0'; |
54 |
|
|
$output = H2H->header(\%boptions).$output. |
55 |
|
|
H2H->footer(\%boptions); |
56 |
|
|
jcode::convert(\$output, 'jis', 'euc'); |
57 |
|
|
open HTML, '> '.$output_filename; binmode HTML; |
58 |
|
|
print HTML $output; |
59 |
|
|
close HTML; |
60 |
|
|
} |
61 |
|
|
|
62 |
|
|
1; |