diff --git a/layouts/shortcodes/cal_layout.html b/layouts/shortcodes/cal_layout.html
index 159ce77..f0adce7 100644
--- a/layouts/shortcodes/cal_layout.html
+++ b/layouts/shortcodes/cal_layout.html
@@ -1,12 +1,3 @@
-
-
{{ $date := now }}
{{ $month := $date.Month | int }}
@@ -50,16 +41,95 @@ function simulateLinkClick() {
+ {{ if eq .Site.Language.Lang "pl" }}
+ {{ $polish_month_names := slice "Styczeń" "Luty" "Marzec" "Kwiecień" "Maj" "Czerwiec" "Lipiec" "Sierpień" "Wrzesień" "Październik" "Listopad" "Grudzień" }}
+ {{ $month := sub $month 1}}
+ {{ $label := index $polish_month_names $month }}
+
{{ printf "%s %d" $label $year }}
+ {{ else }}
+
{{ time.Format "January 2006" $t1 }}
+ {{ end }}
+
+
+ {{ $days := slice "sun" "mon" "tues" "wend" "thurs" "fri" "sat" }}
+ {{ range $days }}
{{ i18n (printf "days.%s" .) }}
{{ end }}
+
+
+
+ {{ $padding := $t1.Weekday | int }}
+ {{ if gt $padding 0 }}
+ {{ range seq 1 $padding }}
+
+ {{ end }}
+ {{ end }}
+
+ {{ range seq 1 $daysInMonth }}
+
+ {{ $startDate := time.AsTime ( printf "%4d-%02d-%02dT00:00:00" $year $month . ) }}
+ {{ $endDate := time.AsTime ( printf "%4d-%02d-%02dT23:59:59" $year $month . ) }}
+
{{ . }}
+
{{ $startDate | time.Format ":date_long" }}
+
+ {{ $eventCount := 0 }}
+ {{ range where $.Site.RegularPages "Section" "eq" "events" }}
+ {{ $eventStart := time.AsTime .Params.start_date }}
+ {{ $eventEnd := time.AsTime .Params.end_date }}
+
+ {{ if and ( or ($eventEnd.After $startDate) ($eventEnd.Equal $startDate)) (or ( $eventStart.Before $endDate ) ( $eventStart.Equal $endDate )) }}
+ {{ $eventCount = add $eventCount 1 }}
+
+ {{ end }}
+ {{ end }}
+ {{ if gt $eventCount 1 }}
+ {{ errorf "Error: Multiple events per day currently unsuported"}}
+ {{ end }}
+
{{ end }}
@@ -108,74 +178,22 @@ function simulateLinkClick() {
{{ . }}
{{ $startDate | time.Format ":date_long" }}
+ {{ $eventCount := 0 }}
{{ range where $.Site.RegularPages "Section" "eq" "events" }}
{{ $eventStart := time.AsTime .Params.start_date }}
{{ $eventEnd := time.AsTime .Params.end_date }}
{{ if and ( or ($eventEnd.After $startDate) ($eventEnd.Equal $startDate)) (or ( $eventStart.Before $endDate ) ( $eventStart.Equal $endDate )) }}
+ {{ $eventCount = add $eventCount 1 }}
{{ end }}
{{ end }}
-
- {{ end }}
-
-
-
-{{ $date := $date.AddDate 0 1 0 }}
-
-{{ $month := $date.Month | int }}
-{{ $year := $date.Year }}
-
-{{ $t1 := printf "%4d-%02d-01" $year $month }}
-{{ $t1 := time.AsTime $t1 }}
-{{ $t2 := $t1.AddDate 0 1 0 }}
-
-{{ $daysInMonth := $t2.Sub $t1 }}
-{{ $daysInMonth := $daysInMonth.Hours }}
-{{ $daysInMonth := div $daysInMonth 24 }}
-
-
- {{ if eq .Site.Language.Lang "pl" }}
- {{ $polish_month_names := slice "Styczeń" "Luty" "Marzec" "Kwiecień" "Maj" "Czerwiec" "Lipiec" "Sierpień" "Wrzesień" "Październik" "Listopad" "Grudzień" }}
- {{ $month := sub $month 1}}
- {{ $label := index $polish_month_names $month }}
-
{{ printf "%s %d" $label $year }}
- {{ else }}
-
{{ time.Format "January 2006" $t1 }}
- {{ end }}
-
-
- {{ $days := slice "sun" "mon" "tues" "wend" "thurs" "fri" "sat" }}
- {{ range $days }}
{{ i18n (printf "days.%s" .) }}
{{ end }}
-
-
-
- {{ $padding := $t1.Weekday | int }}
- {{ if gt $padding 0 }}
- {{ range seq 1 $padding }}
-
- {{ end }}
- {{ end }}
-
- {{ range seq 1 $daysInMonth }}
-
- {{ $startDate := time.AsTime ( printf "%4d-%02d-%02dT00:00:00" $year $month . ) }}
- {{ $endDate := time.AsTime ( printf "%4d-%02d-%02dT23:59:59" $year $month . ) }}
-
{{ . }}
-
{{ $startDate | time.Format ":date_long" }}
-
- {{ range where $.Site.RegularPages "Section" "eq" "events" }}
- {{ $eventStart := time.AsTime .Params.start_date }}
- {{ $eventEnd := time.AsTime .Params.end_date }}
-
- {{ if and ( or ($eventEnd.After $startDate) ($eventEnd.Equal $startDate)) (or ( $eventStart.Before $endDate ) ( $eventStart.Equal $endDate )) }}
-
- {{ end }}
+ {{ if gt $eventCount 1 }}
+ {{ errorf "Error: Multiple events per day currently unsuported"}}
{{ end }}
+
{{ end }}
@@ -201,3 +219,12 @@ function simulateLinkClick() {
+
+
diff --git a/layouts/shortcodes/calendar.html b/layouts/shortcodes/calendar.html
index c139b05..e28a235 100644
--- a/layouts/shortcodes/calendar.html
+++ b/layouts/shortcodes/calendar.html
@@ -1,12 +1,3 @@
-
-
{{ $date:= .Get "date" }}
{{ if not $date }}
{{ errorf "Error: 'date' is a required parameter." }}
@@ -54,17 +45,32 @@ function simulateLinkClick() {
{{ . }}
{{ $startDate | time.Format ":date_long" }}
+ {{ $eventCount := 0 }}
{{ range where $.Site.RegularPages "Section" "eq" "events" }}
{{ $eventStart := time.AsTime .Params.start_date }}
{{ $eventEnd := time.AsTime .Params.end_date }}
{{ if and ( or ($eventEnd.After $startDate) ($eventEnd.Equal $startDate)) (or ( $eventStart.Before $endDate ) ( $eventStart.Equal $endDate )) }}
+ {{ $eventCount = add $eventCount 1 }}
{{ end }}
{{ end }}
+ {{ if gt $eventCount 1 }}
+ {{ errorf "Error: Multiple events per day currently unsuported" }}
+ {{ end }}
{{ end }}
+
+
+