X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=macros%2Fcalendar;h=66dcf1f5664fffc0cd629bf09542ab5248e7a89f;hb=11ae66b8f347ea9714716b558ba98a7524f9afb8;hp=5a486756537b452d6e53143dff2223bbef2215c6;hpb=d1513c4d506a8628fb6037bc504960c6a4734f29;p=shellwiki diff --git a/macros/calendar b/macros/calendar index 5a48675..66dcf1f 100755 --- a/macros/calendar +++ b/macros/calendar @@ -43,7 +43,7 @@ while [ $# -gt 0 ]; do case $1 in fi;; esac; done -[ "$*" ] || set -- "*" +[ "$*" ] || set -- "." [ "$depth" -ge 0 -o "$depth" -le 0 ] 2>&- || depth=0 read DY DM DD <<-EOF @@ -68,6 +68,7 @@ rrexpand() { local junk1 start end rrfreq rrint rrend evtitle evlink junk2 while read -r junk1 start end rrfreq rrint rrend evtitle evlink junk2; do + [ ! "$start" ] && continue # empty line [ "$rrend" -eq -1 ] && rrend=9999999999 if [ "$start" -lt "$dend" ] && @@ -274,7 +275,6 @@ cal_month() { dcnt=$((iday - idow * 86400 + ws * 86400)) dow=$ws dcal="$(date -ud @"$dcnt" +%d)" - events="$( printf %s\\n "$events" \ | rrexpand "$dcnt" "$((dcnt + 42 * 86400))" \ @@ -291,7 +291,7 @@ cal_month() { printf '' "$dcal" evlist="$( - printf %s\\n "$events" \ + printf %s "${events}${events:+${BR}}" \ | while read start end title link; do if [ "$((start / 86400))" -lt "$((dcnt / 86400))" -a "$end" -gt "$dcnt" ]; then printf '
  • %s
  • ' \ @@ -299,7 +299,7 @@ cal_month() { "$(UNSTRING "${link#*#}" |URL)" \ "$(UNSTRING "$title" |HTML)" elif [ "$((start / 86400))" -eq "$((dcnt / 86400))" ]; then - printf '
  • %s - %s
  • ' \ + printf '
  • %s - %s
  • ' \ "$(date -ud @"$start" +%H:%M)" \ "$(UNSTRING "${link%%#*}" |URL)" \ "$(UNSTRING "${link#*#}" |URL)" \