generate html from .md and stdout from other files. New renaming of files. v0.03

This commit is contained in:
Wolfgang Nowak 2021-10-14 00:11:27 +02:00
parent a944f92a14
commit 58670851a0

View file

@ -2,6 +2,7 @@
import sys, os, re, markdown, datetime
# Getoptions
try:
parameters = sys.argv[1]
@ -46,35 +47,37 @@ head1 = (
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">\n\
<meta name="ctime" content="'
+ creationtimeheader
+ '"> <style type="text/css"> '
+ '"> '
)
styles = " <!--\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\
p { font-size: 1.0em;}\n\
li { font-size: 1.0em;}\n\
ul { font-size: 1.15em;}\n\
p { font-size: 1.15em;}\n\
li { font-size: 1.15em;}\n\
ol { font-size: 1.0em;}\n\
em { font-size: 1.0em;}\n\
table { background-color: #1c1414; }\n\
blockquote { font-size: 1.0em; }\n\
blockquote { font-size: 1.15em; }\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\
.Headandfoot { color: #00f020; font-weight: bold; } "
head2 = "</style> </head><body>\n"
body1 = '<a href="./">Go Back</a>'
style_fn = '<link rel="stylesheet" type="text/css" href="/vimstyles.css">'
head2 = "</head><body>\n"
body1 = '<a href="./">Back</a>'
foot = "</body> </html>"
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.