/[perl]/rcs2html.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /rcs2html.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Sat Jan 31 18:50:31 2004 UTC (15 years, 10 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +13 -5 lines
File MIME type: text/plain
encode < > and & for html

1 dpavlin 1.1 #!/usr/bin/perl -w
2    
3     use strict;
4    
5     my $rcs2log = "rcs2log ".join(" ",@ARGV);
6     my $have_ul = 0;
7    
8 dpavlin 1.2 sub encode {
9     my $foo = shift;
10     $foo =~ s/</&lt;/g;
11     $foo =~ s/>/&gt;/g;
12     $foo =~ s/"/&quot;/g;
13     return $foo;
14     }
15    
16    
17 dpavlin 1.1 open(RCS2LOG, "$rcs2log |") || die "$rcs2log: $!";
18     while(<RCS2LOG>) {
19     chomp;
20     next if (/^$/);
21     if (/^(\d\d\d\d-\d+-\d+)\s+(.+)\s(<.+>)$/) {
22     my ($date,$who,$email) = ($1,$2,$3);
23     if ($have_ul) {
24     print "</ul>\n";
25     $have_ul = 0;
26     }
27 dpavlin 1.2 $email = encode($email);
28 dpavlin 1.1 $email =~ s/@/(at)/g;
29     $email =~ s/\./(dot)/g;
30     print "<tt>$date</tt> $who <tt>$email</tt>\n";
31     } elsif (/^\t\* ([^:]+):(\s*.*)$/) {
32     if (! $have_ul) {
33     print "<ul>\n";
34     $have_ul = 1;
35     }
36 dpavlin 1.2 print "<li> <tt>$1</tt>:".encode($2)."\n";
37 dpavlin 1.1 } elsif (/^\t([-]\s.*)$/) {
38 dpavlin 1.2 print "<br>".encode($1)."\n";
39 dpavlin 1.1 } else {
40 dpavlin 1.2 print encode($_)."\n";
41 dpavlin 1.1 }
42     }
43    

  ViewVC Help
Powered by ViewVC 1.1.26