";
printf("");
print "[" label "]";
if (key != label) printf("");
printf(" | ");
# strip key out of first line
line = substr($1,right+1);
# process each line
lineno=1;
while (lineno<=NF) {
# if last line then check for "\end{thebibliography}"
if (lineno==NF) sub(/\n\\end{thebibliography}/,"",line);
# first take out any urls before any more processing
while ((left=match(line,/\\url{/))>0) {
right= matchBrace(line,RSTART+4);
if (right>left) {
urlcnt++;
url[urlcnt] = substr(line,left+5,right-left-5); # assumes just one url per line
line = substr(line,1,left-1) "__URL" urlcnt "__" substr(line,right+1);
}
}
# repeat for hrefs
while ((left=match(line,/\\href{/))>0) {
right= matchBrace(line,RSTART+5);
if (right>left) {
urlcnt++;
url[urlcnt] = substr(line,left+6,right-left-6); # assumes just one url per line
# now find href text, starting with next '{'
if ((left2 = match(substr(line,right+1),/{/))>0) {
left2 += right;
right = matchBrace(line,left2);
txt[urlcnt] = substr(line,left2+1,right-left2-1);
}
# replace
line = substr(line,1,left-1) "__URL" urlcnt "__" substr(line,right+1);
}
}
line = authorFormat(line);
# re-insert formatted urls
while (urlcnt) {
url[urlcnt] = urlFormat(url[urlcnt],txt[urlcnt]);
urlmark = "__URL" urlcnt "__";
# can't use sub() because url[urlcnt] may contain "&"
# sub(urlmark,url[urlcnt],line);
if (match(line,urlmark)) {
line = substr(line,1,RSTART-1) url[urlcnt] substr(line,RSTART+RLENGTH);
}
urlcnt--;
}
print line " ";
# get ready for next line
lineno++;
line = $lineno;
}
printf(" |
");
if (!bigtable) print "