#!/usr/bin/gawk -f ############################################################################## # # # Copyright (C) 2007 David D. Favro # # # # This program is free software; you can redistribute it and/or modify it # # under the terms of the GNU General Public License as published by the # # Free Software Foundation (either version 2 or, at your option, any later # # version), provided that you remove neither the above copyright notice and # # email contact information of the original author, nor this licensing # # statement. The GNU General Publc License is available from # # http://www.fsf.org/licensing/licenses/gpl.txt or by emailing the original # # author at the address given above. # # # # This program is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # # General Public License for more details. # # # ############################################################################## ############################################################################## # $Id$ ############################################################################## ############################################################################## # # Convert a page of pipermail HTML to allow line-wrapping. # # Don't use this -- it's a delicate, breakable piece of crap: much better to # patch pipermail. Fix the problem at the source! # # This source code will look best when viewed with 8-character tab-stops. # ############################################################################## BEGIN { state=1 } # 1: before body; 2: in body; 3: after body /^
/   { if ( state == 1 ) { state=2 ; $0=substr($0,6) } }
/^<\/PRE>/ { if ( state == 2 ) { state=3 ; $0=substr($0,7) } }

	   { if ( state == 2 )
		{
		gsub("  "," \\ ")
		while ( gsub("  ","\\ \\ ") != 0 )
		    ; # Do nothing
		print $0 "
" next } } { print }