Develop and Download Open Source Software

Browse Subversion Repository

Contents of /branches/4-stable/doc/htmlhelp_index_make.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8437 - (show annotations) (download) (as text)
Fri Dec 13 03:11:16 2019 UTC (4 years, 2 months ago) by doda
File MIME type: text/x-perl
File size: 2139 byte(s)
Tera Term 4.xx メンテナンス用ブランチを作成

1 #! /usr/bin/perl
2
3 #
4 # HTMLヘルプのインデックスファイルを生成する
5 #
6 # Usage(ActivePerl):
7 # perl htmlhelp_index_make.pl ja html > ja\Index.hhk
8 #
9
10 use Cwd;
11 @dirstack = ();
12
13 do_main($ARGV[0], $ARGV[1]);
14
15 exit(0);
16
17 sub do_main {
18 my($path, $body) = @_;
19
20 print << 'EOD';
21 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
22 <HTML><HEAD>
23 <meta name="GENERATOR" content="TeraTerm Project">
24 <!-- Sitemap 1.0 -->
25 </HEAD><BODY>
26 <UL>
27 EOD
28
29 push @dirstack, getcwd;
30 chdir $path;
31 get_file_paths($body);
32 chdir pop @dirstack;
33
34 print << 'EOD';
35 </UL>
36 </BODY></HTML>
37 EOD
38
39 }
40
41
42 sub get_file_paths {
43 my ($top_dir)= @_;
44 my @paths=();
45 my @temp = ();
46
47 #-- カレントの一覧を取得 --#
48 opendir(DIR, $top_dir);
49 @temp = readdir(DIR);
50 closedir(DIR);
51 foreach my $path (sort @temp) {
52 next if( $path =~ /^\.{1,2}$/ ); # '.' と '..' はスキップ
53 next if( $path =~ /^\.svn$/ ); # '.svn' はスキップ
54
55 my $full_path = "$top_dir" . '/' . "$path";
56 next if (-B $full_path); # バイナリファイルはスキップ
57
58 # print "$full_path\r\n"; # 表示だけなら全てを表示してくれる-------
59 push(@paths, $full_path); # データとして取り込んでも前の取り込みが初期化される
60 if( -d "$top_dir/$path" ){ #-- ディレクトリの場合は自分自身を呼び出す
61 &get_file_paths("$full_path");
62
63 } else {
64 check_html_file($full_path);
65
66 }
67 }
68 return \@paths;
69 }
70
71 sub check_html_file {
72 my($filename) = shift;
73 local(*FP);
74 my($line, $no, $val);
75
76 if ($filename !~ /.html$/) {
77 return;
78 }
79
80 open(FP, "<$filename") || return;
81 $no = 1;
82 while ($line = <FP>) {
83 # $line = chomp($line);
84 # print "$line\n";
85 if ($line =~ /<TITLE>(.+)<\/TITLE>/i) {
86 # print "$filename:$no: $1\n";
87 # print "$line\n";
88 $val = $1;
89 $val =~ s/"/&#34;/g; # 二重引用符をエスケープする
90 write_add_index($filename, $val);
91 last;
92 }
93
94 $no++;
95 }
96 close(FP);
97 }
98
99 sub write_add_index {
100 my($filename, $title) = @_;
101
102 print << "EOD";
103 <LI><OBJECT type="text/sitemap">
104 <param name="Name" value="$title">
105 <param name="Local" value="$filename">
106 </OBJECT>
107 EOD
108
109 }
110

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26