Added some badly needed css and added printing new filename. v0.05
This commit is contained in:
parent
881011d057
commit
7326edf2a8
1 changed files with 18 additions and 11 deletions
29
webgen.py
29
webgen.py
|
@ -27,10 +27,10 @@ else:
|
|||
mark_down_file = parameters
|
||||
|
||||
creationtime = datetime.datetime.now().strftime("%Y-%m-%d %H:00 ")
|
||||
# creationtime = datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
|
||||
creationtimeheader = datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
|
||||
|
||||
if re.match(".*\.md$", mark_down_file):
|
||||
new_file_name = creationtime + " " + re.sub(".md$", fileending, 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:
|
||||
|
@ -38,25 +38,31 @@ else:
|
|||
title_of_text = mark_down_file
|
||||
|
||||
head1 = (
|
||||
'<!DOCTYPE HTML>\n\<html>\n\<head>\n\
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">\n\<title>'
|
||||
'<!DOCTYPE HTML><html><head>\n\
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">\n<title>'
|
||||
+ title_of_text
|
||||
+ '</title>\n\
|
||||
<meta name="syntax" content="markdown">\n\
|
||||
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">\n\
|
||||
<meta name="ctime" content="'
|
||||
+ creationtime
|
||||
+ '">\n\ <style type="text/css"> '
|
||||
+ creationtimeheader
|
||||
+ '"> <style type="text/css"> '
|
||||
)
|
||||
|
||||
styles = " <!--\n\
|
||||
* { font-family: monospace; color: #00f020; background-color: #1c1414; font-size: 1.15em;}\n\
|
||||
body { font-family: monospace; }\n\
|
||||
pre { white-space: pre-wrap; font-family: monospace; color: #00f020; background-color: #1c1414; }\n\
|
||||
* { font-family: monospace; color: #00f020; background-color: #1c1414; font-size: 1.15em; }\n\
|
||||
a { font-size: 1.0em;}\n\
|
||||
ul { font-size: 1.0em;}\n\
|
||||
em { font-size: 1.0em;}\n\
|
||||
table { background-color: #1c1414; }\n\
|
||||
blockquote { font-size: 1.0em; }\n\
|
||||
body { font-family: monospace; color: #00f020; background-color: #1c1414; }\n\
|
||||
pre { white-space: pre-wrap; font-family: monospace; color: #00f020; font-background-color: #1c1414; }\n\
|
||||
.Statement { color: #00f020; font-weight: bold; }\n\
|
||||
-->\n"
|
||||
.Headandfoot { color: #00f020; font-weight: bold; } "
|
||||
|
||||
head2 = "</style> </head><body>\n"
|
||||
body1 = '<a href="#" onclick="history.go(-1)">Go Back</a>'
|
||||
body1 = '<a href="./">Go Back</a>'
|
||||
foot = "</body> </html>"
|
||||
|
||||
|
||||
|
@ -68,4 +74,5 @@ with open(mark_down_file) as infile:
|
|||
html_out_file.write(a)
|
||||
html_out_file.write(foot)
|
||||
|
||||
# return new filename to stdout, so some calling shellscript can use it.
|
||||
print(new_file_name)
|
||||
|
|
Loading…
Reference in a new issue