From 7ab2a5487fe6a3467e8c2ba5e01a068a9253da51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Niemel=C3=A4?= Date: Wed, 21 Aug 2024 13:34:56 +0200 Subject: [PATCH] Format fix --- .../src/routes/course/[courseId]/+page.svelte | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/routes/course/[courseId]/+page.svelte b/frontend/src/routes/course/[courseId]/+page.svelte index 9a3b2d0..0ec1cbe 100644 --- a/frontend/src/routes/course/[courseId]/+page.svelte +++ b/frontend/src/routes/course/[courseId]/+page.svelte @@ -97,7 +97,21 @@ } } - onMount(() => remove_repeated_br_tags(document)); + // If a p tag is immediately descendent of an li tag, we pop the text out of the p tag + function pop_p_tags(dom: Document) { + let lis = dom.getElementsByTagName("li"); + for (let i = 0; i < lis.length; i++) { + let p = lis[i].getElementsByTagName("p"); + if (p.length > 0) { + lis[i].innerHTML = p[0].innerHTML; + } + } + } + + onMount(() => { + remove_repeated_br_tags(document); + pop_p_tags(document); + });