Created
November 1, 2012 16:16
-
-
Save funrep/3994719 to your computer and use it in GitHub Desktop.
blablabla
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
# -*- coding: utf-8 -*- | |
### config ### | |
title = 'Blah blah blah!' | |
theme = '#000066' | |
font = ('Arial', '14px') | |
colors = ( | |
'#EEEEEE', # Background | |
'#020202', # Foreground | |
'#006699', # Links | |
) | |
### end of config ### | |
import os, sys | |
#def get_content(filename): | |
# content = os.popen('markdown ' filename).read() | |
# return content | |
filename = sys.argv[1] #first argument have to be the filename, otherwise crash | |
content = os.popen('markdown ' + filename).read() # this binds the var content to | |
#the output of the shell command. | |
### html stuff ### | |
css = '''body { | |
background-color: %s; | |
font-family: "%s"; | |
font-size: %s; | |
font-weight: normal; | |
} | |
a:link,a:visited,a:active { | |
text-decoration: none; | |
color: %s; | |
font-weight: normal; | |
}''' % (colors[0], font[0], font[1], colors[2]) | |
html = '''<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>%s</title> | |
<link rel="stylesheet" type="text/css" href="style.css" /> | |
</head> | |
<body> | |
%s | |
</body> | |
</html>''' % (title, content) | |
### end of html ### | |
with open('index.html', 'w') as file: | |
file.write(html) | |
with open('style.css', 'w') as file: | |
file.write(css) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment