awk: imports now
This commit is contained in:
@@ -3,48 +3,7 @@
|
||||
# See https://datatracker.ietf.org/doc/html/rfc5545 for the RFC 5545 that
|
||||
# describes iCalendar, and its syntax
|
||||
|
||||
# Make string single-line
|
||||
#
|
||||
# @input str: String
|
||||
# @return: String without newlines
|
||||
function singleline(str) {
|
||||
gsub("\\n", " ", str)
|
||||
return str
|
||||
}
|
||||
|
||||
# Isolate and unescape the content part of an iCalendar line.
|
||||
#
|
||||
# @local variables: i, c, c2, res
|
||||
# @input str: String
|
||||
# @return: Unescaped string
|
||||
function unescape(str, i, c, c2, res) {
|
||||
for(i=1; i<=length(str);i++) {
|
||||
c = substr(str, i, 1)
|
||||
if (c != "\\") {
|
||||
res = res c
|
||||
continue
|
||||
}
|
||||
i++
|
||||
c2 = substr(str, i, 1)
|
||||
if (c2 == "n" || c2 == "N") {
|
||||
res = res "\n"
|
||||
continue
|
||||
}
|
||||
# Alternatively, c2 is "\\" or "," or ";". In each case, append res with
|
||||
# c2. If the strings has been escaped correctly, then the character c2
|
||||
# cannot be anything else. To be fail-safe, simply append res with c2.
|
||||
res = res c2
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
# Isolate content part of an iCalendar line, and unescape.
|
||||
#
|
||||
# @input str: String
|
||||
# @return: Unescaped content part
|
||||
function getcontent(str) {
|
||||
return unescape(substr(str, index(str, ":") + 1))
|
||||
}
|
||||
@include "lib/awk/icalendar.awk"
|
||||
|
||||
# formatdate
|
||||
# Generate kind-of-pretty date strings.
|
||||
|
||||
Reference in New Issue
Block a user