regolith/tools.py
def make_bibtex_file(pubs, pid, person_dir='.'):
    """Make a bibtex file given the publications

    Parameters
    ----------
    pubs : list of dict
        The publications
    pid : str
        The person id
    person_dir : str, optional
        The person's directory
    """
    if not HAVE_BIBTEX_PARSER:
        return None
    skip_keys = {'ID', 'ENTRYTYPE', 'author'}
    bibdb = BibDatabase()
    bibwriter = BibTexWriter()
    bibdb.entries = ents = []
    for pub in pubs:
        ent = dict(pub)
        ent['ID'] = ent.pop('_id')
        ent['ENTRYTYPE'] = ent.pop('entrytype')
        for n in ['author', 'editor']:
            if n in ent:
                ent[n] = ' and '.join(ent[n])
        for key in ent.keys():
            if key in skip_keys:
                continue
            ent[key] = latex_safe(ent[key])
        ents.append(ent)
    fname = os.path.join(person_dir, pid) + '.bib'
    with open(fname, 'w') as f:
        f.write(bibwriter.write(bibdb))
    return fname
Make a bibtex file given the publications

    Parameters
    ----------
    pubs : list of dict
        The publications
    pid : str
        The person id
    person_dir : str, optional
        The person's directory
    
Make a bibtex file given the publications
Parameters

pubs : list of dict
The publications
pid : str
The person id
person_dir : str, optional
The person's directory
Make a bibtex file given the publications Parameters pubs : list of dict The publications pid : str The person id person_dir : str optional The person ' s directory
def make_bibtex_file(pubs, pid, person_dir='.'):
    if not HAVE_BIBTEX_PARSER:
        return None
    skip_keys = {'ID', 'ENTRYTYPE', 'author'}
    bibdb = BibDatabase()
    bibwriter = BibTexWriter()
    bibdb.entries = ents = []
    for pub in pubs:
        ent = dict(pub)
        ent['ID'] = ent.pop('_id')
        ent['ENTRYTYPE'] = ent.pop('entrytype')
        for n in ['author', 'editor']:
            if n in ent:
                ent[n] = ' and '.join(ent[n])
        for key in ent.keys():
            if key in skip_keys:
                continue
            ent[key] = latex_safe(ent[key])
        ents.append(ent)
    fname = os.path.join(person_dir, pid) + '.bib'
    with open(fname, 'w') as f:
        f.write(bibwriter.write(bibdb))
    return fname
def make_bibtex_file ( pubs , pid , person_dir = '.' ) : if not HAVE_BIBTEX_PARSER : return None skip_keys = { 'ID' , 'ENTRYTYPE' , 'author' } bibdb = BibDatabase ( ) bibwriter = BibTexWriter ( ) bibdb . entries = ents = [ ] for pub in pubs : ent = dict ( pub ) ent [ 'ID' ] = ent . pop ( '_id' ) ent [ 'ENTRYTYPE' ] = ent . pop ( 'entrytype' ) for n in [ 'author' , 'editor' ] : if n in ent : ent [ n ] = ' and ' . join ( ent [ n ] ) for key in ent . keys ( ) : if key in skip_keys : continue ent [ key ] = latex_safe ( ent [ key ] ) ents . append ( ent ) fname = os . path . join ( person_dir , pid ) + '.bib' with open ( fname , 'w' ) as f : f . write ( bibwriter . write ( bibdb ) ) return fname
Make a bibtex file given the publications
Parameters
Make a bibtex file given the publications Parameters
"""Make a bibtex file given the publications

    Parameters
    ----------
    pubs : list of dict
        The publications
    pid : str
        The person id
    person_dir : str, optional
        The person's directory
    """
pubs
pid
person_dir