1#!/bin/sh
2
3# Usage: hchangered oldfile newfile
4
5# hchangered - crude tool to red-color changes in HTML text. Text is 
6# also underlined so it shows on monochrome printers.
7
8# Bugs: does not red-color text inside tables. Fascist software may
9# complain about tags being out of order.
10
11diff -e $1 $2 | (sed -n -e '
12/[ac]$/{
13	p
14	a\
15<font color="red"><u>
16: loop
17	n
18	/^\.$/b done1
19	p
20	b loop
21: done1
22	a\
23</u></font>\
24.
25	b
26}
27/d$/{
28	a\
29	i\
30<font color="red"><u>[DELETED]</u></font>\
31.
32	p
33	b
34}
35'; echo '1,$p') | ed - $1 | perl -e '
36$buf = join("", <STDIN>);
37$buf =~ s/pre>\s+<font/pre><font/g;
38$buf =~ s/font>\s+<\/pre/font><\/pre/g;
39print $buf;
40'
41