Section 30 Literate Programming
There is support for literate programming using the
<fragment> tag. It should always contain an @@xml:id or a @@filename attribute, and may contain <code> segments as well as <fragref> segments referencing other fragments. The final code is to be assembled starting from a fragment with a filename attribute and traversing the tree of fragment references.
For example here is the gcd algorithm in Python. Note that indentation is hard to get right at the moment.
ใ1 The GCD algorithmใ โก
Root of file: gcd.pydef gcd(a, b):
while(b):
ใThe key loop part 2ใ
return a
The key part is the inner part of the loop
This double assignment changes both a and b.

