6 BASE_PATH
= os
.path
.dirname(os
.path
.abspath(__file__
))
7 HTML_TEMPLATE_NAME
= "d3-graphviz-template.html"
8 HTML_TEMPLATE_PATH
= os
.path
.join(BASE_PATH
, HTML_TEMPLATE_NAME
)
12 parser
= argparse
.ArgumentParser()
16 type=argparse
.FileType("r"),
18 help="Input .dot file, reads from stdin if not set",
23 type=argparse
.FileType("w"),
25 help="Output .html file, writes to stdout if not set",
27 args
= parser
.parse_args()
29 template
= open(HTML_TEMPLATE_PATH
, "r")
32 if "<INSERT_DOT>" in line
:
33 print(args
.dotfile
.read(), file=args
.htmlfile
, end
="")
35 print(line
, file=args
.htmlfile
, end
="")
38 if __name__
== "__main__":