File: hchangered

package info (click to toggle)
postfix 3.10.6-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,968 kB
  • sloc: ansic: 134,721; makefile: 17,984; sh: 6,966; perl: 2,796; python: 1,448; awk: 158
file content (40 lines) | stat: -rwxr-xr-x 640 bytes parent folder | download | duplicates (14)
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
32
33
34
35
36
37
38
39
40
#!/bin/sh

# Usage: hchangered oldfile newfile

# hchangered - crude tool to red-color changes in HTML text. Text is 
# also underlined so it shows on monochrome printers.

# Bugs: does not red-color text inside tables. Fascist software may
# complain about tags being out of order.

diff -e $1 $2 | (sed -n -e '
/[ac]$/{
	p
	a\
<font color="red"><u>
: loop
	n
	/^\.$/b done1
	p
	b loop
: done1
	a\
</u></font>\
.
	b
}
/d$/{
	a\
	i\
<font color="red"><u>[DELETED]</u></font>\
.
	p
	b
}
'; echo '1,$p') | ed - $1 | perl -e '
$buf = join("", <STDIN>);
$buf =~ s/pre>\s+<font/pre><font/g;
$buf =~ s/font>\s+<\/pre/font><\/pre/g;
print $buf;
'