Python

I found some Information about Text-Processing in Python here:

http://www.computer-books.us/python_0006.php

They offer some sample-chapters - oh no - the whole book is free of charge, as it looks.

About 8 years ago I did sort of the opposite.We wanted a way to keep documentation, specifications, and code aligned so I dreamed up a method of using Word as a (semi-)literate editor with different (defined by me) styles for each kind of thing.
Of course, then I had to write code to extract out the various headers, code segments, build instructions , etc. which had to feed to the many existing compilers, linkers, and such.
I made them keep the code in RTF so I could *just* write an ASCII parser for it.

Right.
Every version of Word and many different combinations of operating systems kept me constantly updating the parser.The RTF “rules” (all three versions I downloaded from Microsoft) do NOT contain all the different possibilities that Word expects/generates nor do they explain just how you need to order various pieces.We resolved most of our issues by smacking the knuckles of anyone who tried a “new” way of formatting and by making them responsible for proper code extraction (although they did a lot of whining at me).
If you have simple boilerplate requirements, try making a simple file with one example of each formatting kind and then dumping the RTF.

You will then see…..
(I used a package for parsing RTF which I HIGHLY recommend

http://www.dubois.ws/software/RTF that happens to have the RTF spec with it).