26763: fix problem on failed cd -s to relative path
[zsh.git] / Etc / changelog2html.pl
blobec7c29a6f78296aeff848a144dda1a148310d39f
1 #!/usr/bin/perl -w
3 # This programme turns the ChangeLog into changelog.html for display
4 # on the website. That lives at http://zsh.sunsite.dk/Etc/changelog.html.
6 my $out = "changelog.html";
8 open CL, "ChangeLog" or die "No ChangeLog --- run in top level directory.\n";
10 if (-f $out) {
11 die "Will not overwrite existing $out. Delete by hand.\n";
14 my $version;
15 my $changes = 0;
17 while (<CL>) {
18 /^\d+/ and $changes++;
19 if (/version\.mk.*version\s+(\d+(\.\d+)*(-\S+)?)/i) {
20 $version = $1;
21 $version =~ s/\.$//;
22 last;
26 if (defined $version) {
27 warn "Outputting changelog.html for version \"$version\".\n";
28 if ($changes) {
29 warn "WARNING: there are changes since this version.\n";
31 } else {
32 $version = "X.X.X";
33 warn "WARNING: no version found. Set by hand\n";
36 seek CL, 0, 0;
38 open NEW, ">changelog.html";
40 select NEW;
42 print <<"EOH";
43 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
44 <html>
45 <head>
46 <title>ChangeLog for zsh version $version</title>
47 </head>
48 <body>
49 <h1>ChangeLog for zsh version $version</h1>
50 <pre>
51 EOH
53 while (<CL>) {
54 s/&/&amp;/g;
55 s/</&lt;/g;
56 s/>/&gt;/g;
58 print;
61 my $now = gmtime(time);
63 print <<"EOH";
64 </pre>
65 <hr>
66 Automatically generated from ChangeLog at $now
67 </body>
68 </html>
69 EOH