The simplest useful script to custom-convert your database to latex could be something like::
import yapbib.biblist as biblist
#
# Change here to your files
bibfile= yourbib.bib # input database
outputfile=myfile.tex # output latex file
# latexstyle, overrides default values
latexstyle={ 'url': None, # Do not include url
'doi': None, # Do not include doi
'author': (r'\textbf{',r'}'), # Write the authors in boldface
}
b=biblist.BibList()
b.import_bibtex(bibfile)
# Sort them in your specified order and export them to latex list
b.sort(['year','firstpage','author','journal'],reverse=True)
b.export_latex(outputfile,style=latexstyle)
You can also manipulate the data prior to convert it (though bibmanage.py already does it):
import yapbib.biblist as biblist
#
# Change here to your files
bibfile= yourbib.bib # input database
outputfile=myfile.tex # output latex file
# latexstyle, overrides default values
latexstyle={ 'url': None, # Do not include url
'doi': None, # Do not include doi
'author': (r'\textbf{',r'}'), # Write the authors in boldface
}
b=biblist.BibList()
b.import_bibtex(bibfile)
# Select only some items
items= b.search(findstr='name1',fields=['author','key'])
# Create a reduced database
bout= biblist.BibList()
for it in items:
bout.add_item(b.get_item(it),it)
# Sort them in your specified order and export them to latex list
bout.sort(['year','firstpage','author','journal'],reverse=True)
bout.export_latex(outputfile,style=latexstyle)
The list of thesis performed at our lab was created with the following script:
import yapbib.biblist as biblist
bibfile= 'tesis.bib'
outputfile= 'tesis.html'
htmlstyle={'fields':['author','title','director','school','year'],
'author': ('<span class="authors">', '</span><BR>'),
'director':('<BR><span class="director">','</span>. ')}
css_style=""".title a,
.title {font-weight: bold; color : #416DFF; }
ol.bibliography li{ nmargin-bottom:0.5em;}
.year:before {content:" (";}
.year:after {content:").";}
.authors {font-weight:bold; display:list;}
.authors:after {content:". ";}
.director:before{content:"Director: ";}
"""
head='''
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
{0}</style>
<title>Tesis Doctorales</title>
</head>
<body>
<h2>Tesis Doctorales (PhD Thesis)</h2>
<ol class="bibliography">
'''.format(css_style)
b=biblist.BibList()
b.import_bibtex(bibfile)
b.sort(['year','author','reverse'])
b.export_html(outputfile, head= head, style= htmlstyle, separate_css=False)
>>> import yapbib.biblist as biblist
>>> b=biblist.BibList()
>>> b.import_bibtex('mybib.bib')
>>> items= b.List() # Shows the keys of all entries
>>> items
['KEY1','KEY2']
>>> it= b.get_item(items[0]) # Get first item
>>> it= b.get_items()[0] # (Alternative) to get first item
>>> it.get_fields() # Show all fields for item
>>> it.preview() # Show a preview (brief info)
>>> bib= it.to_bibtex() # get item in BibTeX form
>>> tex= it.to_latex() # get item in LaTeX form
>>> html= it.to_html() # get item in html form
>>> print it # print full information on the item
>>> print unicode(it) # Use this if it has non-ascii characters