From c16305b50186dae520a2cf08912d9446cc917763 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Sat, 10 Jan 2015 02:34:42 +0100 Subject: reproducible: common.py: make possible to do not write the very last footer in write_html_page() --- bin/reproducible_common.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index 868466a5..d2ab8047 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -171,7 +171,7 @@ html_foot_page = Template((tab*2).join(""" url2html = re.compile(r'((mailto\:|((ht|f)tps?)\://|file\:///){1}\S+)') -def write_html_page(title, body, destfile, noheader=False, nofooter=False): +def write_html_page(title, body, destfile, noheader=False, nofooter=False, noendpage=False): now = datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M UTC') html = '' html += html_header.substitute(page_title=title) @@ -186,7 +186,10 @@ def write_html_page(title, body, destfile, noheader=False, nofooter=False): html += body if not nofooter: html += html_foot_page.substitute() - html += html_footer.substitute(date=now) + if not noendpage: + html += html_footer.substitute(date=now) + else: + html += '\n' os.makedirs(destfile.rsplit('/', 1)[0], exist_ok=True) with open(destfile, 'w') as fd: fd.write(html) -- cgit v1.2.3-70-g09d2