""" bibtex_keys = ['EOS', 'CP0', 'CONDUCTIVITY', 'VISCOSITY', 'MELTING_LINE', 'SURFACE_TENSION'] bibtex_map = {'EOS': 'Equation of State', 'CP0': 'Ideal gas specific heat', 'CONDUCTIVITY': 'Thermal Conductivity', 'VISCOSITY': 'Viscosity', 'MELTING_LINE': 'Melting Line', 'SURFACE_TENSION': 'Surface Tension'} from pybtex.database.input import bibtex parser = bibtex.Parser() bibdata = parser.parse_file(os.path.join(root_dir, "CoolPropBibTeXLibrary.bib")) from CoolProp.BibtexParser import BibTeXerClass BTC = BibTeXerClass(os.path.join(root_dir, "CoolPropBibTeXLibrary.bib")) # See http://stackoverflow.com/questions/19751402/does-pybtex-support-accent-special-characters-in-bib-file/19754245#19754245 import pybtex style = pybtex.plugin.find_plugin('pybtex.style.formatting', 'plain')() backend = pybtex.plugin.find_plugin('pybtex.backends', 'html')() parser = pybtex.database.input.bibtex.Parser() def entry2html(entry): for e in entry: return e.text.render(backend).replace('{', '').replace('}', '').replace('\n', ' ') def generate_bibtex_string(fluid): string = ''
def getBibtexParser(filename='../../../CoolPropBibTeXLibrary.bib'): """Create a parser object that can be used to extract entries from a library in Bibtex format.""" fpath = getPath(filename) bibtexer = BibTeXerClass(fpath) return bibtexer