From 71c9cd22bb11f5da031a0dab4a2314f7828c854c Mon Sep 17 00:00:00 2001 From: Ville Rantanen Date: Fri, 1 Dec 2023 12:24:00 +0200 Subject: [PATCH] dokuwiki fixes --- code/shop.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/shop.py b/code/shop.py index ab1b72a..3c7d84a 100644 --- a/code/shop.py +++ b/code/shop.py @@ -35,7 +35,7 @@ BOLDFINDER = re.compile(r"\*([^\*]+)\*") CODEFINDER = re.compile(r"\`([^\`]+)\`") CHECKBOX_DOKUWIKI_TICKED = re.compile(r"]*)>([^<]+)") CHECKBOX_DOKUWIKI_UNTICKED = re.compile(r"([^<]+)") -SHOPNAME_INVALIDCHARS = re.compile("[^A-Za-z0-9_-]+") +SHOPNAME_INVALIDCHARS = re.compile("[^A-Za-z0-9_]+") # create our little application :) app = Flask(__name__) @@ -121,8 +121,8 @@ def scan_for_new_documents(id): existing.append(row[1]) for row in os.listdir(data_dir): if row.endswith(".txt"): - if row[:-3] not in existing: - non_existing.append(row[:-3]) + if row[:-4] not in existing: + non_existing.append(row[:-4]) for shop in non_existing: g.db.execute("insert into shops (shop,owner) values (?, ?)", [shop, id]) g.db.commit() @@ -147,7 +147,7 @@ def checkbox_add(item): if MARKDOWN_STYLE == "markdown": return f"[ ] {item}" + "\n" if MARKDOWN_STYLE == "dokuwiki": - return f"{item}" + "\n" + return f"- {item}" + "\n" def untick(item): @@ -425,7 +425,7 @@ def add_shop(): import re import string - shopname = SHOPNAME_INVALIDCHARS.sub("", request.form["shop"]) + shopname = SHOPNAME_INVALIDCHARS.sub("", request.form["shop"].lower()) if shopname == "": flash("Shop name empty!")