1 """
2 MoinDot - WebDot/MoinMoin collaboration macro
3
4 Copyright (c) 2002 by Deepfile, Inc. <pj@deepfile.com>
5 Released into the public domain
6
7 Usage: {{{#!moindot someuniquekey
8 ...
9 }}}
10 Omitting someuniquekey is permitted, but WILL cause problems if you put two graphs on one page,
11 and MAY cause problems if you have two graphs on the site even if on different pages
12
13 """
14
15 import string, sys
16
17 def process(request, formatter, lines):
18 webdoturl = "http://webdot.graph.viz/cgi-bin/webdot/"
19 localdir = "/var/www/html/webdot/"
20 localurl = "http://localhost/webdot/"
21
22
23 args=string.split(lines[0])
24 if len(args) > 1:
25 dotfilename = "moindot-%s.dot" % args[1]
26 else:
27 dotfilename = "moindot.dot"
28
29
30 dotfile = file(localdir+dotfilename,'w')
31
32
33
34 del lines[0]
35
36 for line in lines:
37 dotfile.write(line)
38 dotfile.write("\n")
39 dotfile.close()
40
41 dotjpgurl = "%s%s%s.dot.jpg" % (webdoturl, localurl, dotfilename)
42
43 sys.stdout.write("<IMG SRC=\""+dotjpgurl+"\">")
MoinMoin: moindotProcessor (last edited 2007-10-29 19:21:15 by localhost)