feel free to email me at

tangle.py - simple literate programming

It's a simple python script of 50 lines for literate programming in any language.

It supports "true" literate programming in a sense that order of your writing is not restricted to order of code (unlike POD or Haskell lhs).

More to say you can output to several files from one literate source.

Syntax is very simple and line oriented.

Version: 2012-02-26 (git:4f33639c)
Download: tangle.py (0.5k Python script)
Github:   http://github.com/ITikhonov/tangle
Usage:    python tangle.py

Example:


Starting macro "foo" by prefixing with "="

=foo

Now writing silly sentence into it by prepending line with "-"

-The quick brown fox jumps over the lazy dog

Another line

-ETAOIN SHRDLU

Creating file "bar.txt" by using macro name starting with ">"

=>bar.txt

This nonsense goes directly into bar.txt

-Portez ce vieux whisky au juge blond qui fume

And after that we insert some foo

>foo

Another foo, but now with intendation:

>    foo

Now adding line to foo. It will end up in a bar.txt too, because
macros expanded at the end of processing not when they are inserted.

=foo
-Lorem ipsum dolor sit amet

Also put foo once into foo.txt

=>foo.txt
>foo

Resulting bar.txt

Portez ce vieux whisky au juge blond qui fume
The quick brown fox jumps over the lazy dog
ETAOIN SHRDLU
Lorem ipsum dolor sit amet
    The quick brown fox jumps over the lazy dog
    ETAOIN SHRDLU
    Lorem ipsum dolor sit amet

And foo.txt

The quick brown fox jumps over the lazy dog
ETAOIN SHRDLU
Lorem ipsum dolor sit amet