def process_bib_entry(cid, bibdatabase, bibnums, fallback_fmt=
    '[{author_abbrev}, {year}]'):
    """work out the best way to represent the bib entry """
    entry = bibdatabase[cid]
    if cid not in bibnums:
        bibnums[cid] = len(bibnums) + 1
    if 'doi' in entry:
        return '<a href="https://doi.org/{doi}">{text}</a>'.format(doi=
            entry['doi'], text=bibnums[cid])
    elif 'url' in entry:
        return '<a href="{url}">{text}</a>'.format(url=entry['url'], text=
            bibnums[cid])
    elif 'link' in entry:
        return '<a href="{url}">{text}</a>'.format(url=entry['link'], text=
            bibnums[cid])
    else:
        return bibnums[cid]
