improved utf-8 usage, and color scheme

This commit is contained in:
Ämin Baumeler 2025-06-17 15:19:21 +02:00
parent 6d1d5ce1c6
commit 2e96e31a5b
2 changed files with 8 additions and 8 deletions

View File

@ -27,7 +27,7 @@ function color_from_status(status) {
# @return: Single-line string # @return: Single-line string
function allday(collection, desc, status, color) { function allday(collection, desc, status, color) {
color = color_from_status(status) color = color_from_status(status)
return collection " " LIGHT_CYAN ITALIC FAINT " (allday) " OFF color desc OFF return collection " " LIGHT_CYAN ITALIC FAINT " (allday) " OFF color desc OFF
} }
# Return line for multi-day event, or event that starts at midnight, which ends today. # Return line for multi-day event, or event that starts at midnight, which ends today.
@ -40,7 +40,7 @@ function allday(collection, desc, status, color) {
# @return: Single-line string # @return: Single-line string
function endstoday(stop, collection, desc, status) { function endstoday(stop, collection, desc, status) {
color = color_from_status(status) color = color_from_status(status)
return collection " " LIGHT_CYAN " -- " stop OFF ": " color desc OFF return collection " " LIGHT_CYAN " → " stop ": " OFF color desc OFF
} }
# Return line for event that starts sometime today. # Return line for event that starts sometime today.
@ -55,9 +55,9 @@ function endstoday(stop, collection, desc, status) {
function slice(start, stop, collection, desc, status) { function slice(start, stop, collection, desc, status) {
color = color_from_status(status) color = color_from_status(status)
if (stop == "00:00") if (stop == "00:00")
return collection " " LIGHT_CYAN start " -- " OFF ": " color desc OFF return collection " " LIGHT_CYAN start " → " ": " OFF color desc OFF
else else
return collection " " LIGHT_CYAN start OFF " -- " LIGHT_CYAN stop OFF ": " color desc OFF return collection " " LIGHT_CYAN start " " stop ": " OFF color desc OFF
} }
# Print line for a single hour entry. # Print line for a single hour entry.
@ -65,7 +65,7 @@ function slice(start, stop, collection, desc, status) {
# @input hour: Hour of the entry # @input hour: Hour of the entry
function hrline(hour) { function hrline(hour) {
hour = hour < 10 ? "0"hour : hour hour = hour < 10 ? "0"hour : hour
print today, hour, "", "", "", " " FAINT hour ":00 ----------------------" OFF print today, hour, "", "", "", " " FAINT hour ":00 ----------------------" OFF
} }
# Print lines for hour entries before an event that starts at `start` and stops # Print lines for hour entries before an event that starts at `start` and stops

View File

@ -22,9 +22,9 @@ BEGIN {
OFS = "|" OFS = "|"
} }
/^[0-7] 00:00 -- 00:00/ { dayline = dayline " " c(); next } /^[0-7] 00:00 -- 00:00/ { dayline = dayline " " c(); next }
/^[0-7] 00:00 -- / { dayline = dayline " <--" $4 " " c(); next } /^[0-7] 00:00 -- / { dayline = dayline " " $4 " " c(); next }
/^[0-7] [0-9]{2}:[0-9]{2} -- 00:00/ { dayline = dayline " " $2 "→" c(); next } /^[0-7] [0-9]{2}:[0-9]{2} -- 00:00/ { dayline = dayline " " $2 " " c(); next }
/^[0-7] [0-9]{2}:[0-9]{2} -- [0-9]{2}:[0-9]{2}/ { dayline = dayline " " $2 " - " $4 " " c(); next } /^[0-7] [0-9]{2}:[0-9]{2} -- [0-9]{2}:[0-9]{2}/ { dayline = dayline " " $2 " " $4 " " c(); next }
/^[0-7]$/ && dayline { print "+", startofweek " +" $0-1 " days", "", dayline } /^[0-7]$/ && dayline { print "+", startofweek " +" $0-1 " days", "", dayline }
/^[0-7]$/ { /^[0-7]$/ {
cmd = "date -d '" startofweek " +" $0 " days' +\"%a %e %b %Y\"" cmd = "date -d '" startofweek " +" $0 " days' +\"%a %e %b %Y\""