Literate Example

This is an example of a code fragment which uses another fragment. The other fragment is linked and inluded in the generated code unit. (Make the browser window smaller to see how links, backlinks and Back button work.)

Main Program

{{{#!literate name='test' caption='Test block'
  test opening
        «other»
  1.....^
        «other»
  2.....^
}}}

More test

{{{#!literate name='test' caption='Continued ...'
        test part 2
        }}
  test closing
}}}

This is an included code fragment.

{{{#!literate name='other' caption='Other operations'
    other operations
    over 
    and out 
}}}

This is an example of script, as suggested by the name of the fragment looking as a file name.

{{{#!literate name='main.ijs' caption='main script'
  main begins 7
      «test»
  ....^
  main ends
}}}

Aux Module

This is another code module

{{{#!literate name='test.ijs' caption="Other module"
sub begins
  «no caption»
..^
  almost done ...
}}}

which is continued here

  bye
sub ends

This is a dummy block.

    other operations
    over 
    and out 

This is a block without caption.

  no caption operations
  «test»
  ^
  no caption out 

MoinMoin: ParserMarket/LiterateProgramming/Examples (last edited 2008-01-28 14:28:25 by FedericoLorenzi)