]'
try:
opts, args = getopt.getopt(argv,"o:",["ofolder="])
except getopt.GetoptError:
print (cmd)
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print (cmd)
sys.exit()
elif opt in ("-o", "--ofolder"):
htmlfolder = arg
html_path = htmlfolder + "examples/"
html_tmppath = htmlfolder + "examples/tmp/"
html_in = html_path + "examples/index.html"
html_tmp = html_tmppath + "index.html"
references = pickle.load(open( "references.p", "rb" ))
Path(html_tmppath).mkdir(parents=True, exist_ok=True)
codeblock = 0
codeblock_end = 0
with open(html_in, 'r') as fin:
with open(html_tmp, 'w') as fout:
for line in fin:
if not codeblock:
fout.write(line)
if re.match('.*.*',line):
codeblock = 1
continue
writeCodeBlock(fout,line, references)
# check if codeblock ended
if re.match('.*
.*',line):
codeblock = 0
shutil.copyfile(html_tmp, html_in)
shutil.rmtree(html_tmppath)
if __name__ == "__main__":
main(sys.argv[1:])