5.4. Scripting

5.4. Scripting

Traditional literate programming tools have two conceptual processes: weaving (a document) and tangling (a code file) which separate out interleaved document and code sections.

Interscript has a third kind of section, the script section. In case you're wondering what script sections look like, well, you've already used them. All those lines starting with @ are just executable python script. They aren't really special magical commands, just function calls to predefined python functions.

You can write any python script you like in a script section. Like this:

  @name = 'John Skaller'
  @print 'Hello',name
  @print 'Running Python',sys.version
Notice you don't have to import sys: it is already imported, because it is used in Interscript.

You should be careful with this feature. It is immensely powerful! You can use it to test programs, and to extend Interscript for you needs in a particular document -- without changing the actual source code for Interscript. See http://www.python.org to find out more about python.
5.4.1. Long script sections
5.4.2. Very Long script sections
5.4.3. Unit tests