#!/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// 1i\ /^diff /{i\

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|$|
|p x } # Take care of added lines /^+[^+]/{i\
\ :b N s/\n+/||||/ tb h s/.*\n// /
$/!s/$/
/ x s/\(.*\)\n[^\n]*$/\1/ s/||||/
\ +/g :space2 / /{ s| |\  | bspace2 } s|$|
|p x } # We need to do this, because we only want the spaces at the beginning :c /^Ä\+[^ ][-_A-Za-z0-9]/bend s/^\(Ä*\) /\1Ä/ tc :end s/Ä/\ /g /^ /{ s|^|| s|$|| } :space3 / /{ s| |\  | bspace3 } $a\ ' # sed done