Leo (text editor)
|Developer(s)||Edward K. Ream|
|Stable release||4.11 final / November 6, 2013|
|Type||Text editor, Outliner, IDE|
Leo is written in Python. The GUI currently makes use of the Qt toolkit; until version 4.7, there was an older GUI based on Tk. Outlines can contain Python scripts, while Leo itself can be extended with plugins (also written in Python). Leo's documents are XML files.
Trees, clones and views
Leo is an outliner. Leo's outline pane shows a tree (data structure) of data nodes. Nodes contain headlines, body text, and other information. Headlines naturally serve as descriptions of the body text. For example, @file nodes are nodes whose headline starts with @file. Leo trees are in fact directed acyclic graphs; nodes may have more than one parent. Leo calls such nodes clones. Clones appear in several places in the outline pane. Views are simply nodes whose children contain clones. A single outline may contain arbitrarily many views of the nodes contained therein.
@file nodes represent external files, files on the computer's file system other than the outline file. When saving an outline Leo automatically writes all changed @file trees back to the external files. Comments, called sentinel lines, in external files represent the outline structure. When Leo reads an outline, these comments allow Leo to recreate @file trees using only the data in the external file. @auto nodes represent external files without using sentinel comments. When reading @auto nodes, Leo uses the program structure of the external file to create the @auto tree.
The body text of any node may contain a Leo script, a Python script executed in the context of a Leo outline. A simple API gives Leo scripts full access to all data in loaded outlines, as well as full access to Leo's own source code. The API includes Python iterators that allow scripts to traverse outlines easily. Scripts may be composed of any tree of nodes. A markup language similar to noweb tells Leo how to create scripts from (parts of) an outline. Headlines naturally control and guide scripts. Examples are:
- @test nodes create unit tests. Leo executes the body of an @test node as unit test, without the body having to create an explicit subclass of Python's UnitTest.TestCase class.
- @button nodes create user-defined commands. Leo executes the script of an @button node in the context of any other outline node.
- Leo's Sourceforge project page
- Leo's official site
- "Literate Programming and Leo". Slashdot. 2002-08-28.
- James Tauber (2004-05-15). "Using the Leo Outliner as a PIM".
- Vreda Pieterse, Derrick G. Kourie, Andrew Boake. "A case for contemporary literate programming". In ACM. ACM International Conference Proceeding Series; Vol. 75. Proceedings of the 2004 annual research conference of the South African institute of computer scientists and information technologists on IT research in developing countries. pp. 2–9. (cited in references)