[comp.sources.wanted] Interleaf to nroff or tex filter

beth@stripe.ACA.MCC.COM (Beth Paxton) (08/24/89)

Has anyone seen or written an Interleaf (ver. 4.0 - tps) to nroff
or Interleaf to tex filter?  If so, from where could I retrieve
it?

Thanks,
Beth Paxton

P.S.  Please answer directly to me instead of to news -- I don't
keep up with news on a daily basis.

davecb@yunexus.UUCP (David Collier-Brown) (08/25/89)

beth@stripe.ACA.MCC.COM (Beth Paxton) writes:
>Has anyone seen or written an Interleaf (ver. 4.0 - tps) to nroff
>or Interleaf to tex filter?  If so, from where could I retrieve
>it?

This could be **real hard**. If one writes a source->source translator, one
needs to implement the mapping of all the interleaf options and
configurations (or at least all the ones you use (:-)).  This is a long
task, since Tps is a rich, extensible system.  It is well-documented,
though: see below. The result of anything "simple" tends to be an
information-losing translator!
  Writing a printerleaf-to-whatever translator is easier, but I'd want to
make it a .pl -> .dvi translation, since the concepts are roughly the same:
a machine-independent output file for post-filtering. I'd not try .pl to
.tex or .nroff, I suspect you'd learn to hate yourself.


   After all this, I have to admit that I've written tps-to-whatever
filters in awk.  The TPS 4.0 (ascii) file format is well-documented,
and the manual is available.  (The printerleaf format is also
documented, but I think there's a non-disclosure requirement).
   If you're trying to translate a **simple** subset into something equally
simple, its easy.  I may even still have a tps-to-code filter that writes
all paragraphs tagged "<code>" into the last-mentioned value of paragraphs
tagged "<file>".  This thingie was used to extract code from documentation,
so I could keep both the code and its explanation in the same place and
maintain them simultaneously.

  From memory, the lisp hook was
	(resave-file current-object 'ascii)
  and the awk was
	BEGIN	{
		outputFile = "erronious.tps";
		inFile = 0;
	}
	/^<file>/ {
		outputFile = $1;
	}
	/^<code>/ {
		inFile = 1;
		continue;
	}
	/^</ {
		inFile = 0;
		continue;
	}
	/.*/	{
		if (inFile) {
			print $0 >>outputFile;
			continue;
		}
	}
	
--dave (who used to work for Interleaf Canada, and still
	thinks that TPS was the best thing since sliced bread) c-b
-- 
David Collier-Brown,  | davecb@yunexus, ...!yunexus!davecb or
72 Abitibi Ave.,      | {toronto area...}lethe!dave 
Willowdale, Ontario,  | Joyce C-B:
CANADA. 223-8968      |    He's so smart he's dumb.