From: sriram@glock.tcs.com (Sriram Srinivasah) Newsgroups: comp.programming.literate Subject: Literate programming in Framemaker. Date: 25 Oct 1993 21:31:51 GMT Organization: Teknekron Communications, Inc Distribution: world I like the concept of LP (or what I understand of it). My understanding is - - Source and documentation is all present in one document - The same document can be compiled, either for execution by a machine, or for publication. - The tools that implement LP provide a framework to achieve the above, and macros to format the stuff effectively. Unfortunately, all the examples that I have seen seem to use Tex as a base. I use FrameMaker for all my documents, and using Tex is simply too much effort devoted to formatting, IMHO. In the current set of tools, one requires a lot of "inband signalling" . That is, one has to have special symbols within the document that tag a certain paragraph as a piece of code, or as a part of the body, etc. The resulting document looks really messy, and it's painful to eyeball the document quickly. I can achieve the same using FrameMaker or most other word processing tools, which allow you to tag paragraph types. So, I can have a paragraph template called "Code", that identifies the Code sections. Now, I can intermix graphics, tables, all kinds of formatting like automatic line numbering, cross-referencing, indexes etc. What I see on the screen is the final output, uncluttered by meta-information. Separating the code from the chaff is very easy, once a Frame file is converted to a MIF file (an awk script is given below) THE $(10^6) question: IS THIS IDEA WORTH EXPLORING FURTHER? I'd dearly like your comments on this subject. I am absolutely new to LP, and haven't read much beyond the FAQ, and some examples. I would think this can be achieved in say, Word for windows etc. which can save to an RTF format. For those with access to framemaker, this is what I propose: 1. Have a paragraph tag called 'Code', and write all your code in this format. 2. Save as a mif file (or use fmbatch). 3. Run this thru the following awk script BEGIN { code = 0 } /<PgfTag \`Code\'/ { code = 1 next } /<PgfTag/ { code = 0 next } (code == 1) && /^ *<String \`/{ # Ignore all other paragraph formats, and get only strings from # Code formats. # Need to strip this, for example .. # <String `printf (\xd2 Hello World\\n\xd3);'> # Strip junk in front sub(/^[ ]*<String `/,"") # Trailing junk sub(/'>$/,"") # Convert smart quotes to standard quotes sub(/\\xd2/,"\"") sub(/\\xd3/,"\"") print next } 4. If you want pieces of code to go to different files, one can always have a special paragraph type ("File") that identifies a specific file type. -Sriram Srinivasan (sriram@tcs.com)