-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert-pgsql-php-archive
More file actions
executable file
·31 lines (25 loc) · 1.05 KB
/
convert-pgsql-php-archive
File metadata and controls
executable file
·31 lines (25 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env perl
# 040107
# arsip milis pgsql di http://archive.postgresql.org/ dibuat dengan *.php.
# tidak berkelakuan baik dengan IE (IE shows it as plain text) dan swish++
# (swish++'s search won't show the files' titles). skrip ini mengubah *.php
# menjadi *.html termasuk link2 di dalamnya, dan menambahkan <title> jika
# belum ada (versi lama archives.postgresql.org menggunakan <h2>, how
# stupid...), sekalian bersihin bloat.
# 040116 - ganti \d+ jadi \w+ agar some other .php links get caught too
for $file (<*.php>) {
($new_file = $file) =~ s/\.php[34]?$/.html/i;
open F, $file; $content = join "", <F>; close F;
for ($content) {
s#(<a\s+(?:name="\w+"\s+)?href="\w+).php([^"]*)">#$1.html$2">#ig;
s#(<body[^>]*>).+<!--X-TopPNI-End-->#$1#si;
s#<!--X-User-Footer-->.+<!--X-User-Footer-End-->##si;
if (/<!--X-Head-End-->/) {
s#^.+<!--X-Head-End-->##s;
} else {
s#^.+?<H2>(.+?)</H2>#<html><head><title>$1</title></head><body><h2>$1</h2>#s;
}
}
open F, ">$new_file"; print F $content; close F;
unlink $file;
}