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 import sys, os, re, markdown, datetime
# Getoptions # Getoptions
try: try:
parameters = sys.argv[1] 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="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">\n\
<meta name="ctime" content="' <meta name="ctime" content="'
+ creationtimeheader + creationtimeheader
+ '"> <style type="text/css"> ' + '"> '
) )
styles = " <!--\n\ styles = " <!--\n\
* { font-family: monospace; color: #00f020; background-color: #1c1414; font-size: 1.15em; }\n\ * { font-family: monospace; color: #00f020; background-color: #1c1414; font-size: 1.15em; }\n\
a { font-size: 1.0em;}\n\ a { font-size: 1.0em;}\n\
ul { font-size: 1.0em;}\n\ ul { font-size: 1.15em;}\n\
p { font-size: 1.0em;}\n\ p { font-size: 1.15em;}\n\
li { font-size: 1.0em;}\n\ li { font-size: 1.15em;}\n\
ol { font-size: 1.0em;}\n\ ol { font-size: 1.0em;}\n\
em { font-size: 1.0em;}\n\ em { font-size: 1.0em;}\n\
table { background-color: #1c1414; }\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\ 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\ pre { white-space: pre-wrap; font-family: monospace; color: #00f020; font-background-color: #1c1414; }\n\
.Statement { color: #00f020; font-weight: bold; }\n\ .Statement { color: #00f020; font-weight: bold; }\n\
.Headandfoot { color: #00f020; font-weight: bold; } " .Headandfoot { color: #00f020; font-weight: bold; } "
head2 = "</style> </head><body>\n" style_fn = '<link rel="stylesheet" type="text/css" href="/vimstyles.css">'
body1 = '<a href="./">Go Back</a>'
head2 = "</head><body>\n"
body1 = '<a href="./">Back</a>'
foot = "</body> </html>" 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: with open(mark_down_file, "r", encoding="utf-8") as infile:
for line in infile: md_data = infile.read()
a = markdown.markdown(line) html_output = markdown.markdown(md_data)
html_out_file.write(a) html_out_file.write(html_output)
html_out_file.write(foot) html_out_file.write(foot)
# return new filename to stdout, so some calling shellscript can use it. # return new filename to stdout, so some calling shellscript can use it.