#!/bin/sh
#
# Beautifies the output of diff -Nur to the HTML format
# needs the expand utility to convert tabs to spaces, to preserve
# identation. Output HTML Code is pretty worse i think and the
# colors suck somehow
#
# Sat Apr 14 21:59:36 CEST 2001
# by Tilmann Bitterberg
expand |
sed '
s/>/\>/g; s/\</g
s|ü|\ü|g; s|Ü|\Ü|g; s|ä|\ä|g
s|Ä|\Ä|g; s|ö|\ö|g; s|Ö|\Ö|g
s|ß|\ß|g
s/^+$/+ /
s/^-$/- /
s/^$/ /
/^[-+]/!s/$/
/
1i\
s|[^/]*/|| s| .*|| s|.*|&| s|.*|
| & |
|
}
# Could be done in one line
/^@@ /{
s|^@@|@@|
s|$||
}
\|^---|s|.*|&
|
\|^+++|s|.*|&
|
# Take care of removed lines
/^-[^-]/{i\
| \
:a
N
s/\n-/||||/
ta
h
s/.*\n//
/ $/!s/$/ / x s/\(.*\)\n[^\n]*$/\1/ s/||||/ \ -/g :space1 / /{ s| |\ | bspace1 } s|$| |
| \
:b
N
s/\n+/||||/
tb
h
s/.*\n//
/ $/!s/$/ / x s/\(.*\)\n[^\n]*$/\1/ s/||||/ \ +/g :space2 / /{ s| |\ | bspace2 } s|$| |