From 58670851a042e2f27efcff483c9ee3848ca6f516 Mon Sep 17 00:00:00 2001 From: Wolfgang Nowak Date: Thu, 14 Oct 2021 00:11:27 +0200 Subject: [PATCH] generate html from .md and stdout from other files. New renaming of files. v0.03 --- webgen.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/webgen.py b/webgen.py index 59d8594..fcb1a92 100755 --- a/webgen.py +++ b/webgen.py @@ -2,6 +2,7 @@ import sys, os, re, markdown, datetime + # Getoptions try: parameters = sys.argv[1] @@ -46,35 +47,37 @@ head1 = ( \n\ \n" -body1 = 'Go Back' +style_fn = '' + +head2 = "\n" +body1 = 'Back' foot = " " -html_out_file.write(head1 + styles + head2 + body1) +html_out_file.write(head1 + style_fn + head2 + body1) -with open(mark_down_file) as infile: - for line in infile: - a = markdown.markdown(line) - html_out_file.write(a) +with open(mark_down_file, "r", encoding="utf-8") as infile: + md_data = infile.read() + html_output = markdown.markdown(md_data) + html_out_file.write(html_output) html_out_file.write(foot) # return new filename to stdout, so some calling shellscript can use it.