#! /usr/bin/gawk -f
# Last edited on 2019-03-29 10:52:33 by jstolfi
# Processes HTML indices of papers that replace multitab windows.
# Looks for lines of the form "http...", turns them into
..
# If the line has "@@", the right half is used as anchor.
# Otherwise the href itself is used.
# Any other lines are passed through unchanged.
/^[ ]*http/ {
nf = split($0, fld, /[@][@]/);
if (nf == 1) { fld[2] = fld[1]; nf = 2; }
if (nf != 2) { printf "** bug «%s»\n", $0 > "/dev/stderr"; print; next; }
for (i = 1; i <= nf; i++) {
gsub(/^[ ]+/, "", fld[i]);
gsub(/[ ]+$/, "", fld[i]);
}
printf "%s\n", fld[1], fld[2];
next;
}
// { print; next; }