Leo (text editor)
Encyclopedia
Leo is a text editor
Text editor
A text editor is a type of program used for editing plain text files.Text editors are often provided with operating systems or software development packages, and can be used to change configuration files and programming language source code....


that features outlines
Outliner
An outliner is a computer program that allows text to be organized into discrete sections that are related in a tree structure or hierarchy. Text may be collapsed into a node, or expanded and edited....

 with clones as its central tool of
organization, navigation, customization and scripting.

Language

Leo is written in Python
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

 and use the Qt
Qt (toolkit)
Qt is a cross-platform application framework that is widely used for developing application software with a graphical user interface , and also used for developing non-GUI programs such as command-line tools and consoles for servers...

 Gui toolkit. (Tk was the primary toolkit until v4.7, and is now no longer supported.) It is fully scriptable
using Python and can be extended with plugins.
In Leo, outlines are hierarchical data structures that people use to work with
and manage text files—including code.

Trees, clones and views

Leo is an outliner
Outliner
An outliner is a computer program that allows text to be organized into discrete sections that are related in a tree structure or hierarchy. Text may be collapsed into a node, or expanded and edited....

. Leo's outline pane shows a tree (data structure)
Tree (data structure)
In computer science, a tree is a widely-used data structure that emulates a hierarchical tree structure with a set of linked nodes.Mathematically, it is an ordered directed tree, more specifically an arborescence: an acyclic connected graph where each node has zero or more children nodes and at...

 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
Directed acyclic graph
In mathematics and computer science, a directed acyclic graph , is a directed graph with no directed cycles. That is, it is formed by a collection of vertices and directed edges, each edge connecting one vertex to another, such that there is no way to start at some vertex v and follow a sequence of...

;
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.

External files

@file nodes represent external files, files on the computer's file system.
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.

Scripting

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
Markup language
A markup language is a modern system for annotating a text in a way that is syntactically distinguishable from that text. The idea and terminology evolved from the "marking up" of manuscripts, i.e. the revision instructions by editors, traditionally written with a blue pencil on authors' manuscripts...

 similar to noweb
Noweb
noweb is a literate programming tool, created in 1989–1999 by Norman Ramsey, and designed to be simple, easily extensible and language independent....

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.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK