From: Paul Hänsch Date: Thu, 25 Jan 2024 02:32:33 +0000 (+0100) Subject: reduce event entries to invisible anchor X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=3601593ab76ccf5ea1360c6c588bd3326e5b956d;p=shellwiki reduce event entries to invisible anchor --- diff --git a/macros/event b/macros/event index 17aad04..1f77cfb 100755 --- a/macros/event +++ b/macros/event @@ -135,80 +135,7 @@ if LOCK './#events'; then RELEASE './#events' fi -start="$(date -ud "$start_date $start_time" +%s)" - end="$(date -ud "$end_date $end_time" +%s)" - -if [ $_DATE -le $end ]; then - nstart="$start" nend="$end" -fi - -[ $_DATE -gt $end ] && case $rec_int in - day) - nend=$(( rec_freq * 86400 - (_DATE - end) % (rec_freq * 86400) + _DATE )) - nstart=$(( start - end + nend)) - ;; - week) - nend=$(( rec_freq * 604800 - (_DATE - end) % (rec_freq * 604800) + _DATE )) - nstart=$(( start - end + nend)) - ;; - month) - { read _y _m _d; read y m d; } <<-EOF - $(date -ud @$_DATE +"%Y %_m %_d" - date -ud @$start +"%Y %_m %_d" - ) - EOF - _m=$((_y * 12 + _m)) m=$((y * 12 + m)) - while :; do - # mod=$(( (_m - m) % rec_freq )); [ $mod -eq 0 ] && mod="$rec_freq"; - m=$(( rec_freq - ((_m - m - 1) % rec_freq + 1) + _m )) - # y=$(((m - 1) / 12)) m=$(((m - 1) % 12 + 1)); # [ $m -eq 0 ] && y=$((y - 1)) m=12; - nstart="$(printf '%04i-%02i-%02i' "$(( (m - 1) / 12 ))" "$(( (m - 1) % 12 + 1 ))" "$d")" - if isdate "$nstart" && [ "$(date -ud "$nstart" +%s)" -ge "$_DATE" ]; then - break - fi >/dev/null - # m=$((y * 12 + m)) - _m="$((_m + rec_freq))" - done - nstart="$(date -ud "$nstart $start_time" +%s)" - nend="$((end - start + nstart))" - ;; - year) - { read _y _m _d; read y m d; } <<-EOF - $(date -ud @$_DATE +"%Y %_m %_d" - date -ud @$start +"%Y %_m %_d" - ) - EOF - while :; do - # mod=$(( ( _y - y ) % rec_freq )); [ $mod -eq 0 ] && mod="$rec_freq" - y=$(( rec_freq - ((_y - y - 1) % rec_freq + 1) + _y )) - nstart="$(printf '%04i-%02i-%02i' "$y" "$m" "$d")" - if isdate "$nstart" && [ $(date -ud "$nstart" +%s) -ge $_DATE ]; then - break - fi >/dev/null - _y="$((_y + rec_freq))" - done - nstart="$(date -ud "$nstart $start_time" +%s)" - nend="$((end - start + nstart))" - ;; - '') - nstart="$start" nend="$end" - ;; -esac - -if [ "$nstart" -gt "$rec_end" ] 2>/dev/null; then - nstart="$start" nend="$end" -fi - -"$_EXEC/cgilite/html-sh.sed" <<-EOF - [div .macro .event #event${evid} - [label . $(HTML "$title")] - [dl - [dt $(_ Start:)][dd $(date -ud @$nstart +"%F %T")] - [dt $(_ End:)][dd $(date -ud @$nend +"%F %T")] - [dt $(_ Until:)][dd $(date -ud @$rec_end +"%F %T")] - ] - ] -EOF +printf '
' "${evid}" # uid="$(timeid)" # tzid="$(cat /etc/timezone || printf 'UTC')"