#!/usr/bin/perl # # $Id: unprettify,v 1.5 1997/12/14 17:29:45 joi Exp joi $ # $Log: unprettify,v $ # Revision 1.5 1997/12/14 17:29:45 joi # Added support for " control. Lines starting with " in column 1 are # assumed to be plain text that is to be mushed. Spaces, tabs, # repeating character runs, and new lines are handled appropriately. # # Revision 1.4 1997/05/24 20:47:48 joi # Added keywoard test. # # Revision 1.3 1997/05/06 13:05:33 joi # Nuke tabs as well as spaces. # # Revision 1.2 1997/04/27 15:46:20 joi # Changed eol wrapping handling. # # Revision 1.1 1997/04/26 15:28:42 joi # Initial revision # # # this script reads a prettify'd mushcode source # and compacts it back for quoting into mush with tinyfugue. # require "/home/gyles19/bin/text2mush.pl"; $line = ""; unless (@ARGV) { @ARGV[0]=".*"; } while () { if (/^-$/) { # new line now foreach $pattern (@ARGV) { if ($line =~ /$pattern/){ $line =~ s/\%r$//; # nuke an unnecessary trailing %r. print $line, "\n"; last; } } $line = ""; } elsif (/^#/) { next; } elsif (/^"(.+)/) { # plain text to be mushed. $line .= &text2mush($1); } elsif (/^"$/) { $line .= "\%r"; } else { chop; s/^\s+//; # nuke all leading whitespace s/\s+$//; # nuke all trailing whitespace s/\\$//; # remove any trailing delimiter. s/^\\//; # remove any preceeding delimiter. $line .= $_; } }