26 lines
614 B
Python
26 lines
614 B
Python
from flask import Flask, render_template, Markup, redirect
|
|
import markdown2
|
|
import os
|
|
|
|
app = Flask(__name__)
|
|
|
|
templates = [x for x in os.listdir("data") if x not in ["index.md"]]
|
|
print(templates)
|
|
@app.route("/")
|
|
def main():
|
|
return render_template("index.html", content=Markup(markdown2.markdown_path("data/index.md")), extras=["cuddled-lists"])
|
|
|
|
|
|
@app.route("/<md>/")
|
|
def render(md):
|
|
return render_template("index.html", content=Markup(markdown2.markdown_path(f"data/{md}.md")))
|
|
|
|
|
|
@app.route("/<md>")
|
|
def redir(md):
|
|
return redirect(f"/{md}/",)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app.run("0.0.0.0", 8080)
|