#!/opt/local/bin/perl $pre = 0; while (<>) { if (!$pre) { if (m#
\s*$#) { $pre = 1; } print $_; } else { if (m##) { print $_; $pre = 0; } else { chomp; $pref = ' '; $head = undef; $tail = $_; while ($tail) { if ($tail =~ m#^(.{1,70}\s*)(\<[^/].*)?$#) { $ws = ''; $head = $1; $tail = $2; } elsif ($tail =~ m#^(.{1,70}\>\s*)(.*)?$#) { $ws = ''; $head = $1; $tail = $2; } elsif ($tail =~ m#^(\s*)(.{1,70}\s*)(\s.*)?$#) { $ws = $1; $head = $2; $tail = $3; } elsif ($tail =~ m#^(.+?(\>\s*|\s+))(.*)?$#) { $ws = ''; $head = $1; $tail = $3; } else { $ws = ''; $head = $tail; $tail = ''; } if ($tail) { print $pref, $ws, $head, "\\\n"; } else { print $pref, $ws, $head, "\n"; } $pref = "+ " } } } }