Programming - - By Harry Fuecks

ASCII diagrams to image

In:


    +---------+         +---------+     +---------+
    |  Shape  |         |  Line   |     |  Point  |
    +---------+         +---------+   2 +---------+
    | draw    +<--------+ start   +----O+ x       |
    | move    +<-+      | end     |     | y       |
    +---------+        +---------+     +---------+
                                     
                       +---------+
                     +--+ Circle  |
                        +---------+
                        | center  |
                        | radius  |
                        +---------+

Out:

UML from ASCII

Seems this is a to-be-released feature of docutils (Python) called aafigure – source available here – also see the README before and after. To install you’d need Python + PIL – after that download the various .py files from here and run aafigure.py --help from the command line. Able to generate svg, png or jpg.

Very cool. It’s not yet quite so clever to handle any old diagram from JavE, which doesn’t necessarily produce clean lines (depends on the drawing tools you used) and Iñtërnâtiônàlizætiøn is problem but this would be very handy for wikis and similar. Just needs porting to PHP…