I want to convert tree written in
.org file to some XML code to generate graphic tree from it later (for example loading it to www.draw.io webpage).
In order to do this I need a bash script which will convert
.org file containing:
* tree_root ** root_node_1 *** subnode ** root_node_2
.xml file containing:
<mxCell id="b1" value="tree_root" > </mxCell> <mxCell id="b2" value="root_node_1" ></mxCell> <mxCell id="a1" source="b2" target="b1"> <mxCell id="b3" value="subnode" ></mxCell> <mxCell id="a2" source="b3" target="b2"> <mxCell id="b4" value="root_node_2" ></mxCell> <mxCell id="a3" source="b4" target="b1">
In org mode headings are indicated by asterisks (
* - first level heading,
** - second level heading, etc.)
- Fields called
idare names displayed in the boxes.
- b1, b2, b3 stand for "box", names enumerated by line number in
- a1, a2, a3 stand for "arrow" are the names enumerated by subsequent natural numbers,
idwhere arrow starts,
idwhere the arrows points to.
I need some simple case, e.g. 6 levels deep max. I will extend it myself, but I need something to start with.
How to do this?