#! /usr/bin/env python # import sys import bibtexparser from bibtexparser.bparser import BibTexParser import bibtexparser.customization areas = { u'cv':(u'Computer Vision', u'Images/Vision-100.png'), u'ai':(u'Artificial Intelligence', u'Images/AI-100.png'), u'ml':(u'Machine Learning', u'Images/ML-80.png'), u'forensics':(u'Forensics', u'Images/Forensics-80.png'), u'access':(u'Accessibility', u'Images/Access-80.png'), u'cg':(u'Computer Graphics', u'Images/Graphics-80.png'), u'asl':(u'Sign Language', u'Images/ASL-100.png'), u'wavelets':(u'Wavelets', u'Images/Wavelet-100.png'), u'sport': (u'Sport', u'Images/Sport-80.png'), u'uncert': (u'Uncertanties', u'Images/Uncert-100.png'), u'virtcrd': (u'Virtual Crowds', u'Images/Crowd-80.png'), u'med': (u'Biomedical', u'Images/Med-64.png'), u'biblio': (u'Bibliometrics', u'Images/Book-80.png') } areas_keys = areas.keys() def stripnline(record): if u"author" in record: record[u"author"] = record[u"author"].replace(u'\n', u' ').strip() if "title" in record: record[u"title"] = record[u"title"].replace(u'\n', u' ').strip() return record def customizations(record): """Use some functions delivered by the library :param record: a record :returns: -- customized record """ record = bibtexparser.customization.type(record) # record = author(record) # record = editor(record) # record = journal(record) record = bibtexparser.customization.keyword(record) # record = link(record) # record = page_double_hyphen(record) # record = doi(record) record = stripnline(record) return record # # input is the variable with all the text of the bibtex file # output is a list of dictionaries # def parseBibtex( bibtex_fname ): with open(bibtex_fname) as bibtex_file: parser = BibTexParser() parser.customization = customizations bibtex_database = bibtexparser.load(bibtex_file, parser=parser) # fix encoding #// source = parser.checkEncoding(source) # fix latex special characters, among other things # source = parser.preprocess(source) #.encode('utf-8')) # get list of dictionaries return bibtex_database.entries def toBibtex (ref, valid_fields=[u'title', u'editor', u'author', u'journal', u'booktitle', u'publisher', u'school', u'issn', u'volume', u'number', u'pages', u'year', u'doi', u'pdf'], omit_fields=[]): omit = [each.lower() for each in omit_fields] fields = [each.lower() for each in valid_fields] # ttable = [('&', r'\&'), # ('~', r'\~'), # ('—',r'---'), # ('–', r'--'), # ] bib_key = ref[u'ID'] ref_type = ref[u'ENTRYTYPE'].replace(u'Reference','') bibtex = u'\n@' + ref_type + u'{' + bib_key + u',\n' # '%s{%s,\n" % (ref_type, bib_key) ref_keys = ref.keys() for k in fields: if k in ref_keys and k not in omit: if type(ref[k]) == list: nv = ref[k][0] else: nv = ref[k] # for a,b in ttable: # nv = nv.replace(a,b) bibtex = bibtex + u' ' bibtex = bibtex + k bibtex = bibtex + u' = {' # bibtex = bibtex + unicode(nv.encode('utf8')) # bibtex = bibtex + unicode(nv, encoding='utf8') bibtex = bibtex + nv bibtex = bibtex + u'},\n' # remove trailing command bibtex = bibtex[0:-2] + u"}\n" return bibtex def toHTML (ref, numb=0, valid_fields=[u'title', u'editor', u'author', u'journal', u'booktitle', u'publisher', u'school', u'issn', u'volume', u'number', u'pages', u'year', u'doi', u'pdf', u'abstract'], omit_fields=[]): omit = [each.lower() for each in omit_fields] fields = [each.lower() for each in valid_fields] ref_type = ref[u'ENTRYTYPE'].replace('Reference','').lower() bib_key = ref[u'ID'] bid = 'b' + bib_key ref_keys = ref.keys() html = u'
Publications |
The full CV, at the CNPq CV repository, is available here (in portuguese).
""" return a def posamble(): a = """' for ent in pord: webpg += u' ' webpg += u' ' + unicode(ent[1]) + u' ' webpg += u'