diff --git a/src/main.py b/src/main.py index 052ca375..12ead67b 100644 --- a/src/main.py +++ b/src/main.py @@ -1,5 +1,5 @@ # Standard Packages -import sys, json, yaml, os +import sys, json, yaml import time from typing import Optional from pathlib import Path @@ -38,12 +38,14 @@ web_directory = this_directory / 'interface/web/' app.mount("/static", StaticFiles(directory=web_directory), name="static") templates = Jinja2Templates(directory=web_directory) + +# Controllers @app.get("/", response_class=FileResponse) def index(): return FileResponse(web_directory / "index.html") @app.get('/config', response_class=HTMLResponse) -def ui(request: Request): +def config(request: Request): return templates.TemplateResponse("config.html", context={'request': request}) @app.get('/config/data', response_model=FullConfig) diff --git a/src/processor/org_mode/orgnode.py b/src/processor/org_mode/orgnode.py index 7aeb0e9e..fcf5d806 100644 --- a/src/processor/org_mode/orgnode.py +++ b/src/processor/org_mode/orgnode.py @@ -194,7 +194,7 @@ def makelist(filename): n.setHeading(prtysrch.group(2)) # Set SOURCE property to a file+heading based org-mode link to the entry - escaped_heading = n.Heading().replace("[","\[").replace("]","\]") + escaped_heading = n.Heading().replace("[","\\[").replace("]","\\]") n.properties['SOURCE'] = f'[[file:{normalize_filename(filename)}::*{escaped_heading}]]' return nodelist diff --git a/src/search_filter/date_filter.py b/src/search_filter/date_filter.py index 68e75274..dc70ca29 100644 --- a/src/search_filter/date_filter.py +++ b/src/search_filter/date_filter.py @@ -32,7 +32,7 @@ class DateFilter: return query, entries, embeddings # remove date range filter from query - query = re.sub(f'\s+{self.date_regex}', ' ', query) + query = re.sub(rf'\s+{self.date_regex}', ' ', query) query = re.sub(r'\s{2,}', ' ', query).strip() # remove multiple spaces # find entries containing any dates that fall with date range specified in query