Merge branch 'configuration'

This commit is contained in:
Peter 2016-05-04 17:17:32 +02:00
commit 4efd1a11c8
6 changed files with 51 additions and 16 deletions

View File

@ -5,7 +5,6 @@ import subprocess
import shlex
app = Flask(__name__, static_url_path='')
command = shlex.split('/usr/bin/pandoc -f markdown+footnotes+inline_notes+auto_identifiers -t html5 --smart --email-obfuscation=references')
@app.route("/")
def index():
@ -16,9 +15,12 @@ def parse():
if request.method == 'GET':
return redirect(url_for('index'))
data = request.form['markdown']
proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True)
proc = subprocess.Popen(app.config['COMMAND'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True)
return proc.communicate(input=data)
if __name__ == "__main__":
app.debug = False
app.run()
app.config['HOST'] = 'localhost'
app.config['PORT'] = 5000
app.config.from_object('mdlive.default_configuration')
app.config['COMMAND'] = shlex.split(app.config['PARSER'])
app.run(host=app.config['HOST'], port=app.config['PORT'])

0
mdlive/__init__.py Normal file
View File

View File

@ -0,0 +1,5 @@
PARSER = '/usr/bin/pandoc -f markdown+footnotes+inline_notes+auto_identifiers -t html5 --smart --email-obfuscation=references'
HOST = '127.0.0.1'
PORT = 5000
DEBUG = True
CSS = 'blog.css'

28
static/blog.css Normal file
View File

@ -0,0 +1,28 @@
@import url('https://ludikovsky.name/fonts/fonts.css');
article > footer {
text-align: right;
color: #777;
font-variant: small-caps;
font-size: 11pt;
}
article > div {
font-size: 14pt;
font-family: 'DejaVu Serif', sans-serif
}
blockquote {
border-left-color: #777;
}
code {
font-family: 'Hack', monospace;
}
body {
text-rendering: optimizeLegibility;
font-variant-ligatures: common-ligatures;
font-kerning: normal;
font-family: 'DejaVu Sans', sans-serif;
}

View File

@ -6,18 +6,8 @@
<script src="https://cdn.jsdelivr.net/jquery/2.2.3/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/font-hack/2.018/css/hack.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css" type="text/css" media="screen">
<link rel="stylesheet" href="https://ludikovsky.name/blog/blog.css" type="text/css" media="screen">
<style>
textarea {
width: 100%;
height: 800px;
font-family: Hack, monospace;
}
div.container {
height: 800px;
overflow-y: scroll;
}
</style>
<link rel="stylesheet" href="mdlive.css" type="text/css">
<link rel="stylesheet" href="blog.css" type="text/css" media="screen">
</head>
<body>
<div class="col-md-2"></div>

10
static/mdlive.css Normal file
View File

@ -0,0 +1,10 @@
textarea#markdown {
width: 100%;
height: 800px;
font-family: Hack, monospace;
}
div.container > #output {
height: 800px;
overflow-y: scroll;
}