Copy style.css file after generation
This commit is contained in:
parent
63ac4663ea
commit
a5e725dbea
14
render
14
render
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import os, argparse, hashlib, sqlite3, time
|
||||
import os, argparse, hashlib, sqlite3, time, shutil
|
||||
|
||||
parser = argparse.ArgumentParser(description='Renders static HTML pages and indexes from an SQLite database of emails and an attachment folder.')
|
||||
|
||||
|
@ -46,23 +46,27 @@ for message_id, sender, recipient, subject, timestamp, textbody, htmlbody, sha1_
|
|||
if textbody != "":
|
||||
available_text = True
|
||||
versions['Plaintext'] = '%s_text.html' % sha1_hash
|
||||
else:
|
||||
available_text = False
|
||||
|
||||
if htmlbody != "":
|
||||
available_html = True
|
||||
versions['HTML'] = '%s_html.html' % sha1_hash
|
||||
else:
|
||||
available_html = False
|
||||
|
||||
version_list = "".join('<a href="%s" class="version">%s</a>' % (value, key) for key, value in versions.viewitems())
|
||||
|
||||
if available_text:
|
||||
if available_text == True:
|
||||
# Text version
|
||||
body = "<pre>%s</pre>" % textbody
|
||||
generated = template_message % {'subject': subject, 'date': timestamp, 'from': sender, 'to': recipient, 'body': body, 'title': options['title'], 'version': "Plaintext version", 'index': "../index.html", 'versions': version_list}
|
||||
open('%s/%s_text.html' % (options['output_dir'], sha1_hash), 'w').write(generated.encode('UTF-8'))
|
||||
|
||||
if available_html:
|
||||
if available_html == True:
|
||||
# HTML version
|
||||
body = htmlbody
|
||||
generated = template_message % {'subject': subject, 'date': timestamp, 'from': sender, 'to': recipient, 'body': body, 'title': options['title'], 'version': "HTML version", 'index': "../index.html", 'versions': version_list}
|
||||
open('%s/%s_html.html' % (options['output_dir'], sha1_hash), 'w').write(generated.encode('UTF-8'))
|
||||
|
||||
exit(1)
|
||||
|
||||
shutil.copy('%s/style.css' % options['template_dir'], '%s/style.css' % options['output_dir'])
|
||||
|
|
Loading…
Reference in a new issue