+import json
+import pathlib
+
import commonmark
import flask
+with open(pathlib.Path(__file__).parent / 'config.json') as f:
+ CONFIGURATION = json.loads(f.read())
+ print(CONFIGURATION)
+
app = flask.Flask(__name__)
@app.route('/')
@app.route('/p/<name>')
def page(name):
for ch in name:
- if not ch in 'abcdefghijklmnopqrstuvwxyz_0123456789':
+ if not ch in 'abcdefghijklmnopqrstuvwxyz-0123456789':
flask.abort(404)
try:
except FileNotFoundError as e:
flask.abort(404)
- title = name.replace('_', ' ').title()
+ title = name.replace('-', ' ').title()
return flask.render_template('page.html', content=content, title=title)