123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- $blankcount = 0;
- $lastwascut = 0;
- $firstheader = 1;
- while (<STDIN>)
- {
- s/\x1b\[\d+m//g;
- s/.\x8//g;
-
-
-
- if (/^PCRE(\w*)\(([13])\)\s+PCRE\1\(\2\)$/)
- {
- if ($firstheader)
- {
- $firstheader = 0;
- print;
- $lastprinted = $_;
- $lastwascut = 0;
- }
- $_=<STDIN>;
- next;
- }
-
- if (/^\s*$/)
- {
- $blankcount++;
- $lastwascut = 0;
- next;
- }
-
-
- if ($lastwascut && $blankcount < 1 && defined($lastprinted))
- {
- ($a) = $lastprinted =~ /^(\s*)/;
- ($b) = $_ =~ /^(\s*)/;
- $blankcount++ if ($a ne $b);
- }
-
-
-
- if ($blankcount >= 3)
- {
- for ($i = 0; $i < 3; $i++)
- {
- $next[$i] = <STDIN>;
- $next[$i] = "" if !defined $next[$i];
- $next[$i] =~ s/\x1b\[\d+m//g;
- $next[$i] =~ s/.\x8//g;
- }
-
- if ($next[0] =~ /^\s*$/ &&
- $next[1] =~ /^\s*$/ &&
- $next[2] =~ /^\s*$/)
- {
- $blankcount -= 3;
- $lastwascut = 1;
- }
-
-
- else
- {
- for ($i = 0; $i < $blankcount; $i++) { print "\n"; }
- print;
- for ($i = 0; $i < 3; $i++)
- {
- $next[$i] =~ s/.\x8//g;
- print $next[$i];
- $lastprinted = $_;
- }
- $lastwascut = 0;
- $blankcount = 0;
- }
- }
-
-
-
- else
- {
- $blankcount = 2 if /^\S/ && !/^Last updated/ && !/^Copyright/ &&
- defined($lastprinted);
- for ($i = 0; $i < $blankcount; $i++) { print "\n"; }
- print;
- $lastprinted = $_;
- $lastwascut = 0;
- $blankcount = 0;
- }
- }
|