4 Fix references to source files of the form [LOCpath]
5 so that they are relative to a given source directory.
7 Substitute the DOT-generated image map into the document.
12 (srcdir
, ) = sys
.argv
[1:]
13 srcdir
= os
.path
.realpath(srcdir
)
15 f
= re
.compile(r
'\[LOC(.*?)\]')
19 file = os
.path
.realpath(file)
20 if not file.startswith(srcdir
):
21 raise Exception("File %s doesn't start with %s" % (file, srcdir
))
23 file = file[len(srcdir
) + 1:]
26 s
= re
.compile(r
'\[MAP(.*?)\]')
33 for line
in sys
.stdin
:
34 line
= f
.sub(replacer
, line
)
35 line
= s
.sub(mapreplace
, line
)
37 sys
.stdout
.write(line
)