aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bib-ls.awk
blob: c1e9c98068fbc17755b1879499043d60770ed878 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# bib-ls.awk - list database entries
#
# Requires bib-parse.awk and bib-canon.awk. Variables (set with -v):
#   long - 0: print one key per line
#          1: print key, type, author, year and title, tab-separated

function bib_pass(raw) { }

function bib_entry(type, key,    a, t) {
  if (long + 0 == 0) {
    print key
    return
  }
  a = bib_get("author")
  if (a == "")
    a = bib_get("editor")
  a = bib_clean(a)
  if (match(a, / [Aa][Nn][Dd] /))
    a = substr(a, 1, RSTART - 1) " et al."
  t = bib_clean(bib_get("title"))
  printf "%s\t%s\t%s\t%s\t%s\n", key, type, a, bib_get("year"), t
}