Fix sample bootstrap senfutil.py (Examples/Sniffer/site_scons/senfutil.py)
[senf.git] / site_scons / lib / dot-munge.pl
1 #!/usr/bin/perl -i -n
2
3 # Reduce fontsize and change font
4 s/fontsize=10/fontsize=8/g;
5 s/fontname="FreeSans.ttf"/fontname="Verdana"/g;
6
7 # Wrap long labels (templates and pathnames)
8 if (/label=\"([^"]{24,})\"/) {                              #"])){ # To make emacs happy ...
9     $pre=$`;
10     $post=$';                                               #';    # To make emacs happy ...
11     $label=$1;
12
13     # Break at each komma or /
14     $label=~s{[,/]}{$&\\r\\ \\ \\ \\ \\ \\ \\ \\ }g;
15
16     # If more than one '<' is in the label, break after each '<'
17     if (($label=~tr/</</)>1) {
18         $label=~s/</<\\r\\ \\ \\ \\ \\ \\ \\ \\ /g;
19     }
20
21     # If at least one break is in there ...
22     if ($label=~/\\r/) {
23     # If it's a pathname, make all but the last line flush left
24     # Otherwise only make first line flush left
25     if ($label=~m{/}) {
26         $label=~s/\\r(\\ )*/\\ \\ \\ \\ \\ \\ \\ \\ \\l/g;
27         # Re-add blanks before last line
28         $label=~s/^.*\\l/$&\\ \\ \\ \\ \\ \\ \\ \\ /;
29     } else {
30         $label=~s/\\r/\\ \\ \\ \\ \\ \\ \\ \\ \\l/;
31     }
32         # Make last line flush right
33         $label.="\\r";
34     }
35     print "${pre}label=\"${label}\"${post}";
36 } else {
37     print;
38 }