From: Paul Hänsch Date: Mon, 15 Apr 2024 11:05:08 +0000 (+0200) Subject: omit listing of empty courses and vcards X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=efc3ea0ce4c4d8efbe95d138e18c266ee2547975;p=confetti omit listing of empty courses and vcards --- diff --git a/cards/list.sh b/cards/list.sh index a7b8c13..6e78def 100755 --- a/cards/list.sh +++ b/cards/list.sh @@ -113,11 +113,9 @@ print_cards(){ while read cardfile; do cachefile="${_DATA}/cache/${cardfile##*/}.cache" - # if [ -s "$cachefile" -a "$cachefile" -nt "$cardfile" \ - # -a "$cachefile" -nt "${_EXEC}/cards" ]; then if [ -s "$cachefile" -a "$cachefile" -nt "$cardfile" ]; then cat "$cachefile" - else + elif [ -s "$cardfile" ]; then print_card "$cardfile" |tee "$cachefile" fi done diff --git a/courses/list.sh b/courses/list.sh index 7152266..95857ec 100755 --- a/courses/list.sh +++ b/courses/list.sh @@ -53,6 +53,7 @@ edit_course(){ print_course(){ local coursefile="$1" local course="$(pdi_load "$coursefile")" + cat <<-EOF [div .course #${coursefile##*/} [div .section .basic . $( @@ -94,7 +95,7 @@ print_courses(){ cachefile="${_DATA}/cache/${calfile##*/}.cache" if [ -s "$cachefile" -a "$cachefile" -nt "$calfile" ]; then cat "$cachefile" - else + elif [ -s "$calfile" ]; then print_course "$calfile" |tee "$cachefile" fi done