diff --git a/webgen.py b/webgen.py index 7688d31..a6bfc97 100755 --- a/webgen.py +++ b/webgen.py @@ -3,7 +3,7 @@ import sys, os, re, markdown, datetime try: - mark_down_file = sys.argv[1] + parameters = sys.argv[1] except: sys.exit( sys.argv[0] @@ -11,11 +11,24 @@ except: ) +if parameters== "--html": + fileending=".html" + try: + mark_down_file = sys.argv[2] + except: + sys.exit( + sys.argv[0] + + ": Bitte eine Text oder Markdowndatei angeben.\ Dieses Tool wandelt eine entsprechende Datei in eine einfache Webseite" + ) +else: + fileending="" + + # creationtime = datetime.datetime.now().strftime("%Y-%m-%d %H ") creationtime = datetime.datetime.now().strftime("%Y-%m-%d %H:%M") if re.match(".*\.md$", mark_down_file): - new_file_name = creationtime + " " + re.sub(".md$", ".html", mark_down_file) + new_file_name = creationtime + " " + re.sub(".md$", fileending, mark_down_file) html_out_file = open(new_file_name, "w") title_of_text = re.sub(".md$", "", mark_down_file) else: