Files
galaxy/scripts/slideshow/build_slideshow.py
T
Nicola Soranzo d1bc98dfcb Python3: fix remaining print statements
Remove some debugging prints.
Fix import order.
Consolidate exception logging in ToolShed database migrations.
2017-10-12 18:34:29 +01:00

31 lines
693 B
Python

from __future__ import print_function
import os
import string
import sys
SCRIPTS_DIRECTORY = os.path.dirname(__file__)
TEMPLATE_PATH = os.path.join(SCRIPTS_DIRECTORY, "slideshow_template.html")
TEMPLATE = string.Template(open(TEMPLATE_PATH, "r").read())
def main(argv=None):
if argv is None:
argv = sys.argv
title = argv[1]
markdown_source = argv[2]
output = os.path.splitext(markdown_source)[0] + '.html'
with open(markdown_source, "r") as s:
content = s.read()
html = TEMPLATE.safe_substitute(**{
'title': title,
'content': content,
})
print(html)
open(output, "w").write(html)
if __name__ == "__main__":
main()