[comp.text] troff | FILTER | FrameMaker ???

kenney@hsi86.hsi.com (Brian Kenney) (05/14/91)

Has anyone heard of the existence of a filter that will translate troff
to Frame MIF format?

Thanks in advance...

-Bri

-- 
Brian Kenney                                       kenney@hsi.com 
3M Health Information Systems                      Wallingford, CT
------------------------------------------------------------------------------
"It's not innovation... but it's close."    

mark@drd.com (Mark Lawrence) (05/15/91)

In article <3603@hsi86.hsi.com> kenney@hsi.com (Brian Kenney) writes:
>Has anyone heard of the existence of a filter that will translate troff
>to Frame MIF format?

From the moldy, oldy framers archives:
# Date: Wed, 21 Nov 90 15:34:08 EST
# From: drd!ida.org!wheeler (David Wheeler)
# Message-Id: <9011212034.AA03489@oids-3.noname>
# Subject: troff/mm->Framemaker translator script (here it is!)..

Below the dashed lines is a shar archive of the troff/MM to Framemaker
translator.  This is the translator I described earlier.

The program itself is relatively short, but I've tried to document it
well so that people can easily modify it according to need.  Please
forward any generally useful changes to me so that I can include then
in a general version!

I hope you find the program useful!

--- David A. Wheeler
    wheeler@ida.org


INSTALLATION INSTRUCTIONS
(These instructions are also included in the file INSTALL once you
unarchive this message)

Create two new directories (using mkdir), one
that will be relatively private and can be used for development
(so you can modify the filter and test those modifications)
and a final version that everyone will use in day-to-day work.
The "final" version should be accessable to all
(using chmod ugo+rx final_directory_name).

Copy or move the archived file into the "development" directory and
unarchive it.  Unarchiving is done by editing this message so
that the "CUT HERE" line and everything ABOVE it is deleted,
then executing  "sh <YOUR_FILE_NAME_HERE"


