# awk script to translate troff/mm->framemaker Version 1.00
# Part of filter from troff/mm to Framemaker's MML format.
# Created by David A. Wheeler 12/28/89
# Last Changed 1/19/90
BEGIN { FS = " "; OFS = " "; bodynext = 1; eachline = 0;
# Modify these for local formats
defaultparagraph="
";
headingname="Heading";
headingformat="<%d%s>\n";
printf("\n");
printf("\n");
printf("\n");
printf("\n"); }
/^\.DL/ { bodynext = 0 ; next }
/^\.BL/ { bodynext = 0 ; next }
/^\.H / {print ""; printf(headingformat, $2, headingname) ;
for (i=3; i <= NF; i++) { printf("%s ", $i); };
printf("\n") ; bodynext = 1 ; next}
/^\.LI/ {bodynext = 0 ; printf("\n"); print "" ; next}
/^\.LE/ {bodynext = 1 ; next}
/^\.P/ {bodynext = 1 ; next} # make new paragraph
/^\.SP/ {bodynext = 1 ; next} # make space same as paragraph
/^\.sp/ {bodynext = 1 ; next} # make space same as paragraph
/^\.SK/ {bodynext = 1 ; next} # make page skip same as paragraph
/^\.bp/ {bodynext = 1 ; next} # make begin page same as paragraph
/^\.nf/ {eachline++ ; next } # no fill
/^\.fi/ {eachline-- ; next } # fill again
/^\.TS/ {eachline++ ; next } # table start - treat as no fill
/^\.TE/ {eachline-- ; next } # table end
/^\.DS/ {eachline++ ; next } # display (static) start - treated as no fill
/^\.DF/ {eachline++ ; next } # display (floating) start - treat as no fill
/^\.DE/ {eachline-- ; next } # display end
/^\.ft B/ {printf("\n"); next } # Troff Bold.
/^\.ft I/ {printf("\n"); next } # Troff Italic.
/^\.ft R/ {printf("\n"); next } # Troff Roman == Plain.
/^\.B$/ {printf("\n"); next } # MM Bold command w/no parameters.
/^\.I$/ {printf("\n"); next } # MM Italic no parameters.
/^\.R$/ {printf("\n"); next } # MM Roman no parameters.
/^\.B/ {normal=-1 ; # MM Bold (but leaves in quotes)
for (i=2; i <= NF; i++) {
if (normal > 0) {printf("");}
else {printf("");};
printf("%s", $i); normal= -(normal); };
printf("\n\n"); next }
/^\.I/ {normal=-1 ; # MM Italic (but leaves in quotes)
for (i=2; i <= NF; i++) {
if (normal > 0) {printf("");}
else {printf("");};
printf("%s", $i); normal= -(normal); };
printf("\n\n"); next }
/^\.ce/ {printf("\n") ; print ""; bodynext = 0; next}
/^\.\\\\"/ {bodynext = 1 ; next} # scratch comment. Extra \\ from sed
/^\./ {printf("\n") ; print ; bodynext = 1; next} # other cmds stay in
{ if ( eachline > 0) printf("\n");
if (bodynext > 0) {printf("\n"); print defaultparagraph ;
bodynext-- ;} ;
print ; next}