Much of the information I track has a hierarchical form.
These web pages are an example. On the left of the screen you see a tree of titles and brief descriptions organized in a hierarchy. If you click on one of those "branches" you will see more information about that branch on the right.
Sometimes I want to edit the information before I format it as a hierarchy. I do that by editing a regular text file and then running it through a filter to convert it. I've included some of the filters I use here.
I have a standard format for these input text files:
- The level in the hierarchy is represented by how far the current line is indented. No indentation means a top-level node, one indentation (usually a tab character) means a second level node, and so on.
- I use this convention to attach notes to a particular node. If a line consists of only a single dash it is assumed to start a note. The note continues to the next occurrence of a single dash and is attached to the immediately preceding node.
- It is fairly easy to break these filters with input that is invalidly formatted as they don't do a lot of error checking.
- There is currently no way to put a line with a single dash inside a note or a node line.
- All node information is contained on one line. If there are two consecutive non-dash lines they are treated as two nodes.