Skip to content

Commit 17b1452

Browse files
authored
Merge pull request #46 from SeiferTim/main
fixed events
2 parents 641caac + e257c78 commit 17b1452

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

layouts/events/single.html

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,26 +77,33 @@ <h2>{{ $eventDate }}</h2>
7777
{{ $event.where }}
7878
{{- end }}
7979
</p>
80-
80+
8181
{{- $description := $event.desc | safeHTML -}}
8282

83-
{{- $matches := findRESubmatch `[<br>]+For full details, including the address, and to RSVP see: <a href="([^"]+)"[^>]*>[^<]+</a>` $description -}}
83+
{{/* Match and extract the event ID from the RSVP section */}}
84+
{{- $regex := `(?s)(<br\s*/?>)*\s*For full details, including the address, and to RSVP see:(?:.*)(?:<a[^>]*href=")?https://www\.meetup\.com/st-louis-game-developers/events/([0-9]+)/?(?:".*?>.*?</a>)?` -}}
85+
86+
{{- $matches := findRESubmatch $regex $description -}}
8487

8588
{{- if gt (len $matches) 0 -}}
86-
{{- $match := index $matches 0 -}} {{/* first full match group */}}
87-
{{- $fullMatch := index $match 0 -}} {{/* entire match string */}}
88-
{{- $url := index $match 1 -}} {{/* captured URL */}}
89+
{{- $firstMatch := index $matches 0 -}} {{/* the inner []string */}}
90+
{{- $fullMatch := index $firstMatch 0 -}} {{/* full matched string */}}
91+
{{- $eventID := index $firstMatch 1 -}} {{/* captured group with event ID */}}
8992

90-
{{- $cleanDescription := replace $description $fullMatch "" -}}
93+
{{- $cleanDescription := replace $description $fullMatch "" -}}
9194

92-
<p class="card-text">{{ $cleanDescription | safeHTML }}</dd>
93-
<div class="mt-3 text-center">
94-
<a href="{{ $url }}" class="btn btn-primary" target="_blank" rel="noopener">RSVP</a>
95-
</div>
95+
<p class="card-text">{{ $cleanDescription | safeHTML }}</dd>
96+
<div class="mt-3 text-center">
97+
<a href="https://www.meetup.com/st-louis-game-developers/events/{{ $eventID }}" class="btn btn-primary" target="_blank" rel="noopener">
98+
Details & RSVP
99+
</a>
100+
</div>
96101
{{- else -}}
97102
<p class="card-text">{{ $description }}</dd>
98103
{{- end }}
99104

105+
106+
100107
</div>
101108
</div>
102109
</div>

layouts/partials/next-event.html

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,29 @@
4343

4444
{{- $description := $next.description | safeHTML -}}
4545

46-
{{- $matches := findRESubmatch `[<br>]+For full details, including the address, and to RSVP see: <a href="([^"]+)"[^>]*>[^<]+</a>` $description -}}
46+
{{/* Match and extract the event ID from the RSVP section */}}
47+
{{- $regex := `(?s)(<br\s*/?>)*\s*For full details, including the address, and to RSVP see:(?:.*)(?:<a[^>]*href=")?https://www\.meetup\.com/st-louis-game-developers/events/([0-9]+)/?(?:".*?>.*?</a>)?` -}}
48+
49+
{{- $matches := findRESubmatch $regex $description -}}
4750

4851
{{- if gt (len $matches) 0 -}}
49-
{{- $match := index $matches 0 -}} {{/* first full match group */}}
50-
{{- $fullMatch := index $match 0 -}} {{/* entire match string */}}
51-
{{- $url := index $match 1 -}} {{/* captured URL */}}
52+
{{- $firstMatch := index $matches 0 -}} {{/* the inner []string */}}
53+
{{- $fullMatch := index $firstMatch 0 -}} {{/* full matched string */}}
54+
{{- $eventID := index $firstMatch 1 -}} {{/* captured group with event ID */}}
5255

5356
{{- $cleanDescription := replace $description $fullMatch "" -}}
5457

5558
<dd class="">{{ $cleanDescription | safeHTML }}</dd>
5659
<div class="mt-3 text-center">
57-
<a href="{{ $url }}" class="btn btn-primary" target="_blank" rel="noopener">RSVP</a>
60+
<a href="https://www.meetup.com/st-louis-game-developers/events/{{ $eventID }}" class="btn btn-primary" target="_blank" rel="noopener">
61+
Details & RSVP
62+
</a>
5863
</div>
5964
{{- else -}}
6065
<dd class="">{{ $description }}</dd>
6166
{{- end }}
6267

6368

64-
6569
</dl>
6670
</section>
6771
{{ else }}

0 commit comments

Comments
 (0)