From 69bbb9aabb80453ea1d77ee045879e52096f56f9 Mon Sep 17 00:00:00 2001 From: xoy Date: Sat, 28 Jan 2023 20:16:03 +0100 Subject: [PATCH] =?UTF-8?q?weiter=20an=20der=20funktionalit=C3=A4t=20der?= =?UTF-8?q?=20events=20gearbeitet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- func.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/func.go b/func.go index 35e84ca..cbb8d9c 100644 --- a/func.go +++ b/func.go @@ -146,10 +146,20 @@ func htmlReplacer(input string, activePage string) string { events := getEvents() if len(events) == 0 { - output = strings.ReplaceAll(output, "!EVENTS", htmlNewBanner("Rundgang", "https://www.chaostreff-dortmund.de/rundgang/")) + output = strings.ReplaceAll(output, "!EVENTS", htmlElement("h4", "Keine Events in der nächsten Zeit!", "")) } else { + tempA, tempB := "", "" + for i, Event := range events { + if i == 24 { + break + } - output = strings.ReplaceAll(output, "!EVENTS", htmlNewBanner("Rundgang", "https://www.chaostreff-dortmund.de/rundgang/")) + tempA = htmlElement("h2", Event.title, "") + tempA += htmlElement("p", Event.description, "") + tempA += htmlElement("p", Event.date, "") + tempB += htmlElement("div", tempA, "class=\"event\"") + } + output = strings.ReplaceAll(output, "!EVENTS", tempB) } output = strings.ReplaceAll(output, "!NEWBANNER", htmlNewBanner("Rundgang", "https://www.chaostreff-dortmund.de/rundgang/"))