Revision 025bfad2a92cf7db9fa8ea15e71a266c0a83ad4b authored by jenshen on 20 April 2016, 22:19:13 UTC, committed by jenshen on 20 April 2016, 22:19:13 UTC
1 parent fcd107c
Raw File
prepare.py
import sys

def apply_rules(s):
    
    s = s.replace('!FEATURE!',  'style="filled"; fillcolor="lightyellow3";')
    
    node='shape=ellipse, style=filled, ' 
    s = s.replace('!NODE:missing!',     node + 'fillcolor=red')
    s = s.replace('!NODE:development!', node + 'fillcolor=pink')
    s = s.replace('!NODE:designed!',    node + 'fillcolor=orange')
    s = s.replace('!NODE:compiled!',    node + 'fillcolor=yellow')
    s = s.replace('!NODE:documented!',  node + 'fillcolor=green')
    s = s.replace('!NODE:tested!',      node + 'fillcolor=white')
    
    s = s.replace('!CONFIG!', 'shape=note, style=filled, fillcolor=grey')
    s = s.replace('!TOPIC!',    'shape=box, style=filled, fillcolor=white')
    
    warn = \
    """
    // DO NOT EDIT THIS FILE. IT IS NOW AUTOGENERATED FROM Duckietown_ROS_Diagram.dot.in
    //
    //
    // Any changes that you do will be erased.
    //
    //
    """

    return warn + s

if __name__ == '__main__':
    s = sys.stdin.read()
    s = apply_rules(s) 
    print(s)
back to top