From 024145b6a103b18c61db91164897d421dea6bfbe Mon Sep 17 00:00:00 2001 From: mithilP007 Date: Mon, 18 May 2026 10:57:41 +0530 Subject: [PATCH] fix: resolve broken external links and missing target handling in learning resources (#245) --- routes/main_routes.py | 9 ++++++++ templates/project.html | 11 +++++----- tests/test_basic.py | 30 +++++++++++++++++++++++++++ utils/link_helper.py | 47 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 91 insertions(+), 6 deletions(-) create mode 100644 utils/link_helper.py diff --git a/routes/main_routes.py b/routes/main_routes.py index 4cce046..2d03e37 100644 --- a/routes/main_routes.py +++ b/routes/main_routes.py @@ -9,10 +9,19 @@ from utils.data_loader import find_project_by_id, get_project_stats from utils.file_server import read_starter_code, resolve_starter_file, get_starter_code_dir +from utils.link_helper import parse_external_link + # Create the Blueprint that app.py will register main = Blueprint("main", __name__) +@main.app_template_filter("parse_resource") +def parse_resource_filter(resource_str): + """Jinja filter to parse a resource string into a standardized dict.""" + return parse_external_link(resource_str) + + + @main.route("/") def index(): """Render the homepage with the skill input form and dynamic stats.""" diff --git a/templates/project.html b/templates/project.html index 21e3ae6..cb65e95 100644 --- a/templates/project.html +++ b/templates/project.html @@ -136,15 +136,14 @@

Learning Resources