#!/usr/bin/perl -w # # p4_desc_2_html for Safari # Copyright (c) 1999 by Barrie Slaymaker, rbs@telerama.com # # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # use strict ; my $up_to_project = $ENV{SAF_UP_TO_PROJECT} ; die "\$ENV{SAF_UP_TO_PROJECT} not defined" unless defined( $up_to_project ) ; # Read in title line my $line = <> ; die "input error" unless defined $line ; my ( $title, $author, $time ) = $line =~ m/^(\S+\s+\S+)\s+by\s+(\S+)\s+on\s+(\S+\s+\S+)/ ; my $change = $title ; $change =~ s/^\w+\s+//g ; my $project = $ENV{SAF_PROJECT} ; $title = "$project, $title" if defined( $project ) && length( $project ) ; # # This is a hack that ignores the 'Jobs fixed...' section and any # others that sneak in. # my @description = read_section( qr/^Affected files/i ) ; my $description = join( "\n", @description ) ; my @affected_files = map{ s/^\.\.\.\s+// ; s!^/(/[^#]*)#!/$1#! ; $_ ; } read_section( qr/^Differences/i ) ; unshift( @affected_files, qq([ Browse from top of project ]), "", ) ; my $affected_files = join( "\n", @affected_files ) ; my @differences = read_section() ; my $differences = join( "\n", @differences ) ; print < $title
Author:$author
Time:$time
Description:
$description
Affected Files:
$affected_files
Differences:
$differences
TOHERE sub read_section { my $end_re = shift ; my @output ; while (<>) { last if defined( $end_re ) && $_ =~ $end_re ; next if ! @output && /^\s*$/ ; chomp ; s//>/g ; s/^\t// ; push( @output, $_ ) ; } pop @output while( @output && $output[ -1 ] =~ /^\s*$/ ) ; return @output ; } 0 ;