---------------CUT HERE-----------------------------------------------
: This is a sharchive -- extract the files by running through sh.
echo : Archive created by wheeler on Wed Nov 21 13:57:48 EST 1990 
echo x -- mm2frame
sed 's/^X//' <<\Shar_Eof >mm2frame
X#!/bin/sh
X# Translate from troff/mm to Framemaker's MML format.
X# Created by David A. Wheeler 12/28/89
X# (C) David A. Wheeler 1990
X# Intended for use by humans - it does various checks before executing.
X# This is Version 1.00, 1/19/90
X# Arguments: parameter 1 == name of MM file with .mm extension.
X# This program produces an MML file with the .mml extension.
X# This program requires that the file end in .mm
X
X# First test if the file is okay to use.
X
Xif [ ! -f $1 ]
X then
X  echo "Sorry, cannot find file $1" 1>&2
X  exit 1
Xfi
X
Xif [ ! -r $1 ]
X then
X  echo "Sorry, cannot read file $1" 1>&2
X  exit 2
Xfi
X
X# Change this to allow use of files which don't end in .mm
X# If you do so, also change how the output filename is generated.
Xcase $1 in
X *.mm) ;;
X *) echo "Sorry, $1 does not end with .mm" 1>&2
X    exit 3
Xesac
X
X# Actual translation follows.
X
X/usr04/wheeler/framemm/mm2mml <$1 >${1}l
Shar_Eof
echo x -- mm2mml
sed 's/^X//' <<\Shar_Eof >mm2mml
X#!/bin/sh
X# Filter from troff/mm to Framemaker's MML format.
X# Created by David A. Wheeler 12/28/89
X# (C) David A. Wheeler 1990
X# This is Version 1.00, 1/19/90
X# Standard in: file in MM format.
X# Standard out: file in MML format.
X
Xif [ -f /usr04/wheeler/framemm/.WHOUSES ]
X then
X echo "${USER} `date`" >> /usr04/wheeler/framemm/.WHOUSES
Xfi
X
Xsed -f /usr04/wheeler/framemm/mm2frame.sed | \
X   awk -f /usr04/wheeler/framemm/mm2frame.awk
Shar_Eof
echo x -- mm2frame.sed
sed 's/^X//' <<\Shar_Eof >mm2frame.sed
X# by David A. Wheeler. Last changed 2/8/90.
X/^\.H /s/"//g
X/^\.UL /s/"//g
Xs/\\/\\\\/g
Xs/</\\</g
Xs/>/\\>/g
Xs/^\.B  *"\([^"]*\)" *$/<Bold>\1<Plain>/
Xs/^\.I  *"\([^"]*\)" *$/<Italic>\1<Plain>/
Xs/^\.B  *"\([^"]*\)" "\([^"]*\)" *$/<Bold>\1<Plain>\2/
Xs/^\.I  *"\([^"]*\)" "\([^"]*\)" *$/<Italic>\1<Plain>\2/
Xs/^\.B  *"\([^"]*\)" \([^"]*\) *$/<Bold>\1<Plain>\2/
Xs/^\.I  *"\([^"]*\)" \([^"]*\) *$/<Italic>\1<Plain>\2/
Xs/^\.B  *\([^"]*\) "\([^"]*\)" *$/<Bold>\1<Plain>\2/
Xs/^\.I  *\([^"]*\) "\([^"]*\)" *$/<Italic>\1<Plain>\2/
Xs/\\\\fI/<Italic>/g
Xs/\\\\fB/<Bold>/g
Xs/\\\\fP/<Plain>/g
Xs/\\\\fR/<Plain>/g
Xs/	/\\t/g
Xs/``/<Character \\xd2 >/g
Xs/''/<Character \\xd3 >/g
Xs/\\\\(dg/<Character \\xa0 >/g
Xs/\\\\(no/<Character \\xc2 >/g
Xs/\\\\(em/<Character \\xd1 >/g
Shar_Eof
echo x -- mm2frame.awk
sed 's/^X//' <<\Shar_Eof >mm2frame.awk
X# awk script to translate troff/mm->framemaker Version 1.00
X# Part of filter from troff/mm to Framemaker's MML format.
X# Created by David A. Wheeler 12/28/89
X# Last Changed 1/19/90
XBEGIN	{ FS = " "; OFS = " "; bodynext = 1; eachline = 0;
X       # Modify these for local formats
X       defaultparagraph="<Body>";
X       headingname="Heading";
X       headingformat="<%d%s>\n";
X       printf("<MML 1.00 -- The following is in Framemaker mml format>\n");
X       printf("<Include \"/usr04/wheeler/framemm/troffmm.mml\">\n");
X       printf("<Comment *** mm2frame filter (C) David A. Wheeler 1990 ***>\n");
X       printf("<Comment *** Start of Document Text ***>\n"); }
X/^\.DL/	{ bodynext = 0 ; next }
X/^\.BL/	{ bodynext = 0 ; next }
X/^\.H /	{print ""; printf(headingformat, $2, headingname) ;
X         for (i=3; i <= NF; i++) { printf("%s ", $i); };
X         printf("\n") ; bodynext = 1 ; next}
X/^\.LI/	{bodynext = 0 ; printf("\n"); print "<BulletItem>" ; next}
X/^\.LE/	{bodynext = 1 ; next}
X/^\.P/	{bodynext = 1 ; next} # make new paragraph
X/^\.SP/	{bodynext = 1 ; next} # make space same as paragraph
X/^\.sp/	{bodynext = 1 ; next} # make space same as paragraph
X/^\.SK/	{bodynext = 1 ; next} # make page skip same as paragraph
X/^\.bp/	{bodynext = 1 ; next} # make begin page same as paragraph
X/^\.nf/	{eachline++ ; next }  # no fill
X/^\.fi/	{eachline-- ; next }  # fill again
X/^\.TS/	{eachline++ ; next }  # table start - treat as no fill
X/^\.TE/	{eachline-- ; next }  # table end
X/^\.DS/	{eachline++ ; next }  # display (static) start - treated as no fill
X/^\.DF/	{eachline++ ; next }  # display (floating) start - treat as no fill
X/^\.DE/	{eachline-- ; next }  # display end
X/^\.ft B/	{printf("<Bold>\n"); next }    # Troff Bold.
X/^\.ft I/	{printf("<Italic>\n"); next }  # Troff Italic.
X/^\.ft R/	{printf("<Plain>\n"); next }   # Troff Roman == Plain.
X/^\.B$/	{printf("<Bold>\n"); next }    # MM Bold command w/no parameters.
X/^\.I$/	{printf("<Italic>\n"); next }  # MM Italic no parameters.
X/^\.R$/	{printf("<Plain>\n"); next }   # MM Roman no parameters.
X/^\.B/	{normal=-1 ;                   # MM Bold (but leaves in quotes)
X         for (i=2; i <= NF; i++) {
X            if (normal > 0) {printf("<Plain>");}
X             else           {printf("<Bold>");};
X            printf("%s", $i); normal= -(normal); };
X         printf("\n<Plain>\n"); next }
X/^\.I/	{normal=-1 ;                   # MM Italic (but leaves in quotes)
X         for (i=2; i <= NF; i++) {
X            if (normal > 0) {printf("<Plain>");}
X             else           {printf("<Italic>");};
X            printf("%s", $i); normal= -(normal); };
X         printf("\n<Plain>\n"); next }
X/^\.ce/	{printf("\n") ; print "<Title>"; bodynext = 0; next}
X/^\.\\\\"/	{bodynext = 1 ; next}  # scratch comment. Extra \\ from sed
X/^\./	{printf("\n") ; print ; bodynext = 1; next} # other cmds stay in
X	{ if ( eachline > 0) printf("\n");
X          if (bodynext > 0) {printf("\n"); print defaultparagraph ;
X                             bodynext-- ;} ;
X          print ; next}
X
Shar_Eof
echo x -- mm2frame.pdoc
sed 's/^X//' <<\Shar_Eof >mm2frame.pdoc
XProgram Documentation for "mm2frame"
Xby David A. Wheeler
XDocumentation as of 1/19/90
X(C) David A. Wheeler 1990
X
Xmm2frame is a program for translating basic troff/mm commands into Framemaker.
XThe combination of troff and the mm macros will be called MM in this
Xdocumentation.
X
XTo translate MM documents into Framemaker documents:
X1) Using a shell cd into the directory with your .mm file(s)
X2) Rename your file so that it ends in .mm (mv oldname oldname.mm)
X
XIf the program was installed to be automatically invoked, just do:
X3) Use Framemaker's File/Import command.  Choose your file, which now ends
X   with .mm.  You may need to execute the "Redisplay" command.
X
XIf the program was not installed to be automatically invoked:
X3) Type: /usr04/wheeler/framemm/mm2frame oldname.mm
X4) Use Framemaker's File/Import command. You'll notice a new file
X   ending in .mml -- choose this file.  You may need to execute the
X   "Redisplay" command.
X
XCurrently this is a VERY simplistic translator.
XIt does not handle preprocessor commands, such as
Xtables, equations, or pictures (tbl, eqn, pic), it ignores
Xmany parameters (such as .LI x), it ignores all MM variables,
Xand handles only a limited subset of the MM commands.
XCommands the translator doesn't understand are included in the
Xresulting Framemaker document as regular text.
X
XNevertheless, this is helpful for documents which use (at least mostly)
Xa subset of the MM commands.  It certainly beats doing it ALL
Xby hand.  The next best alternative to this translator is to rename
Xthe file to end in .txtalt and then use the Framemaker file/import
Xcommand, but the formatting information is unused.
X
XThe translator handles the following MM commands:
Xitalics (\fI, .ft I or .I), bold (\fB, .ft B or .B), normal
X(\fP, \fR, .R or .ft R), headers (.H 1-3), dashed and
Xbold lists (.DL/.BL; can't imbed them), don't fill/fill (.nf/.fi),
Xparagraph (.P), and center (.ce no arguments, creates a Title paragraph).
X
XThe vertical space commands (.sp, .SP, .SK, and .bp) are interpreted as
Xnew-paragraph commands.  The table begin & end commands (.TS/.TE) and
Xdisplays (.DS or .DF /.DE) will cause each line to be its own
XFramemaker paragraph (as don't fill/fill do) in order to make
Xtranslating easier.
X
XCharacters such as double-backslash, angle brackets, dagger, logical not,
Xem dash, and double quote marks (both directions) are translated as well.
X
XNote: if your documents have heading levels greater than 3 (.H 4, etc),
Xyou should define equivalent paragraph types BEFORE you translate.
X
X--- David A. Wheeler
X    wheeler@ida.org
X
X-------------------------------------------------------------------
X
XTo install this somewhere else, substitute all instances of
X/usr04/wheeler/framemm with the name of the directory the
Xfiles are installed in.
X
XDesign information:
X
XActually, mm2frame performs various checks and then
Xcalls mm2mml, a filter program that accepts
XMM and produces MML.  MML is an intermediate Framemaker format.
XFramemaker then translates MML into MIF, and then translates
XMIF into its own internal format.
X
Xmm2mml sends the file through a sed script to do some cleanup
X(mm2frame.sed), then through an awk script (mm2frame.awk).
XThe resulting file is in MML format.  This file has an include
Xstatement for the file troffmm.mml -- a file with various formatting
Xinformation that can be modified for other formats.
X
XCurrently the sed script translates the italics, bold, and plain
Xcommands, as well as stripping off quotes in the .H command.
XIt also translates certain characters that can appear in MM files
Xinto their equivalent MML characters (tab, greater-than, less-than,
Xand backslash).  Be careful about modifying the order - the order
Xthe substitutions are done is important.
XThe sed script outputs all backslashes as doubled backslashes.
XThe characters backquote and forward quote are not translated -
Xit appears that the documentation is wrong in suggesting this translation,
Xbecause it results in garbage.
XSee MML Reference manual page 2-10 and /usr2/frame/source/txttomif.c.
X
XThe awk script does all the rest.
X
Xmm2frame understands the following MM commands:
X
X  \fI
X     <Italics>
X  \fB
X     <Bold>
X  \fP  or \fR
X     <Plain>
X     Note that this is really "previous" in troff, not
X     "plain", but in troff it is usually used to revert to plain text
X     and so is translated that way.
X     For example, the program checknr checks to see that all \fx commands
X     end with \fP and complains when this is not true.
X     This translation would have to be done in the awk script in 
X     order to really make it "previous" (it is currently done in sed).
X  .ft B, I or R
X    Into Bold, italics or roman.
X  .B, .I, .R
X    Bold, italics, roman.  These work normally with 0, 1 or 2 parameters.
X    Bug: if these commands are given more than 2 parameters,
X    any quotation marks which surround the parameters will
X    (unfortunately) be included.
X  `` and ''
X     Into <Character \xd2 > and <Character \xd3 >, the doublequote chars.
X  \(dg
X     Into <Character \xa0 >, the dagger character.
X .H x text  (heading)
X    Note: x must be <=3. If it is greater, edit troffmm.mml to support
X     larger values of x.
X    each of these is translated into:
X    {CR}
X    <{x}Header>
X    text (with surrounding quotes removed)
X    {CR}
X        then sets "bodynext"
X .DL  (dashed list)
X .BL  (bulleted list)
X    Limitation: ignores arguments.
X    Note: imbedded lists are not supported.
X    The current implementation just skips this.
X    If bullets should be differentiated (FirstBullet, Bullet)
X    or nestable this (and .LE) would have to be modified.
X .LI  (list item)
X    Limitation: ignores arguments.
X    Generates:
X    {CR}
X    <BulletItem>
X       then unsets "bodynext"
X .LE  (end of list)
X    Currently just skips and sets Bodynext.
X .P   (paragraph)
X    Limitation: ignores arguments.
X    Currently just sets Bodynext
X .TS/.TE
X    Makes each line a paragraph.  Doesn't translate tables, but
X    this makes table conversion easier.
X .nf/.fi
X    Makes every line a paragraph.
X .ce   (center)
X    Limitation: ignores arguments.
X    Generate
X      {CR}
X      <Title>
X    set Bodynext
X .\" Comment
X    eliminated.
X .DS/.DF/.DE
X    displays - same as nofill/fill (.nf/.fi)
X .any other command
X    copied into the output and sets bodynext.
X
X
XEncountering anything else, the system
Xwill:
X  1) if "eachline" is >0, print a blank line.
X  2) if "Bodynext" is set, output:
X     <Body>
X  3) copy lines until it hits something it recognizes.
X
X
XIn the awk script, the following variables have the following meanings:
X
X eachline: if >0, each line is turned into a paragraph by
X          seperating each line with a blank line.
X          .TS and .nf add one to it; their converses subtract one.
X bodynext: if >0, if the next line is normal text a <Body> phrase is
X         put in front of it.
X
XThe following are constants:
X
Xdefaultparagraph  -- name of default paragram in MML format.
X                     Currently <Body>
Xheadingname       -- name of heading format.  Currently Heading.
Xheadingformat     -- format of Heading in MML in C printf format.
X                     Currently <%d%s>\n.
X 
X
XThis program could be installed in ../frame/.fminit2.0.ps/MifRead
Xso that the filename suffix .mm will automatically engage this.
X
XPOSSIBLE UPGRADES
X The following MM commands could be handled better, and are listed
X here to give people ideas on how to improve this.
X .TS/.TE
X    Could translate tables, but that's hard.  I understand others
X    are working on programs to translate tbl tables into Framemaker; if
X    they become available they could be automatically invoked.
X .SK
X     A real page skip.  This isn't so easy in Framemaker.
X  .sp and .SP
X     Improve vertical spacing to do more than create a new paragraph.
X .UL text
X    underline text.  This isn't officially an MM macro but it's in
X    common use at IDA.  It'd be <underline> ... <nounderline>.
X    This would be an easy addition.
X    The sed script already strips any double quotes on a UL command
X    in anticipation of this command being added.
X .S
X    point size.  <pts number> is close.  The awk script could keep track
X    so that +2, etc, would work.
X    This wouldn't be too hard to add.
X .FS/.FE
X    footnotes. Possibly generate <Footnote> at the appropriate time.
X .ce NUMBER
X    use the NUMBER for centering
X .DS options
X .BR, .IB, .RI, .BI, .IR, .RB
X   alternating bold, roman & italic commands. (note that \fI, etc, works)
X equations and figures
X    This could be difficult.
X other special characters
X    This is an easy addition, just time-consuming if you add
X    ALL of them. Editing mm2frame.sed should do the job
X    for almost all special characters.  Other chars are
X    especially important for mathematical or non-English documents.
X    See appendix B of the Framemaker Reference Manual
X    for Framemaker characters, and the sed script for some examples.
X    In particular, I've done the "dagger" character as an example in
X    the sed script.  Note the double backslashes and the space
X    before the greater-than sign - these are required!
X    You may also consider using "lex" to translate characters.
X .LI
X   support multiple depths of lists, not just one.
X .AL x y
X   Alphabetized or numbered lists.
X
XFILES INCLUDED IN TRANSLATOR ARCHIVE
X
XThe following is a brief description of the files included in the
Xtranslator shar archive.
X
Xmm2frame       -- Main program (for use by humans). Calls mm2mml.
Xmm2mml         -- Real filter program.
Xmm2frame.awk   -- Awk script... does the more difficult translations.
Xmm2frame.sed   -- Sed script... does the simple character-based xlations.
Xmm2frame.pdoc  -- Program documentation.
XTest.mm        -- Test file in MM format (type "make" to do a translation)
XMakefile       -- Makefile for the mm2frame filter program.  Allows the user
X                  to run a test case, install for the first time,
X                  install to the "final" directory, or create a shar archive.
Xchangename     -- Simple program to change all instances of one phrase with
X                  another.  Currently a sed command.
XINSTALL        -- Text file of Installation instructions.
XREADME         -- Text file of basic information.
XDISTRIBUTE     -- shar archive created via the Makefile. This is created by
X                  typing "make DISTRIBUTE".
Xsharup         -- creates a shar archive.
Xtroffmm.mml    -- file in MML format.  Used when Framemaker loads the MML
X                  file created by this filter.  Includes commands to
X                  create new paragraph types and to declare types that
X                  already exist and may be used by the filter.
X
X
XBUGS
X
XA double-backslash followed by the troff italics, bold, or previous commands
X(which begin with another backslash) won't come out correctly
Xdue to the way the sed script is organized.  This bug is unlikely to
Xcause problems in real documents.
X
XAn escaped " in the parameters of commands doesn't work well.
XFor example, the .B, .I, or .R commands work in funny ways.
X
XThe troffmm.mml file could probably be cleaned up and shortened a bit -
Xright now it sets too many things.  It works for me, so I haven't
Xbothered to change it.
X
XCHANGES
X
XIf you make any changes to this program that you find useful, please let me
Xknow!  Use "make DISTRIBUTE" to create a shar file (named DISTRIBUTE)
Xof all the files to transport.  Email the resulting DISTRIBUTE file to
XDavid A. Wheeler at "wheeler@ida.org".
X
XNECESSARY LEGAL STATEMENT
X
XThis product is not sponsored by the Institute for Defense Analyses
X(IDA) and comes "as is".  Neither IDA nor David A. Wheeler
Xguarantee that this product will or will not do something.
XThe term product includes the executable program as well as its
Xdocumentation.
X
XYou may freely use this program as long as you do all of the following:
X1) Give credit where credit is due. You must leave in the notice of who
Xwrote this program both in the code and in the generated file.
X2) Don't sell it commercially (for profit) or as part of a
X   commercial package.  Talk to me if you wish to!
X
Shar_Eof
echo x -- Makefile
sed 's/^X//' <<\Shar_Eof >Makefile
X# Makefile for mm2frame filter.
X# David A. Wheeler 1/18/90
X#
X# To install this program, modify both the DEVELOPMENT and FINAL lines
X# below, then do: make firsttime
X#  (which creates a development directory and then the "public" directory)
X#
X# The directory containing the "developmental" version of the
X# program:
XDEVELOPMENT=/usr04/wheeler/framemm
X#
X# The directory containing the "current" version of the
X# program which is visible to the everyday user.
XFINAL=/usr01/wheeler/framemm
X#
X#
X# The directory which I use to keep the "developmental" version of the
X# program.  This name needs to be changed to the one in DEVELOPMENT
X# before the program will execute.
XMYDEVELOPMENT=/usr04/wheeler/framemm
X#
X# Do not add a slash after the end of any of these directory names.
X#
X
X# The makefile assumes you are in its directory and that
X# the path includes a reference to ., the current directory.
X
X
X# Default make command: recreate Test.mml from Test.mm in order to
X# test changes in the program.  I've included Test.mm so you can see
X# what it does.
X
XTest.mml: Test.mm mm2frame.awk mm2frame.sed mm2frame mm2mml
X	$(DEVELOPMENT)/mm2frame Test.mm
X
X# This is an internal document I have & use to test -- this file
X# is not included.
X
XHouston.mml: Houston.mm mm2frame.awk mm2frame.sed mm2frame mm2mml
X	mm2frame Houston.mm
X
X# Do this before using the filter the very first time.
X# Changes names of MYDEVELOPMENT into DEVELOPMENT and installs.
X
Xfirsttime:
X	chmod u+rx changename
X	chmod u+rx sharup
X	changename $(MYDEVELOPMENT) $(DEVELOPMENT) <mm2frame >mm2frame.new
X	mv mm2frame.new mm2frame
X	chmod u+rx mm2frame
X	changename $(MYDEVELOPMENT) $(DEVELOPMENT) <mm2mml >mm2mml.new
X	mv mm2mml.new mm2mml
X	chmod u+rx mm2mml
X	changename $(MYDEVELOPMENT) $(DEVELOPMENT) <mm2frame.sed \
X		>mm2frame.sed.new
X	mv mm2frame.sed.new mm2frame.sed
X	changename $(MYDEVELOPMENT) $(DEVELOPMENT) <mm2frame.awk \
X		>mm2frame.awk.new
X	mv mm2frame.awk.new mm2frame.awk
X	changename $(MYDEVELOPMENT) $(DEVELOPMENT) <mm2frame.pdoc \
X		>mm2frame.pdoc.new
X	mv mm2frame.pdoc.new mm2frame.pdoc
X	# Now copy to the "final" directory using make.
X	$(MAKE) install
X
X# Do this to copy files from the DEVELOPMENT directory
X# into the FINAL directory
X
Xinstall:
X	# install on FINAL
X	cp troffmm.mml $(FINAL)
X	changename $(DEVELOPMENT) $(FINAL) <mm2frame \
X		>$(FINAL)/mm2frame
X	changename $(DEVELOPMENT) $(FINAL) <mm2mml \
X		>$(FINAL)/mm2mml
X	changename $(DEVELOPMENT) $(FINAL) <mm2frame.sed \
X		>$(FINAL)/mm2frame.sed
X	changename $(DEVELOPMENT) $(FINAL) <mm2frame.awk \
X		>$(FINAL)/mm2frame.awk
X	changename $(DEVELOPMENT) $(FINAL) <mm2frame.pdoc \
X		>$(FINAL)/mm2frame.pdoc
X	echo "This version of mm2frame installed on    `date`" > $(FINAL)/INSTALLTIME
X	echo "from `pwd` by ${USER}"  >> $(FINAL)/INSTALLTIME
X	# changename doesn't need to be copied over.
X	cd $(FINAL) ; chmod ugo+r mm2frame.pdoc troffmm.mml mm2frame.sed mm2frame.awk INSTALLTIME ; chmod ugo+rx mm2frame mm2mml
X
X# Create a shar archive & put in file DISTRIBUTE.
X
XDISTRIBUTE: mm2frame mm2mml mm2frame.sed mm2frame.awk mm2frame.pdoc \
X    Makefile Test.mm troffmm.mml changename sharup README INSTALL MODS
X	csh sharup mm2frame mm2mml mm2frame.sed mm2frame.awk mm2frame.pdoc Makefile Test.mm troffmm.mml changename sharup README INSTALL MODS > DISTRIBUTE
X
Shar_Eof
echo x -- Test.mm
sed 's/^X//' <<\Shar_Eof >Test.mm
X.\" SQPR_OPTIONS="-rN2"
X.ce
XTest Document Translating MM to Framemaker
X
X.H 1 "Introduction"
XThis is a normal sentence.
XThis is an angle bracket <test>.
XThis is double-quote ``test''.
XThis is a backslash \\test\\.
XThis is an italic \fItest\fP.
XThis is a bold \fBtest\fP.
XThis is a dagger\(dg.
XThis is a logical not\(no.
XThis is an em dash\(em, not a dash-.
X.P
XThis is a
X.ft B
Xbold text
X.ft I
Xitalics text
X.ft R
Xnormal text test.
X.B
XThis is bold.
XBold.
XBold.
X.I
XThis is italics.
XItalics.
X.R
XThis is normal.
X.B "Bold text."
X.B "Bold" "next to normal."
X.B "Bold" normal.
X.B Bold "normal."
X.B Bold normal bold normal bold normal.
X.I "Italic text."
X.I "Italic" "next to normal."
X.I "Italic" normal.
X.I Italic "normal."
X.I Italic normal italic normal italic normal.
X.P
XThis is a new paragraph.
X.sp
XSo is this.
X
XThis is a new paragraph.
X
XThis is a sentence to test a long paragraph.
XThis is a sentence to test a long paragraph.
XThis is a sentence to test a long paragraph.
XThis is a sentence to test a long paragraph.
XThis is a sentence to test a long paragraph.
XThis is a sentence to test a long paragraph.
XThis is a sentence to test a long paragraph.
XThis is a sentence to test a long paragraph.
XThis is a sentence to test a long paragraph.
XThis is a sentence to test a long paragraph.
X
X.nf
XThis is no-fill test. This is line 1.
XThis is line 2.
XThis is line 3.
X.fi
X
X.H 1 "Next Section"
XThis is another section.
X.DL
X.LI
XFirst bulleted item.
X.LI
XSecond bulleted item.
X.LI
XThird bulleted item.
X.LE
XThis isn't a bulleted item.
X.H 2 "Level Two Heading"
X.H 2 "Level Two Heading"
XWith some text in it.
X.H 2 "Level Two Heading"
X.H 3 "Level Three Heading"
XText, text.
X.H 3 "Level Three Heading"
X.H 1 "Level One Heading"
X
X.\" This is a comment and shouldn't appear in the Framemaker document.
X.\" This is a comment and shouldn't appear in the Framemaker document.
X.\" The following isn't translated and should appear in the document.
X.nr Hy 1
X
Shar_Eof
echo x -- troffmm.mml
sed 's/^X//' <<\Shar_Eof >troffmm.mml
X<MML 1.00 -	troffmm.mml  Standard font, paragraph, and document 
X	formats>
X<Comment  *** Define fonts for Title, Section, Body, Headers and Footers.
X	  Most of the defaults are good, so we just specify family,
X	  size, and style. "ft" stands for "font for Titles", "fs" is
X	  "font for sections," etc.>
X<Comment  *** This could be reduced in size - this was put together from
X         various demos until it worked. > 
X<Comment  For David A. Wheeler's mm2frame filter.>
X
X<!DefineFont ft
X	<Family 	Times>
X	<pts 	18>
X	<Bold>
X>
X<!DefineFont fs
X	<Family 	Times>
X	<pts 	14>
X	<Bold>
X>
X<!DefineFont fb
X	<Family 	Times>
X	<pts 	12>
X	<Plain>
X>
X<!DefineFont fhf
X	<Family 	Times>
X	<pts 10>
X	<Plain >
X> 
X<Comment *** Set appropriate font for a Title paragraph and 
X	     define its format: >
X<!DefinePar Title 
X	<ft>
X	<Alignment 	Center > 
X	<SpaceAfter 	12pt> 
X	<ForceFont	Yes>
X>
X
X<Comment *** set font and define other paragraph formats>
X<!DefinePar Section
X	<fs>
X	<Alignment 	Left >
X	<LeftIndent  	0.50">
X	<FirstIndent  	0.00">
X  	<RightIndent  	0.00">
X  	<Leading 	0pt>
X  	<SpaceBefore 	9pt>
X  	<SpaceAfter 	9pt>
X  	<AutoNumber 	Yes >
X  	<NumberFormat 	"+.0\t">
X	<TabStops <TabStop	0.50"> >
X>
X<!DefinePar Body
X	<fb>
X  	<Alignment 	LeftRight >
X  	<LeftIndent  	0.50">
X	<FirstIndent  	0.50">
X  	<RightIndent  	0.00">
X  	<Leading 	2pt>
X  	<SpaceBefore 	0pt>
X  	<SpaceAfter 	10pt>
X	<ForceFont	Yes>
X 	<AutoNumber 	No >
X	<TabStops>
X> 
X
X<!DefinePar BulletItem
X  	<Alignment 	Left >
X  	<LeftIndent  	0.75">
X	<FirstIndent  	0.50">
X  	<RightIndent  	0.00">
X  	<Leading 	2pt>
X  	<SpaceBefore 	0pt>
X  	<SpaceAfter 	3pt>
X	<ForceFont	Yes>
X	<AutoNumber	Yes>
X	<NumberFormat	"\xA5 \t">
X      <Comment *** \xA5 is the bullet character. \t is a tab character.>
X	<TabStops
X		<TabStop	0.75">
X	>
X> 
X
X<Comment  *** Document Layout descriptions. Most of the default settings
X	  are good. >
X<Pagewidth		7.00">
X<PageHeight		10.00">
X<TopMargin		0.75">
X<BottomMargin		0.75">
X<LeftMargin		0.50">
X<RightMargin		0.50">
X<HeaderTopMargin	0.40">
X<HeaderBottomMargin	0.46">
X<HeaderLeftMargin	1.00">
X<HeaderRightMargin	1.00">
X
X<!DefineMacro           if "<Italic>">
X<!DefineMacro           pf "<Plain>" >
X<!DefineMacro           bf "<Bold>"  >
X
X<Comment File: ChapterFormats.mml> 
X<Comment Include file for Chapter template>
X<Comment Define all paragraph tags in Chapter template>
X
X<!DefineTag 1Heading>
X<!DefineTag 2Heading>
X<!DefineTag 3Heading>
X<!DefineTag Body>
X<!DefineTag Bullet>
X<!DefineTag CBullet>
X<!DefineTag Chapter>
X<!DefineTag CStep>
X<!DefineTag Equation>
X<!DefineTag ETable>
X<!DefineTag Extract>
X<!DefineTag Figure>
X<!DefineTag FirstBody>
X<!DefineTag Footnote>
X<!DefineTag HTable>
X<!DefineTag Step>
X<!DefineTag Table>
X
Shar_Eof
echo x -- changename
sed 's/^X//' <<\Shar_Eof >changename
X# /bin/sh
X# Changes all instances of the first parameter
X# to the second parameter in standard input, producing
X# the result in standard output.
X# This is used during installation.
Xsed -e "s=${1}=${2}=g"
Shar_Eof
echo x -- sharup
sed 's/^X//' <<\Shar_Eof >sharup
X#!/bin/csh -f
X
Xif ($#argv == 0) then
X    echo "error: no arguments specified."
X    exit 1
Xendif
X
Xecho ""
Xecho ": This is a sharchive -- extract the files by running through sh."
Xecho "echo : Archive created by ${USER} on `date` "
Xforeach f ($argv)
X    set ff = $f:t
X    echo "echo x -- $ff"
X    echo "sed 's/^X//' <<\Shar_Eof >$ff"
X    sed 's/^/X/' $f
X    echo "Shar_Eof"
Xend
X
Xecho "exit 0"
Shar_Eof
echo x -- README
sed 's/^X//' <<\Shar_Eof >README
XThis directory is a working directory for the mm2frame
Xtranslator.  This directory is for those who want to try the
X"latest" version (at their own risk).
X
XFor installation instructions see the file INSTALL.
X
XThe documentation describing how to use the
Xfilter, as well as describing the code, is in mm2frame.pdoc.
X
X--- David A. Wheeler
X    wheeler@ida.org
Shar_Eof
echo x -- INSTALL
sed 's/^X//' <<\Shar_Eof >INSTALL
X
XThere are three types of installations:
X1. Those who have just gotten this file from an archive, email, etc,
X   and have NEVER used this program.  Instructions for you follow.
X2. Those who've used this program before, and have added their own
X   modifications to the program.  This second type of installation
X   is accomplished by typing "make install".
X3. Those who want to customize this program for local Framemaker templates.
X   See below.
X
XThe following applies to the first type of installation:
X
XI've run the program on a Sun 3/50 using SunOS (Berkeley UNIX).  The
Xprogram is set up for Berkeley UNIX; it may run without modification on
Xsome other Unixes.  It expects Framemaker 2.0.
X
XTo install this program, create two new directories (using mkdir), one
Xthat will be relatively private and can be used for development
X(so you can modify the filter and test those modifications)
Xand one for the final version that everyone will use in day-to-day work.
XThe former is called the "development directory", while the latter
Xis called the "final directory".
XThe final directory should be accessable to all
X(using chmod ugo+rx final_directory_name).
X
XCopy or move the archived file into the "development directory" and
Xunarchive it.  Unarchiving is done by editing the file so
Xthat the "CUT HERE" line and everything ABOVE it is deleted,
Xthen executing  "sh <YOUR_FILE_NAME_HERE"
X
XEdit the file "Makefile" using any text editor (such as vi or emacs).
XOn the line that says
XDEVELOPMENT=/usr04/wheeler/framemm
Xchange /usr04/wheeler/framemm to the "development directory" name.
XThis should be the same directory the Makefile currently resides in.
XThe line that says
XFINAL=/usr01/wheeler/framemm
Xshould be edited to the "final directory" name which will be used
Xby all normal users of the filter.
X
XSave the Makefile file, leave your editor, and type:
X
Xmake firsttime
X
X
XWhen it's finished you'll have files in your final directory for all to
Xuse, plus the files in a development directory so you can modify and
Xtest new versions to account for local customs.
X
X
XTo make the translation automatic on any file ending with .mm,
Xcd to the .../frame/.fminit2.0 directory which is used by Framemaker.
XAdd to the file MifRead the following text in its
Xcase statement (adding this text may require special access privileges):
X
X         *.mm) /usr01/wheeler/framemm/mm2mml <$1 | \
X              $5/mmltomif  -I$3 -I~ -I$4 >$2  ;;
X
XReplace the phrase /usr01/wheeler/framemm  with your "final directory" name.
XIn the same .fminit2.0 directory add to the end of the file
X"suffixlist" this one line so that the ".mm" suffix will be considered
Xspecial:
X<mm>
X
X
XOnce you've installed the translator
Xyou may want to customize it for local templates.
XThe file troffmm.mml can be easily modified to account for local
Xcustoms. Also, the file mm2frame.awk includes some lines near the
Xtop to allow for customizing the default paragraph name, as well
Xas how headings are produced.
X
X
X
X--- David A. Wheeler
X    wheeler@ida.org
X
Shar_Eof
echo x -- MODS
sed 's/^X//' <<\Shar_Eof >MODS
XModifications to mm2frame filter:
X
X1/23/90:
XReleased mm2frame filter to the general public.
X
X2/9/90:
XAdded the .B, .I, and .R commands (without and with parameters),
Xthe \fR command, the .ft B|I|R command, and the two troff characters
Xlogical-not and emdash.
XThe .bp (break page) is translated as a new-paragraph command.
X
X2/10/90:
XAdded the MODS file so people could see the changes made to a particular
Xversion.
Shar_Eof
exit 0

-- 
mark@drd.com
mark@jnoc.go.jp  $B!J%^!<%/!&%i%l%s%9!K(B  Nihil novum sub solem

lark@greylock.tivoli.com (Lar Kaufman) (05/16/91)

Frame offers a Filter Pak product that works with the text.
Blueberry offers Filtrix, which provides this capability also.  I have 
not used Filtrix.

Lar Kaufman            I would feel more optimistic about a bright future
(voice) 512-794-9070   for man if he spent less time proving that he can
(fax)   512-794-0623   outwit Nature and more time tasting her sweetness 
lark@tivoli.com        and respecting her seniority.  - E.B. White