Remove redundant step numbers from recipe instructions in UI and database

This commit is contained in:
2026-10-17 17:08:07 +02:00
parent b86cbbeaa0
commit 814fd54d75
7 changed files with 129 additions and 2 deletions
+8
View File
@@ -130,6 +130,14 @@ async def auth_middleware(request: Request, call_next):
app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static")
templates = Jinja2Templates(directory=TEMPLATES_DIR)
def strip_step_number_filter(text: str) -> str:
if not text:
return ""
import re
return re.sub(r'^(?:Schritt\s*\d+[:.]?|\d+[\.\)\:])\s*', '', str(text).strip(), flags=re.IGNORECASE)
templates.env.filters["strip_step_number"] = strip_step_number_filter
# Mapping Kochbuch-Kapitel -> Zufallsgenerator-Kategorien
CHAPTER_TO_DISH_CAT = {
"Suppen & Eintöpfe": "Suppen",