improvement: consistent use of delimiter

This commit is contained in:
2025-06-18 15:27:40 +02:00
parent 428b9de85c
commit 7822f27a4f
9 changed files with 102 additions and 65 deletions

View File

@@ -1,5 +1,13 @@
## src/awk/approx.awk
##
## Generate single-line approximate information for every iCalendar argument.
## The fields in each line are separated by "\t"
## The fields are the following:
## 1. "~" (constant, indicating that the lines contains approximate information)
## 2. start (this can be used in date (1))
## 3. end (this can be used in date (1)
## 4. string to display
## 5. filename (collection/name)
##
## @assign collection_labels: See configuration of the current program.
@@ -25,8 +33,8 @@ function fn(path, n, a) {
# @return: colorized single-line title string
function title(start, summary) {
summary = getcontent(summary)
gsub("\n", " ", summary) # This will be put on a single line
gsub("\\|", ":", summary) # we use "|" as delimiter
gsub("\n", " ", summary) # This will be put on a single line
gsub("\\t", " ", summary) # we use "\t" as delimiter
depth = split(FILENAME, path, "/")
collection = depth > 1 ? path[depth-1] : ""
collection = collection in collection2label ? collection2label[collection] : collection
@@ -36,7 +44,7 @@ function title(start, summary) {
# AWK program
BEGIN {
FS="[:;=]"
OFS="|"
OFS="\t"
split(collection_labels, mapping, ";")
for (map in mapping)
{