Literate Wiki

The basic idea behind Literate Wiki is for a wiki page to describe and document a software program as well as to extract the code that is described.

Weave and Tangle

In "classical" Literate Programming systems weaving is the process of producing the documentation, while tangling is for extracting the code.

In a Literate Wiki there is no need for weaving given the wiki provides the medium for documenting and describing the construction of the program.

Tangle

A Literate Wiki needs two special paragraphs:

  • code chunk, and
  • code chunk reference
  • A keyboard shortcut, or a button in the page, could trigger the extraction of the source code from the code chunks.

    A code chunk has 3 attributes: name, language, destination.

    Of the 3 only name is necessary. Language and destination should be included in the first code chunk of a given name.

    Subsequent chunks of code in a page "expand" upon each other and various naming and scoping mechanisms yet to be discovered.

    Example

    chunk 1

    This is a library of functions.

    import helpers

    These are other things.

    def foo(): pass

    helpers

    def f(): pass

    Resources

    There is already a plugin for code chunk. The pretty printer tries to guess what kind of code it is but could also be told. See About Code Plugin

    The reduce plugin reads (and executes) the code in method plugins. Reduce decides what plugins by looking for page names in the same page. That serves as some kind of reference. See About Reduce Plugin

    The reduce plugin does a simple form of tangle to turn method markup into excel spreadsheet. See More About Reduce Plugin

    The PageFold was introduced as a reliable way to create machine-readable structure in an individual wiki page without overloading the hierarchy possible with json. See About PageFold Plugin