bugfix: handle "\r"

This commit is contained in:
2025-10-22 12:01:42 +02:00
parent 5330864ae5
commit 25d22f8dc5
3 changed files with 3 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ BEGIN {
OFF = "\033[m"
}
BEGINFILE { inside = 0; rs = 0; dur = 0; summary = ""; start = "ERROR"; end = "ERROR" }
{ gsub("\r", "") }
/^END:VEVENT/ { print "~", start, dur ? start " " end : end, title(start, summary), fn(FILENAME); nextfile }
/^DTSTART/ && inside { start = parse_dt(getparam($0), getcontent($0)) }
/^DTEND/ && inside { end = parse_dt(getparam($0), getcontent($0)) }

View File

@@ -6,6 +6,7 @@
@include "lib/awk/icalendar.awk"
BEGIN { FS = ":"; regex = "^" field }
{ gsub("\r", "") }
/^BEGIN:VEVENT$/ { inside = 1 }
/^END:VEVENT$/ { exit }
$0 ~ regex { content = $0; next }

View File

@@ -47,6 +47,7 @@ BEGIN {
collection2label[m[1]] = m[2]
}
}
{ gsub("\r", "") }
/^END:VEVENT/ && inside { print_data(start, dur, end, summary); exit }
/^DTSTART/ && inside { start = parse_dt(getparam($0), getcontent($0)) }
/^DTEND/ && inside { end = parse_dt(getparam($0), getcontent($0)) }