aboutsummaryrefslogtreecommitdiff
path: root/wiki.py
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2024-03-23 21:10:35 +0000
committerJuan J. Martinez <jjm@usebox.net>2024-03-23 21:10:35 +0000
commit4b397b071cce938cefad75d7b56b813bbe7e1c26 (patch)
treee748f1f1c492b6dae5049288d75abc70af02bd1f /wiki.py
parent31683ac7edb636c970f236148b10858b8da14392 (diff)
downloadpersonal-wiki-pybottle-4b397b071cce938cefad75d7b56b813bbe7e1c26.tar.gz
personal-wiki-pybottle-4b397b071cce938cefad75d7b56b813bbe7e1c26.zip
Filter for PascalCase words
Diffstat (limited to 'wiki.py')
-rw-r--r--wiki.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/wiki.py b/wiki.py
index 2c4eef9..6c1cf04 100644
--- a/wiki.py
+++ b/wiki.py
@@ -30,22 +30,26 @@ if DEV:
return static_file(filename, root="static/")
+# check two words pascal case
+app.router.add_filter('pc', lambda conf: (r'[A-Z][a-z]+[A-Z][a-z]*', None, None))
+
+
@app.route("/")
def index():
redirect("/WikiHome")
-@app.route("/<name>")
+@app.route("/<name:pc>")
def page(db, name):
return template("page", dict(page=model.get_page(db, name)))
-@app.get("/edit/<name>")
+@app.get("/edit/<name:pc>")
def edit(db, name):
return template("edit", dict(page=model.get_page(db, name)))
-@app.get("/history/<name>")
+@app.get("/history/<name:pc>")
def history(db, name):
return template(
"history",
@@ -56,7 +60,7 @@ def history(db, name):
)
-@app.get("/history/<name>/<version>")
+@app.get("/history/<name:pc>/<version>")
def history_view(db, name, version):
return template(
"page",
@@ -66,7 +70,7 @@ def history_view(db, name, version):
)
-@app.post("/edit/<name>")
+@app.post("/edit/<name:pc>")
def edit_save(db, name):
page = model.get_page(db, name)